diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 55a9737f5..838e63a7c 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -62,12 +62,6 @@ class BoardsController < ApplicationController def edit if request.post? && @board.update_attributes(params[:board]) - case params[:position] - when 'highest'; @board.move_to_top - when 'higher'; @board.move_higher - when 'lower'; @board.move_lower - when 'lowest'; @board.move_to_bottom - end if params[:position] redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' end end diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index 5a79e4b7b..73ae8096a 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -47,21 +47,6 @@ class CustomFieldsController < ApplicationController end @trackers = Tracker.find(:all, :order => 'position') end - - def move - @custom_field = CustomField.find(params[:id]) - case params[:position] - when 'highest' - @custom_field.move_to_top - when 'higher' - @custom_field.move_higher - when 'lower' - @custom_field.move_lower - when 'lowest' - @custom_field.move_to_bottom - end if params[:position] - redirect_to :action => 'index', :tab => @custom_field.class.name - end def destroy @custom_field = CustomField.find(params[:id]).destroy diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 6e136fba4..ac55c421e 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -57,21 +57,6 @@ class EnumerationsController < ApplicationController render :action => 'edit' end end - - def move - @enumeration = Enumeration.find(params[:id]) - case params[:position] - when 'highest' - @enumeration.move_to_top - when 'higher' - @enumeration.move_higher - when 'lower' - @enumeration.move_lower - when 'lowest' - @enumeration.move_to_bottom - end if params[:position] - redirect_to :action => 'index' - end def destroy @enumeration = Enumeration.find(params[:id]) diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index 69d9db965..bee7f4833 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -58,21 +58,6 @@ class IssueStatusesController < ApplicationController render :action => 'edit' end end - - def move - @issue_status = IssueStatus.find(params[:id]) - case params[:position] - when 'highest' - @issue_status.move_to_top - when 'higher' - @issue_status.move_higher - when 'lower' - @issue_status.move_lower - when 'lowest' - @issue_status.move_to_bottom - end if params[:position] - redirect_to :action => 'list' - end def destroy IssueStatus.find(params[:id]).destroy diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index ab70ebf41..6185d70ef 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -64,21 +64,6 @@ class RolesController < ApplicationController redirect_to :action => 'index' end - def move - @role = Role.find(params[:id]) - case params[:position] - when 'highest' - @role.move_to_top - when 'higher' - @role.move_higher - when 'lower' - @role.move_lower - when 'lowest' - @role.move_to_bottom - end if params[:position] - redirect_to :action => 'list' - end - def report @roles = Role.find(:all, :order => 'builtin, position') @permissions = Redmine::AccessControl.permissions.select { |p| !p.public? } diff --git a/app/views/custom_fields/index.rhtml b/app/views/custom_fields/index.rhtml index 70b7197ff..999648f0e 100644 --- a/app/views/custom_fields/index.rhtml +++ b/app/views/custom_fields/index.rhtml @@ -37,12 +37,7 @@ <%= image_tag 'true.png' if custom_field.is_for_all? %> <%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %> <% end %> - - <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => custom_field, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> - <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => custom_field, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - - <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => custom_field, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> - <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => custom_field, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> - + <%= reorder_links('custom_field', {:action => 'edit', :id => custom_field}) %> <%= button_to l(:button_delete), { :action => 'destroy', :id => custom_field }, :confirm => l(:text_are_you_sure), :class => "button-small" %> diff --git a/app/views/enumerations/list.rhtml b/app/views/enumerations/list.rhtml index c4a9af27b..485dec71c 100644 --- a/app/views/enumerations/list.rhtml +++ b/app/views/enumerations/list.rhtml @@ -10,12 +10,7 @@ <%= link_to h(enumeration), :action => 'edit', :id => enumeration %> <%= image_tag('true.png') if enumeration.is_default? %> - - <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => enumeration, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> - <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => enumeration, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - - <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => enumeration, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> - <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => enumeration, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> - + <%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %> <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, :method => :post, :confirm => l(:text_are_you_sure), :class => "icon icon-del" %> diff --git a/app/views/issue_statuses/list.rhtml b/app/views/issue_statuses/list.rhtml index e35911813..fd4e3e8b2 100644 --- a/app/views/issue_statuses/list.rhtml +++ b/app/views/issue_statuses/list.rhtml @@ -18,12 +18,7 @@ <%= link_to status.name, :action => 'edit', :id => status %> <%= image_tag 'true.png' if status.is_default? %> <%= image_tag 'true.png' if status.is_closed? %> - - <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => status, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> - <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => status, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - - <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => status, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> - <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => status, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> - + <%= reorder_links('issue_status', {:action => 'update', :id => status}) %> <%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %> diff --git a/app/views/projects/settings/_boards.rhtml b/app/views/projects/settings/_boards.rhtml index bf6da3ab0..e1b7ff393 100644 --- a/app/views/projects/settings/_boards.rhtml +++ b/app/views/projects/settings/_boards.rhtml @@ -9,10 +9,7 @@ <%=h board.description %> <% if authorize_for("boards", "edit") %> - <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> - <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - - <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> - <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> + <%= reorder_links('board', {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}) %> <% end %> <%= link_to_if_authorized l(:button_edit), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}, :class => 'icon icon-edit' %> diff --git a/app/views/roles/list.rhtml b/app/views/roles/list.rhtml index 93b821387..32ff7160c 100644 --- a/app/views/roles/list.rhtml +++ b/app/views/roles/list.rhtml @@ -16,10 +16,7 @@ <%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %> <% unless role.builtin? %> - <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => role, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> - <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => role, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - - <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => role, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> - <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => role, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> + <%= reorder_links('role', {:action => 'edit', :id => role}) %> <% end %> diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb index 188e79e2d..5c47be180 100644 --- a/test/functional/roles_controller_test.rb +++ b/test/functional/roles_controller_test.rb @@ -153,27 +153,27 @@ class RolesControllerTest < Test::Unit::TestCase end def test_move_highest - post :move, :id => 3, :position => 'highest' + post :edit, :id => 3, :role => {:move_to => 'highest'} assert_redirected_to 'roles/list' assert_equal 1, Role.find(3).position end def test_move_higher position = Role.find(3).position - post :move, :id => 3, :position => 'higher' + post :edit, :id => 3, :role => {:move_to => 'higher'} assert_redirected_to 'roles/list' assert_equal position - 1, Role.find(3).position end def test_move_lower position = Role.find(2).position - post :move, :id => 2, :position => 'lower' + post :edit, :id => 2, :role => {:move_to => 'lower'} assert_redirected_to 'roles/list' assert_equal position + 1, Role.find(2).position end def test_move_lowest - post :move, :id => 2, :position => 'lowest' + post :edit, :id => 2, :role => {:move_to => 'lowest'} assert_redirected_to 'roles/list' assert_equal Role.count, Role.find(2).position end