##// END OF EJS Templates
Remove pagination on trackers, roles and issue statuses (#12909)....
Jean-Philippe Lang -
r14891:08c9a5e3ef1a
parent child
Show More
@@ -1,81 +1,77
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 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 @issue_statuses = IssueStatus.sorted.to_a
26 27 respond_to do |format|
27 format.html {
28 @issue_status_pages, @issue_statuses = paginate IssueStatus.sorted, :per_page => 25
29 render :action => "index", :layout => false if request.xhr?
30 }
31 format.api {
32 @issue_statuses = IssueStatus.order('position').to_a
33 }
28 format.html { render :layout => false if request.xhr? }
29 format.api
34 30 end
35 31 end
36 32
37 33 def new
38 34 @issue_status = IssueStatus.new
39 35 end
40 36
41 37 def create
42 38 @issue_status = IssueStatus.new(params[:issue_status])
43 39 if @issue_status.save
44 40 flash[:notice] = l(:notice_successful_create)
45 41 redirect_to issue_statuses_path
46 42 else
47 43 render :action => 'new'
48 44 end
49 45 end
50 46
51 47 def edit
52 48 @issue_status = IssueStatus.find(params[:id])
53 49 end
54 50
55 51 def update
56 52 @issue_status = IssueStatus.find(params[:id])
57 53 if @issue_status.update_attributes(params[:issue_status])
58 54 flash[:notice] = l(:notice_successful_update)
59 55 redirect_to issue_statuses_path(:page => params[:page])
60 56 else
61 57 render :action => 'edit'
62 58 end
63 59 end
64 60
65 61 def destroy
66 62 IssueStatus.find(params[:id]).destroy
67 63 redirect_to issue_statuses_path
68 64 rescue
69 65 flash[:error] = l(:error_unable_delete_issue_status)
70 66 redirect_to issue_statuses_path
71 67 end
72 68
73 69 def update_issue_done_ratio
74 70 if request.post? && IssueStatus.update_issue_done_ratios
75 71 flash[:notice] = l(:notice_issue_done_ratios_updated)
76 72 else
77 73 flash[:error] = l(:error_issue_done_ratios_not_updated)
78 74 end
79 75 redirect_to issue_statuses_path
80 76 end
81 77 end
@@ -1,110 +1,110
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 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 RolesController < ApplicationController
19 19 layout 'admin'
20 20
21 21 before_filter :require_admin, :except => [:index, :show]
22 22 before_filter :require_admin_or_api_request, :only => [:index, :show]
23 23 before_filter :find_role, :only => [:show, :edit, :update, :destroy]
24 24 accept_api_auth :index, :show
25 25
26 26 require_sudo_mode :create, :update, :destroy
27 27
28 28 def index
29 29 respond_to do |format|
30 30 format.html {
31 @role_pages, @roles = paginate Role.sorted, :per_page => 25
32 render :action => "index", :layout => false if request.xhr?
31 @roles = Role.sorted.to_a
32 render :layout => false if request.xhr?
33 33 }
34 34 format.api {
35 35 @roles = Role.givable.to_a
36 36 }
37 37 end
38 38 end
39 39
40 40 def show
41 41 respond_to do |format|
42 42 format.api
43 43 end
44 44 end
45 45
46 46 def new
47 47 # Prefills the form with 'Non member' role permissions by default
48 48 @role = Role.new(params[:role] || {:permissions => Role.non_member.permissions})
49 49 if params[:copy].present? && @copy_from = Role.find_by_id(params[:copy])
50 50 @role.copy_from(@copy_from)
51 51 end
52 52 @roles = Role.sorted.to_a
53 53 end
54 54
55 55 def create
56 56 @role = Role.new(params[:role])
57 57 if request.post? && @role.save
58 58 # workflow copy
59 59 if !params[:copy_workflow_from].blank? && (copy_from = Role.find_by_id(params[:copy_workflow_from]))
60 60 @role.workflow_rules.copy(copy_from)
61 61 end
62 62 flash[:notice] = l(:notice_successful_create)
63 63 redirect_to roles_path
64 64 else
65 65 @roles = Role.sorted.to_a
66 66 render :action => 'new'
67 67 end
68 68 end
69 69
70 70 def edit
71 71 end
72 72
73 73 def update
74 74 if @role.update_attributes(params[:role])
75 75 flash[:notice] = l(:notice_successful_update)
76 76 redirect_to roles_path(:page => params[:page])
77 77 else
78 78 render :action => 'edit'
79 79 end
80 80 end
81 81
82 82 def destroy
83 83 @role.destroy
84 84 redirect_to roles_path
85 85 rescue
86 86 flash[:error] = l(:error_can_not_remove_role)
87 87 redirect_to roles_path
88 88 end
89 89
90 90 def permissions
91 91 @roles = Role.sorted.to_a
92 92 @permissions = Redmine::AccessControl.permissions.select { |p| !p.public? }
93 93 if request.post?
94 94 @roles.each do |role|
95 95 role.permissions = params[:permissions][role.id.to_s]
96 96 role.save
97 97 end
98 98 flash[:notice] = l(:notice_successful_update)
99 99 redirect_to roles_path
100 100 end
101 101 end
102 102
103 103 private
104 104
105 105 def find_role
106 106 @role = Role.find(params[:id])
107 107 rescue ActiveRecord::RecordNotFound
108 108 render_404
109 109 end
110 110 end
@@ -1,101 +1,97
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 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 respond_to do |format|
27 format.html {
28 @tracker_pages, @trackers = paginate Tracker.sorted, :per_page => 25
29 render :action => "index", :layout => false if request.xhr?
30 }
31 format.api {
32 26 @trackers = Tracker.sorted.to_a
33 }
27 respond_to do |format|
28 format.html { render :layout => false if request.xhr? }
29 format.api
34 30 end
35 31 end
36 32
37 33 def new
38 34 @tracker ||= Tracker.new(params[:tracker])
39 35 @trackers = Tracker.sorted.to_a
40 36 @projects = Project.all
41 37 end
42 38
43 39 def create
44 40 @tracker = Tracker.new(params[:tracker])
45 41 if @tracker.save
46 42 # workflow copy
47 43 if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
48 44 @tracker.workflow_rules.copy(copy_from)
49 45 end
50 46 flash[:notice] = l(:notice_successful_create)
51 47 redirect_to trackers_path
52 48 return
53 49 end
54 50 new
55 51 render :action => 'new'
56 52 end
57 53
58 54 def edit
59 55 @tracker ||= Tracker.find(params[:id])
60 56 @projects = Project.all
61 57 end
62 58
63 59 def update
64 60 @tracker = Tracker.find(params[:id])
65 61 if @tracker.update_attributes(params[:tracker])
66 62 flash[:notice] = l(:notice_successful_update)
67 63 redirect_to trackers_path(:page => params[:page])
68 64 return
69 65 end
70 66 edit
71 67 render :action => 'edit'
72 68 end
73 69
74 70 def destroy
75 71 @tracker = Tracker.find(params[:id])
76 72 unless @tracker.issues.empty?
77 73 flash[:error] = l(:error_can_not_delete_tracker)
78 74 else
79 75 @tracker.destroy
80 76 end
81 77 redirect_to trackers_path
82 78 end
83 79
84 80 def fields
85 81 if request.post? && params[:trackers]
86 82 params[:trackers].each do |tracker_id, tracker_params|
87 83 tracker = Tracker.find_by_id(tracker_id)
88 84 if tracker
89 85 tracker.core_fields = tracker_params[:core_fields]
90 86 tracker.custom_field_ids = tracker_params[:custom_field_ids]
91 87 tracker.save
92 88 end
93 89 end
94 90 flash[:notice] = l(:notice_successful_update)
95 91 redirect_to fields_trackers_path
96 92 return
97 93 end
98 94 @trackers = Tracker.sorted.to_a
99 95 @custom_fields = IssueCustomField.all.sort
100 96 end
101 97 end
@@ -1,37 +1,35
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 status.name, edit_issue_status_path(status) %></td>
22 22 <% if Issue.use_status_for_done_ratio? %>
23 23 <td><%= status.default_done_ratio %></td>
24 24 <% end %>
25 25 <td><%= checked_image status.is_closed? %></td>
26 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 <span class="pagination"><%= pagination_links_full @issue_status_pages %></span>
36
37 35 <% html_title(l(:label_issue_status_plural)) -%>
@@ -1,34 +1,32
1 1 <div class="contextual">
2 2 <%= link_to l(:label_role_new), new_role_path, :class => 'icon icon-add' %>
3 3 <%= link_to l(:label_permissions_report), permissions_roles_path, :class => 'icon icon-summary' %>
4 4 </div>
5 5
6 6 <h2><%=l(:label_role_plural)%></h2>
7 7
8 8 <table class="list">
9 9 <thead><tr>
10 10 <th><%=l(:label_role)%></th>
11 11 <th><%=l(:button_sort)%></th>
12 12 <th></th>
13 13 </tr></thead>
14 14 <tbody>
15 15 <% for role in @roles %>
16 16 <tr class="<%= cycle("odd", "even") %>">
17 17 <td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td>
18 18 <td class="reorder">
19 19 <% unless role.builtin? %>
20 20 <%= reorder_links('role', {:action => 'update', :id => role, :page => params[:page]}, :put) %>
21 21 <% end %>
22 22 </td>
23 23 <td class="buttons">
24 24 <%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %>
25 25 <%= delete_link role_path(role) unless role.builtin? %>
26 26 </td>
27 27 </tr>
28 28 <% end %>
29 29 </tbody>
30 30 </table>
31 31
32 <span class="pagination"><%= pagination_links_full @role_pages %></span>
33
34 32 <% html_title(l(:label_role_plural)) -%>
@@ -1,39 +1,37
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 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 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 <span class="pagination"><%= pagination_links_full @tracker_pages %></span>
38
39 37 <% html_title(l(:label_tracker_plural)) -%>
General Comments 0
You need to be logged in to leave comments. Login now