From 765f7abc60334b278c97678c41f1ba458db283d0 2009-01-26 01:47:51 From: Eric Davis Date: 2009-01-26 01:47:51 Subject: [PATCH] Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e6b480b..6779fde 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -243,39 +243,36 @@ module ApplicationHelper url_param.clear if url_param.has_key?(:set_filter) html = '' - html << link_to_remote(('« ' + l(:label_previous)), - {:update => 'content', - :url => url_param.merge(page_param => paginator.current.previous), - :complete => 'window.scrollTo(0,0)'}, - {:href => url_for(:params => url_param.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous + if paginator.current.previous + html << link_to_remote_content_update('« ' + l(:label_previous), url_param.merge(page_param => paginator.current.previous)) + ' ' + end html << (pagination_links_each(paginator, options) do |n| - link_to_remote(n.to_s, - {:url => {:params => url_param.merge(page_param => n)}, - :update => 'content', - :complete => 'window.scrollTo(0,0)'}, - {:href => url_for(:params => url_param.merge(page_param => n))}) + link_to_remote_content_update(n.to_s, url_param.merge(page_param => n)) end || '') - - html << ' ' + link_to_remote((l(:label_next) + ' »'), - {:update => 'content', - :url => url_param.merge(page_param => paginator.current.next), - :complete => 'window.scrollTo(0,0)'}, - {:href => url_for(:params => url_param.merge(page_param => paginator.current.next))}) if paginator.current.next + + if paginator.current.next + html << ' ' + link_to_remote_content_update((l(:label_next) + ' »'), url_param.merge(page_param => paginator.current.next)) + end unless count.nil? - html << [" (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})", per_page_links(paginator.items_per_page)].compact.join(' | ') + html << [ + " (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})", + per_page_links(paginator.items_per_page) + ].compact.join(' | ') end html end - + def per_page_links(selected=nil) url_param = params.dup url_param.clear if url_param.has_key?(:set_filter) links = Setting.per_page_options_array.collect do |n| - n == selected ? n : link_to_remote(n, {:update => "content", :url => params.dup.merge(:per_page => n)}, + n == selected ? n : link_to_remote(n, {:update => "content", + :url => params.dup.merge(:per_page => n), + :method => :get}, {:href => url_for(url_param.merge(:per_page => n))}) end links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil @@ -664,4 +661,12 @@ module ApplicationHelper extend helper return self end + + def link_to_remote_content_update(text, url_params) + link_to_remote(text, + {:url => url_params, :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'}, + {:href => url_for(:params => url_params)} + ) + end + end diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb index ed520e7..85ae815 100644 --- a/app/helpers/sort_helper.rb +++ b/app/helpers/sort_helper.rb @@ -121,7 +121,7 @@ module SortHelper url_options = params.has_key?(:set_filter) ? sort_options : params.merge(sort_options) link_to_remote(caption, - {:update => "content", :url => url_options}, + {:update => "content", :url => url_options, :method => :get}, {:href => url_for(url_options)}) + (icon ? nbsp(2) + image_tag(icon) : '') end diff --git a/app/views/projects/changelog.rhtml b/app/views/projects/changelog.rhtml index e4d32a3..e44d1d1 100644 --- a/app/views/projects/changelog.rhtml +++ b/app/views/projects/changelog.rhtml @@ -26,7 +26,7 @@ <% end %> <% content_for :sidebar do %> -<% form_tag do %> +<% form_tag({},:method => :get) do %>

<%= l(:label_change_log) %>

<% @trackers.each do |tracker| %>