Reorder links refactoring (follows r2526).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2546 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
56bdcf407f
commit
47f5713b1e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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? }
|
||||
|
|
|
@ -37,12 +37,7 @@
|
|||
<td align="center"><%= image_tag 'true.png' if custom_field.is_for_all? %></td>
|
||||
<td align="center"><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
||||
<% end %>
|
||||
<td align="center" style="width:15%;">
|
||||
<%= 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) %>
|
||||
</td>
|
||||
<td align="center" style="width:15%;"><%= reorder_links('custom_field', {:action => 'edit', :id => custom_field}) %></td>
|
||||
<td align="center">
|
||||
<%= button_to l(:button_delete), { :action => 'destroy', :id => custom_field }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
|
||||
</td>
|
||||
|
|
|
@ -10,12 +10,7 @@
|
|||
<tr class="<%= cycle('odd', 'even') %>">
|
||||
<td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td>
|
||||
<td style="width:15%;"><%= image_tag('true.png') if enumeration.is_default? %></td>
|
||||
<td style="width:15%;">
|
||||
<%= 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) %>
|
||||
</td>
|
||||
<td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td>
|
||||
<td align="center" style="width:10%;">
|
||||
<%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, :method => :post, :confirm => l(:text_are_you_sure), :class => "icon icon-del" %>
|
||||
</td>
|
||||
|
|
|
@ -18,12 +18,7 @@
|
|||
<td><%= link_to status.name, :action => 'edit', :id => status %></td>
|
||||
<td align="center"><%= image_tag 'true.png' if status.is_default? %></td>
|
||||
<td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>
|
||||
<td align="center" style="width:15%;">
|
||||
<%= 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) %>
|
||||
</td>
|
||||
<td align="center" style="width:15%;"><%= reorder_links('issue_status', {:action => 'update', :id => status}) %></td>
|
||||
<td align="center" style="width:10%;">
|
||||
<%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
|
||||
</td>
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
<td><%=h board.description %></td>
|
||||
<td align="center">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td align="center"><%= link_to_if_authorized l(:button_edit), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}, :class => 'icon icon-edit' %></td>
|
||||
|
|
|
@ -16,10 +16,7 @@
|
|||
<td><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %></td>
|
||||
<td align="center" style="width:15%;">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td align="center" style="width:10%;">
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue