@@ -54,11 +54,19 class CustomFieldsController < ApplicationController | |||
|
54 | 54 | |
|
55 | 55 | def update |
|
56 | 56 | if @custom_field.update_attributes(params[:custom_field]) |
|
57 | flash[:notice] = l(:notice_successful_update) | |
|
58 | 57 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) |
|
59 | redirect_back_or_default edit_custom_field_path(@custom_field) | |
|
58 | respond_to do |format| | |
|
59 | format.html { | |
|
60 | flash[:notice] = l(:notice_successful_update) | |
|
61 | redirect_back_or_default edit_custom_field_path(@custom_field) | |
|
62 | } | |
|
63 | format.js { render :nothing => true } | |
|
64 | end | |
|
60 | 65 | else |
|
61 | render :action => 'edit' | |
|
66 | respond_to do |format| | |
|
67 | format.html { render :action => 'edit' } | |
|
68 | format.js { render :nothing => true, :status => 422 } | |
|
69 | end | |
|
62 | 70 | end |
|
63 | 71 | end |
|
64 | 72 |
@@ -57,10 +57,18 class EnumerationsController < ApplicationController | |||
|
57 | 57 | |
|
58 | 58 | def update |
|
59 | 59 | if @enumeration.update_attributes(params[:enumeration]) |
|
60 | flash[:notice] = l(:notice_successful_update) | |
|
61 | redirect_to enumerations_path | |
|
60 | respond_to do |format| | |
|
61 | format.html { | |
|
62 | flash[:notice] = l(:notice_successful_update) | |
|
63 | redirect_to enumerations_path | |
|
64 | } | |
|
65 | format.js { render :nothing => true } | |
|
66 | end | |
|
62 | 67 | else |
|
63 | render :action => 'edit' | |
|
68 | respond_to do |format| | |
|
69 | format.html { render :action => 'edit' } | |
|
70 | format.js { render :nothing => true, :status => 422 } | |
|
71 | end | |
|
64 | 72 | end |
|
65 | 73 | end |
|
66 | 74 |
@@ -51,10 +51,18 class IssueStatusesController < ApplicationController | |||
|
51 | 51 | def update |
|
52 | 52 | @issue_status = IssueStatus.find(params[:id]) |
|
53 | 53 | if @issue_status.update_attributes(params[:issue_status]) |
|
54 | flash[:notice] = l(:notice_successful_update) | |
|
55 | redirect_to issue_statuses_path(:page => params[:page]) | |
|
54 | respond_to do |format| | |
|
55 | format.html { | |
|
56 | flash[:notice] = l(:notice_successful_update) | |
|
57 | redirect_to issue_statuses_path(:page => params[:page]) | |
|
58 | } | |
|
59 | format.js { render :nothing => true } | |
|
60 | end | |
|
56 | 61 | else |
|
57 | render :action => 'edit' | |
|
62 | respond_to do |format| | |
|
63 | format.html { render :action => 'edit' } | |
|
64 | format.js { render :nothing => true, :status => 422 } | |
|
65 | end | |
|
58 | 66 | end |
|
59 | 67 | end |
|
60 | 68 |
@@ -72,10 +72,18 class RolesController < ApplicationController | |||
|
72 | 72 | |
|
73 | 73 | def update |
|
74 | 74 | if @role.update_attributes(params[:role]) |
|
75 | flash[:notice] = l(:notice_successful_update) | |
|
76 | redirect_to roles_path(:page => params[:page]) | |
|
75 | respond_to do |format| | |
|
76 | format.html { | |
|
77 | flash[:notice] = l(:notice_successful_update) | |
|
78 | redirect_to roles_path(:page => params[:page]) | |
|
79 | } | |
|
80 | format.js { render :nothing => true } | |
|
81 | end | |
|
77 | 82 | else |
|
78 | render :action => 'edit' | |
|
83 | respond_to do |format| | |
|
84 | format.html { render :action => 'edit' } | |
|
85 | format.js { render :nothing => true, :status => 422 } | |
|
86 | end | |
|
79 | 87 | end |
|
80 | 88 | end |
|
81 | 89 |
@@ -59,12 +59,22 class TrackersController < ApplicationController | |||
|
59 | 59 | def update |
|
60 | 60 | @tracker = Tracker.find(params[:id]) |
|
61 | 61 | if @tracker.update_attributes(params[:tracker]) |
|
62 | flash[:notice] = l(:notice_successful_update) | |
|
63 | redirect_to trackers_path(:page => params[:page]) | |
|
64 | return | |
|
62 | respond_to do |format| | |
|
63 | format.html { | |
|
64 | flash[:notice] = l(:notice_successful_update) | |
|
65 | redirect_to trackers_path(:page => params[:page]) | |
|
66 | } | |
|
67 | format.js { render :nothing => true } | |
|
68 | end | |
|
69 | else | |
|
70 | respond_to do |format| | |
|
71 | format.html { | |
|
72 | edit | |
|
73 | render :action => 'edit' | |
|
74 | } | |
|
75 | format.js { render :nothing => true, :status => 422 } | |
|
76 | end | |
|
65 | 77 | end |
|
66 | edit | |
|
67 | render :action => 'edit' | |
|
68 | 78 | end |
|
69 | 79 | |
|
70 | 80 | def destroy |
@@ -468,6 +468,16 module ApplicationHelper | |||
|
468 | 468 | :title => l(:label_sort_lowest), :class => 'icon-only icon-move-bottom') |
|
469 | 469 | end |
|
470 | 470 | |
|
471 | def reorder_handle(object, options={}) | |
|
472 | data = { | |
|
473 | :reorder_url => options[:url] || url_for(object), | |
|
474 | :reorder_param => options[:param] || object.class.name.underscore | |
|
475 | } | |
|
476 | content_tag('span', '', | |
|
477 | :class => "sort-handle ui-icon ui-icon-arrowthick-2-n-s", | |
|
478 | :data => data) | |
|
479 | end | |
|
480 | ||
|
471 | 481 | def breadcrumb(*args) |
|
472 | 482 | elements = args.flatten |
|
473 | 483 | elements.any? ? content_tag('p', (args.join(" \xc2\xbb ") + " \xc2\xbb ").html_safe, :class => 'breadcrumb') : nil |
@@ -1,4 +1,4 | |||
|
1 | <table class="list"> | |
|
1 | <table class="list custom_fields"> | |
|
2 | 2 | <thead><tr> |
|
3 | 3 | <th><%=l(:field_name)%></th> |
|
4 | 4 | <th><%=l(:field_field_format)%></th> |
@@ -7,7 +7,6 | |||
|
7 | 7 | <th><%=l(:field_is_for_all)%></th> |
|
8 | 8 | <th><%=l(:label_used_by)%></th> |
|
9 | 9 | <% end %> |
|
10 | <th><%=l(:button_sort)%></th> | |
|
11 | 10 | <th></th> |
|
12 | 11 | </tr></thead> |
|
13 | 12 | <tbody> |
@@ -21,8 +20,8 | |||
|
21 | 20 | <td><%= checked_image custom_field.is_for_all? %></td> |
|
22 | 21 | <td><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> |
|
23 | 22 | <% end %> |
|
24 | <td class="reorder"><%= reorder_links('custom_field', {:action => 'update', :id => custom_field, :back_url => back_url}, :put) %></td> | |
|
25 | 23 | <td class="buttons"> |
|
24 | <%= reorder_handle(custom_field, :url => custom_field_path(custom_field), :param => 'custom_field') %> | |
|
26 | 25 | <%= delete_link custom_field_path(custom_field) %> |
|
27 | 26 | </td> |
|
28 | 27 | </tr> |
@@ -9,3 +9,7 | |||
|
9 | 9 | <% else %> |
|
10 | 10 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
11 | 11 | <% end %> |
|
12 | ||
|
13 | <%= javascript_tag do %> | |
|
14 | $(function() { $("table.custom_fields tbody").positionedItems(); }); | |
|
15 | <% end %> No newline at end of file |
@@ -5,12 +5,11 | |||
|
5 | 5 | |
|
6 | 6 | <% enumerations = klass.shared %> |
|
7 | 7 | <% if enumerations.any? %> |
|
8 | <table class="list"><thead> | |
|
8 | <table class="list enumerations"><thead> | |
|
9 | 9 | <tr> |
|
10 | 10 | <th><%= l(:field_name) %></th> |
|
11 | 11 | <th><%= l(:field_is_default) %></th> |
|
12 | 12 | <th><%= l(:field_active) %></th> |
|
13 | <th><%=l(:button_sort)%></th> | |
|
14 | 13 | <th></th> |
|
15 | 14 | </tr></thead> |
|
16 | 15 | <% enumerations.each do |enumeration| %> |
@@ -18,8 +17,10 | |||
|
18 | 17 | <td class="name"><%= link_to enumeration, edit_enumeration_path(enumeration) %></td> |
|
19 | 18 | <td class="tick"><%= checked_image enumeration.is_default? %></td> |
|
20 | 19 | <td class="tick"><%= checked_image enumeration.active? %></td> |
|
21 | <td class="reorder"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}, :put) %></td> | |
|
22 | <td class="buttons"><%= delete_link enumeration_path(enumeration) %></td> | |
|
20 | <td class="buttons"> | |
|
21 | <%= reorder_handle(enumeration, :url => enumeration_path(enumeration), :param => 'enumeration') %> | |
|
22 | <%= delete_link enumeration_path(enumeration) %> | |
|
23 | </td> | |
|
23 | 24 | </tr> |
|
24 | 25 | <% end %> |
|
25 | 26 | </table> |
@@ -30,3 +31,7 | |||
|
30 | 31 | <% end %> |
|
31 | 32 | |
|
32 | 33 | <% html_title(l(:label_enumerations)) -%> |
|
34 | ||
|
35 | <%= javascript_tag do %> | |
|
36 | $(function() { $("table.enumerations tbody").positionedItems(); }); | |
|
37 | <% end %> No newline at end of file |
@@ -5,14 +5,13 | |||
|
5 | 5 | |
|
6 | 6 | <h2><%=l(:label_issue_status_plural)%></h2> |
|
7 | 7 | |
|
8 | <table class="list"> | |
|
8 | <table class="list issue_statuses"> | |
|
9 | 9 | <thead><tr> |
|
10 | 10 | <th><%=l(:field_status)%></th> |
|
11 | 11 | <% if Issue.use_status_for_done_ratio? %> |
|
12 | 12 | <th><%=l(:field_done_ratio)%></th> |
|
13 | 13 | <% end %> |
|
14 | 14 | <th><%=l(:field_is_closed)%></th> |
|
15 | <th><%=l(:button_sort)%></th> | |
|
16 | 15 | <th></th> |
|
17 | 16 | </tr></thead> |
|
18 | 17 | <tbody> |
@@ -23,8 +22,8 | |||
|
23 | 22 | <td><%= status.default_done_ratio %></td> |
|
24 | 23 | <% end %> |
|
25 | 24 | <td><%= checked_image status.is_closed? %></td> |
|
26 | <td class="reorder"><%= reorder_links('issue_status', {:action => 'update', :id => status, :page => params[:page]}, :put) %></td> | |
|
27 | 25 | <td class="buttons"> |
|
26 | <%= reorder_handle(status) %> | |
|
28 | 27 | <%= delete_link issue_status_path(status) %> |
|
29 | 28 | </td> |
|
30 | 29 | </tr> |
@@ -33,3 +32,7 | |||
|
33 | 32 | </table> |
|
34 | 33 | |
|
35 | 34 | <% html_title(l(:label_issue_status_plural)) -%> |
|
35 | ||
|
36 | <%= javascript_tag do %> | |
|
37 | $(function() { $("table.issue_statuses tbody").positionedItems(); }); | |
|
38 | <% end %> |
@@ -5,22 +5,17 | |||
|
5 | 5 | |
|
6 | 6 | <h2><%=l(:label_role_plural)%></h2> |
|
7 | 7 | |
|
8 | <table class="list"> | |
|
8 | <table class="list roles"> | |
|
9 | 9 | <thead><tr> |
|
10 | 10 | <th><%=l(:label_role)%></th> |
|
11 | <th><%=l(:button_sort)%></th> | |
|
12 | 11 | <th></th> |
|
13 | 12 | </tr></thead> |
|
14 | 13 | <tbody> |
|
15 | 14 | <% for role in @roles %> |
|
16 | <tr class="<%= cycle("odd", "even") %>"> | |
|
15 | <tr class="<%= cycle("odd", "even") %> <%= role.builtin? ? "builtin" : "givable" %>"> | |
|
17 | 16 | <td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td> |
|
18 | <td class="reorder"> | |
|
19 | <% unless role.builtin? %> | |
|
20 | <%= reorder_links('role', {:action => 'update', :id => role, :page => params[:page]}, :put) %> | |
|
21 | <% end %> | |
|
22 | </td> | |
|
23 | 17 | <td class="buttons"> |
|
18 | <%= reorder_handle(role) unless role.builtin? %> | |
|
24 | 19 | <%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %> |
|
25 | 20 | <%= delete_link role_path(role) unless role.builtin? %> |
|
26 | 21 | </td> |
@@ -30,3 +25,7 | |||
|
30 | 25 | </table> |
|
31 | 26 | |
|
32 | 27 | <% html_title(l(:label_role_plural)) -%> |
|
28 | ||
|
29 | <%= javascript_tag do %> | |
|
30 | $(function() { $("table.roles tbody").positionedItems({items: ".givable"}); }); | |
|
31 | <% end %> No newline at end of file |
@@ -5,11 +5,10 | |||
|
5 | 5 | |
|
6 | 6 | <h2><%=l(:label_tracker_plural)%></h2> |
|
7 | 7 | |
|
8 | <table class="list"> | |
|
8 | <table class="list trackers"> | |
|
9 | 9 | <thead><tr> |
|
10 | 10 | <th><%=l(:label_tracker)%></th> |
|
11 | 11 | <th></th> |
|
12 | <th><%=l(:button_sort)%></th> | |
|
13 | 12 | <th></th> |
|
14 | 13 | </tr></thead> |
|
15 | 14 | <tbody> |
@@ -23,10 +22,8 | |||
|
23 | 22 | </span> |
|
24 | 23 | <% end %> |
|
25 | 24 | </td> |
|
26 | <td class="reorder"> | |
|
27 | <%= reorder_links('tracker', {:action => 'update', :id => tracker, :page => params[:page]}, :put) %> | |
|
28 | </td> | |
|
29 | 25 | <td class="buttons"> |
|
26 | <%= reorder_handle(tracker) %> | |
|
30 | 27 | <%= delete_link tracker_path(tracker) %> |
|
31 | 28 | </td> |
|
32 | 29 | </tr> |
@@ -35,3 +32,7 | |||
|
35 | 32 | </table> |
|
36 | 33 | |
|
37 | 34 | <% html_title(l(:label_tracker_plural)) -%> |
|
35 | ||
|
36 | <%= javascript_tag do %> | |
|
37 | $(function() { $("table.trackers tbody").positionedItems(); }); | |
|
38 | <% end %> |
@@ -590,6 +590,45 function beforeShowDatePicker(input, inst) { | |||
|
590 | 590 | $(input).datepicker("option", "defaultDate", default_date); |
|
591 | 591 | } |
|
592 | 592 | |
|
593 | (function($){ | |
|
594 | $.fn.positionedItems = function(sortableOptions, options){ | |
|
595 | var settings = $.extend({ | |
|
596 | firstPosition: 1 | |
|
597 | }, options ); | |
|
598 | ||
|
599 | return this.sortable($.extend({ | |
|
600 | handle: ".sort-handle", | |
|
601 | helper: function(event, ui){ | |
|
602 | ui.children().each(function(){ | |
|
603 | $(this).width($(this).width()); | |
|
604 | }); | |
|
605 | return ui; | |
|
606 | }, | |
|
607 | update: function(event, ui) { | |
|
608 | var sortable = $(this); | |
|
609 | var url = ui.item.find(".sort-handle").data("reorder-url"); | |
|
610 | var param = ui.item.find(".sort-handle").data("reorder-param"); | |
|
611 | var data = {}; | |
|
612 | data[param] = {position: ui.item.index() + settings['firstPosition']}; | |
|
613 | $.ajax({ | |
|
614 | url: url, | |
|
615 | type: 'put', | |
|
616 | dataType: 'script', | |
|
617 | data: data, | |
|
618 | success: function(data){ | |
|
619 | sortable.children(":even").removeClass("even").addClass("odd"); | |
|
620 | sortable.children(":odd").removeClass("odd").addClass("even"); | |
|
621 | }, | |
|
622 | error: function(jqXHR, textStatus, errorThrown){ | |
|
623 | alert(jqXHR.status); | |
|
624 | sortable.sortable("cancel"); | |
|
625 | } | |
|
626 | }); | |
|
627 | }, | |
|
628 | }, sortableOptions)); | |
|
629 | } | |
|
630 | }( jQuery )); | |
|
631 | ||
|
593 | 632 | function initMyPageSortable(list, url) { |
|
594 | 633 | $('#list-'+list).sortable({ |
|
595 | 634 | connectWith: '.block-receiver', |
@@ -152,7 +152,7 class TrackersControllerTest < ActionController::TestCase | |||
|
152 | 152 | |
|
153 | 153 | def test_move_lower |
|
154 | 154 | tracker = Tracker.find_by_position(1) |
|
155 |
put :update, :id => 1, :tracker => { : |
|
|
155 | put :update, :id => 1, :tracker => { :position => '2' } | |
|
156 | 156 | assert_equal 2, tracker.reload.position |
|
157 | 157 | end |
|
158 | 158 |
General Comments 0
You need to be logged in to leave comments.
Login now