##// END OF EJS Templates
Same fix as r13582 for trackers and statuses (#18769)....
Jean-Philippe Lang -
r13471:fec68fcfc1d1
parent child
Show More
@@ -1,81 +1,81
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class IssueStatusesController < ApplicationController
19 19 layout 'admin'
20 20
21 21 before_filter :require_admin, :except => :index
22 22 before_filter :require_admin_or_api_request, :only => :index
23 23 accept_api_auth :index
24 24
25 25 def index
26 26 respond_to do |format|
27 27 format.html {
28 28 @issue_status_pages, @issue_statuses = paginate IssueStatus.sorted, :per_page => 25
29 29 render :action => "index", :layout => false if request.xhr?
30 30 }
31 31 format.api {
32 32 @issue_statuses = IssueStatus.order('position').to_a
33 33 }
34 34 end
35 35 end
36 36
37 37 def new
38 38 @issue_status = IssueStatus.new
39 39 end
40 40
41 41 def create
42 42 @issue_status = IssueStatus.new(params[:issue_status])
43 43 if @issue_status.save
44 44 flash[:notice] = l(:notice_successful_create)
45 45 redirect_to issue_statuses_path
46 46 else
47 47 render :action => 'new'
48 48 end
49 49 end
50 50
51 51 def edit
52 52 @issue_status = IssueStatus.find(params[:id])
53 53 end
54 54
55 55 def update
56 56 @issue_status = IssueStatus.find(params[:id])
57 57 if @issue_status.update_attributes(params[:issue_status])
58 58 flash[:notice] = l(:notice_successful_update)
59 redirect_to issue_statuses_path
59 redirect_to issue_statuses_path(:page => params[:page])
60 60 else
61 61 render :action => 'edit'
62 62 end
63 63 end
64 64
65 65 def destroy
66 66 IssueStatus.find(params[:id]).destroy
67 67 redirect_to issue_statuses_path
68 68 rescue
69 69 flash[:error] = l(:error_unable_delete_issue_status)
70 70 redirect_to issue_statuses_path
71 71 end
72 72
73 73 def update_issue_done_ratio
74 74 if request.post? && IssueStatus.update_issue_done_ratios
75 75 flash[:notice] = l(:notice_issue_done_ratios_updated)
76 76 else
77 77 flash[:error] = l(:error_issue_done_ratios_not_updated)
78 78 end
79 79 redirect_to issue_statuses_path
80 80 end
81 81 end
@@ -1,101 +1,101
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class TrackersController < ApplicationController
19 19 layout 'admin'
20 20
21 21 before_filter :require_admin, :except => :index
22 22 before_filter :require_admin_or_api_request, :only => :index
23 23 accept_api_auth :index
24 24
25 25 def index
26 26 respond_to do |format|
27 27 format.html {
28 28 @tracker_pages, @trackers = paginate Tracker.sorted, :per_page => 25
29 29 render :action => "index", :layout => false if request.xhr?
30 30 }
31 31 format.api {
32 32 @trackers = Tracker.sorted.to_a
33 33 }
34 34 end
35 35 end
36 36
37 37 def new
38 38 @tracker ||= Tracker.new(params[:tracker])
39 39 @trackers = Tracker.sorted.to_a
40 40 @projects = Project.all
41 41 end
42 42
43 43 def create
44 44 @tracker = Tracker.new(params[:tracker])
45 45 if @tracker.save
46 46 # workflow copy
47 47 if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
48 48 @tracker.workflow_rules.copy(copy_from)
49 49 end
50 50 flash[:notice] = l(:notice_successful_create)
51 51 redirect_to trackers_path
52 52 return
53 53 end
54 54 new
55 55 render :action => 'new'
56 56 end
57 57
58 58 def edit
59 59 @tracker ||= Tracker.find(params[:id])
60 60 @projects = Project.all
61 61 end
62 62
63 63 def update
64 64 @tracker = Tracker.find(params[:id])
65 65 if @tracker.update_attributes(params[:tracker])
66 66 flash[:notice] = l(:notice_successful_update)
67 redirect_to trackers_path
67 redirect_to trackers_path(:page => params[:page])
68 68 return
69 69 end
70 70 edit
71 71 render :action => 'edit'
72 72 end
73 73
74 74 def destroy
75 75 @tracker = Tracker.find(params[:id])
76 76 unless @tracker.issues.empty?
77 77 flash[:error] = l(:error_can_not_delete_tracker)
78 78 else
79 79 @tracker.destroy
80 80 end
81 81 redirect_to trackers_path
82 82 end
83 83
84 84 def fields
85 85 if request.post? && params[:trackers]
86 86 params[:trackers].each do |tracker_id, tracker_params|
87 87 tracker = Tracker.find_by_id(tracker_id)
88 88 if tracker
89 89 tracker.core_fields = tracker_params[:core_fields]
90 90 tracker.custom_field_ids = tracker_params[:custom_field_ids]
91 91 tracker.save
92 92 end
93 93 end
94 94 flash[:notice] = l(:notice_successful_update)
95 95 redirect_to fields_trackers_path
96 96 return
97 97 end
98 98 @trackers = Tracker.sorted.to_a
99 99 @custom_fields = IssueCustomField.all.sort
100 100 end
101 101 end
@@ -1,37 +1,37
1 1 <div class="contextual">
2 2 <%= link_to l(:label_issue_status_new), new_issue_status_path, :class => 'icon icon-add' %>
3 3 <%= link_to(l(:label_update_issue_done_ratios), update_issue_done_ratio_issue_statuses_path, :class => 'icon icon-multiple', :method => 'post', :data => {:confirm => l(:text_are_you_sure)}) if Issue.use_status_for_done_ratio? %>
4 4 </div>
5 5
6 6 <h2><%=l(:label_issue_status_plural)%></h2>
7 7
8 8 <table class="list">
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 15 <th><%=l(:button_sort)%></th>
16 16 <th></th>
17 17 </tr></thead>
18 18 <tbody>
19 19 <% for status in @issue_statuses %>
20 20 <tr class="<%= cycle("odd", "even") %>">
21 21 <td class="name"><%= link_to h(status.name), edit_issue_status_path(status) %></td>
22 22 <% if Issue.use_status_for_done_ratio? %>
23 23 <td><%= h status.default_done_ratio %></td>
24 24 <% end %>
25 25 <td><%= checked_image status.is_closed? %></td>
26 <td class="reorder"><%= reorder_links('issue_status', {:action => 'update', :id => status}, :put) %></td>
26 <td class="reorder"><%= reorder_links('issue_status', {:action => 'update', :id => status, :page => params[:page]}, :put) %></td>
27 27 <td class="buttons">
28 28 <%= delete_link issue_status_path(status) %>
29 29 </td>
30 30 </tr>
31 31 <% end %>
32 32 </tbody>
33 33 </table>
34 34
35 35 <p class="pagination"><%= pagination_links_full @issue_status_pages %></p>
36 36
37 37 <% html_title(l(:label_issue_status_plural)) -%>
@@ -1,39 +1,39
1 1 <div class="contextual">
2 2 <%= link_to l(:label_tracker_new), new_tracker_path, :class => 'icon icon-add' %>
3 3 <%= link_to l(:field_summary), fields_trackers_path, :class => 'icon icon-summary' %>
4 4 </div>
5 5
6 6 <h2><%=l(:label_tracker_plural)%></h2>
7 7
8 8 <table class="list">
9 9 <thead><tr>
10 10 <th><%=l(:label_tracker)%></th>
11 11 <th></th>
12 12 <th><%=l(:button_sort)%></th>
13 13 <th></th>
14 14 </tr></thead>
15 15 <tbody>
16 16 <% for tracker in @trackers %>
17 17 <tr class="<%= cycle("odd", "even") %>">
18 18 <td class="name"><%= link_to h(tracker.name), edit_tracker_path(tracker) %></td>
19 19 <td>
20 20 <% unless tracker.workflow_rules.count > 0 %>
21 21 <span class="icon icon-warning">
22 22 <%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), workflows_edit_path(:tracker_id => tracker) %>)
23 23 </span>
24 24 <% end %>
25 25 </td>
26 26 <td class="reorder">
27 <%= reorder_links('tracker', {:action => 'update', :id => tracker}, :put) %>
27 <%= reorder_links('tracker', {:action => 'update', :id => tracker, :page => params[:page]}, :put) %>
28 28 </td>
29 29 <td class="buttons">
30 30 <%= delete_link tracker_path(tracker) %>
31 31 </td>
32 32 </tr>
33 33 <% end %>
34 34 </tbody>
35 35 </table>
36 36
37 37 <p class="pagination"><%= pagination_links_full @tracker_pages %></p>
38 38
39 39 <% html_title(l(:label_tracker_plural)) -%>
General Comments 0
You need to be logged in to leave comments. Login now