@@ -0,0 +1,38 | |||||
|
1 | # Redmine - project management software | |||
|
2 | # Copyright (C) 2006-2015 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | require File.expand_path('../base', __FILE__) | |||
|
19 | ||||
|
20 | class Redmine::UiTest::CustomFieldsTest < Redmine::UiTest::Base | |||
|
21 | fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, | |||
|
22 | :trackers, :projects_trackers, :enabled_modules, | |||
|
23 | :custom_fields, :custom_values, :custom_fields_trackers | |||
|
24 | ||||
|
25 | def test_reordering_should_redirect_to_index | |||
|
26 | assert_equal 1, UserCustomField.find(4).position | |||
|
27 | log_user 'admin', 'admin' | |||
|
28 | visit '/custom_fields' | |||
|
29 | ||||
|
30 | # click 'User' tab | |||
|
31 | page.first('a#tab-UserCustomField').click | |||
|
32 | # click 'Move down' link on the first row | |||
|
33 | page.first('td.reorder a:nth-child(3)').click | |||
|
34 | ||||
|
35 | assert_equal "/custom_fields?tab=UserCustomField", URI.parse(current_url).request_uri | |||
|
36 | assert_equal 2, UserCustomField.find(4).position | |||
|
37 | end | |||
|
38 | end |
@@ -56,7 +56,7 class CustomFieldsController < ApplicationController | |||||
56 | if @custom_field.update_attributes(params[:custom_field]) |
|
56 | if @custom_field.update_attributes(params[:custom_field]) | |
57 | flash[:notice] = l(:notice_successful_update) |
|
57 | flash[:notice] = l(:notice_successful_update) | |
58 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) |
|
58 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) | |
59 |
redirect_t |
|
59 | redirect_back_or_default edit_custom_field_path(@custom_field) | |
60 | else |
|
60 | else | |
61 | render :action => 'edit' |
|
61 | render :action => 'edit' | |
62 | end |
|
62 | end |
@@ -12,6 +12,7 | |||||
12 | </tr></thead> |
|
12 | </tr></thead> | |
13 | <tbody> |
|
13 | <tbody> | |
14 | <% (@custom_fields_by_type[tab[:name]] || []).sort.each do |custom_field| -%> |
|
14 | <% (@custom_fields_by_type[tab[:name]] || []).sort.each do |custom_field| -%> | |
|
15 | <% back_url = custom_fields_path(:tab => tab[:name]) %> | |||
15 | <tr class="<%= cycle("odd", "even") %>"> |
|
16 | <tr class="<%= cycle("odd", "even") %>"> | |
16 | <td class="name"><%= link_to custom_field.name, edit_custom_field_path(custom_field) %></td> |
|
17 | <td class="name"><%= link_to custom_field.name, edit_custom_field_path(custom_field) %></td> | |
17 | <td><%= l(custom_field.format.label) %></td> |
|
18 | <td><%= l(custom_field.format.label) %></td> | |
@@ -20,7 +21,7 | |||||
20 | <td><%= checked_image custom_field.is_for_all? %></td> |
|
21 | <td><%= checked_image custom_field.is_for_all? %></td> | |
21 | <td><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> |
|
22 | <td><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> | |
22 | <% end %> |
|
23 | <% end %> | |
23 | <td class="reorder"><%= reorder_links('custom_field', {:action => 'update', :id => custom_field}, :put) %></td> |
|
24 | <td class="reorder"><%= reorder_links('custom_field', {:action => 'update', :id => custom_field, :back_url => back_url}, :put) %></td> | |
24 | <td class="buttons"> |
|
25 | <td class="buttons"> | |
25 | <%= delete_link custom_field_path(custom_field) %> |
|
26 | <%= delete_link custom_field_path(custom_field) %> | |
26 | </td> |
|
27 | </td> |
General Comments 0
You need to be logged in to leave comments.
Login now