##// END OF EJS Templates
ajaxified paginators...
Jean-Philippe Lang -
r31:6a0022d7a146
parent child
Show More
@@ -34,7 +34,9 class AdminController < ApplicationController
34 @params['page']
34 @params['page']
35 @projects = Project.find :all, :order => sort_clause,
35 @projects = Project.find :all, :order => sort_clause,
36 :limit => @project_pages.items_per_page,
36 :limit => @project_pages.items_per_page,
37 :offset => @project_pages.current.offset
37 :offset => @project_pages.current.offset
38
39 render :action => "projects", :layout => false if request.xhr?
38 end
40 end
39
41
40 def mail_options
42 def mail_options
@@ -21,7 +21,7 class AuthSourcesController < ApplicationController
21
21
22 def index
22 def index
23 list
23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 end
25 end
26
26
27 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
27 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
@@ -30,6 +30,7 class AuthSourcesController < ApplicationController
30
30
31 def list
31 def list
32 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
32 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
33 render :action => "list", :layout => false if request.xhr?
33 end
34 end
34
35
35 def new
36 def new
@@ -21,11 +21,12 class CustomFieldsController < ApplicationController
21
21
22 def index
22 def index
23 list
23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 end
25 end
26
26
27 def list
27 def list
28 @custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 15
28 @custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 15
29 render :action => "list", :layout => false if request.xhr?
29 end
30 end
30
31
31 def new
32 def new
@@ -21,11 +21,12 class IssueStatusesController < ApplicationController
21
21
22 def index
22 def index
23 list
23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 end
25 end
26
26
27 def list
27 def list
28 @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10
28 @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10
29 render :action => "list", :layout => false if request.xhr?
29 end
30 end
30
31
31 def new
32 def new
@@ -29,7 +29,7 class ProjectsController < ApplicationController
29
29
30 def index
30 def index
31 list
31 list
32 render :action => 'list'
32 render :action => 'list' unless request.xhr?
33 end
33 end
34
34
35 # Lists public projects
35 # Lists public projects
@@ -43,7 +43,9 class ProjectsController < ApplicationController
43 @projects = Project.find :all, :order => sort_clause,
43 @projects = Project.find :all, :order => sort_clause,
44 :conditions => ["is_public=?", true],
44 :conditions => ["is_public=?", true],
45 :limit => @project_pages.items_per_page,
45 :limit => @project_pages.items_per_page,
46 :offset => @project_pages.current.offset
46 :offset => @project_pages.current.offset
47
48 render :action => "list", :layout => false if request.xhr?
47 end
49 end
48
50
49 # Add a new project
51 # Add a new project
@@ -204,7 +206,7 class ProjectsController < ApplicationController
204 sort_update
206 sort_update
205
207
206 search_filter_init_list_issues
208 search_filter_init_list_issues
207 search_filter_update if params[:set_filter] or request.post?
209 search_filter_update if params[:set_filter]
208
210
209 @issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
211 @issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
210 @issue_pages = Paginator.new self, @issue_count, 15, @params['page']
212 @issue_pages = Paginator.new self, @issue_count, 15, @params['page']
@@ -212,7 +214,9 class ProjectsController < ApplicationController
212 :include => [ :author, :status, :tracker, :project ],
214 :include => [ :author, :status, :tracker, :project ],
213 :conditions => search_filter_clause,
215 :conditions => search_filter_clause,
214 :limit => @issue_pages.items_per_page,
216 :limit => @issue_pages.items_per_page,
215 :offset => @issue_pages.current.offset
217 :offset => @issue_pages.current.offset
218
219 render :action => "list_issues", :layout => false if request.xhr?
216 end
220 end
217
221
218 # Export filtered/sorted issues list to CSV
222 # Export filtered/sorted issues list to CSV
@@ -279,6 +283,7 class ProjectsController < ApplicationController
279 # Show news list of @project
283 # Show news list of @project
280 def list_news
284 def list_news
281 @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
285 @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
286 render :action => "list_news", :layout => false if request.xhr?
282 end
287 end
283
288
284 def add_file
289 def add_file
@@ -21,11 +21,12 class RolesController < ApplicationController
21
21
22 def index
22 def index
23 list
23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 end
25 end
26
26
27 def list
27 def list
28 @role_pages, @roles = paginate :roles, :per_page => 10
28 @role_pages, @roles = paginate :roles, :per_page => 10
29 render :action => "list", :layout => false if request.xhr?
29 end
30 end
30
31
31 def new
32 def new
@@ -21,14 +21,15 class TrackersController < ApplicationController
21
21
22 def index
22 def index
23 list
23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 end
25 end
26
26
27 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
27 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
28 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list }
28 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list }
29
29
30 def list
30 def list
31 @tracker_pages, @trackers = paginate :trackers, :per_page => 10
31 @tracker_pages, @trackers = paginate :trackers, :per_page => 10
32 render :action => "list", :layout => false if request.xhr?
32 end
33 end
33
34
34 def new
35 def new
@@ -26,7 +26,7 class UsersController < ApplicationController
26
26
27 def index
27 def index
28 list
28 list
29 render :action => 'list'
29 render :action => 'list' unless request.xhr?
30 end
30 end
31
31
32 def list
32 def list
@@ -38,7 +38,9 class UsersController < ApplicationController
38 @params['page']
38 @params['page']
39 @users = User.find :all,:order => sort_clause,
39 @users = User.find :all,:order => sort_clause,
40 :limit => @user_pages.items_per_page,
40 :limit => @user_pages.items_per_page,
41 :offset => @user_pages.current.offset
41 :offset => @user_pages.current.offset
42
43 render :action => "list", :layout => false if request.xhr?
42 end
44 end
43
45
44 def add
46 def add
@@ -59,10 +59,20 module ApplicationHelper
59 end
59 end
60
60
61 def pagination_links_full(paginator, options={}, html_options={})
61 def pagination_links_full(paginator, options={}, html_options={})
62 html =''
62 html = ''
63 html << link_to(('&#171; ' + l(:label_previous) ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous
63 html << link_to_remote(('&#171; ' + l(:label_previous)),
64 html << (pagination_links(paginator, options, html_options) || '')
64 {:update => "content", :url => { :page => paginator.current.previous }},
65 html << ' ' + link_to((l(:label_next) + ' &#187;'), { :page => paginator.current.next }) if paginator.current.next
65 {:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
66
67 html << (pagination_links_each(paginator, options) do |n|
68 link_to_remote(n.to_s,
69 {:url => {:action => 'list', :params => @params.merge({:page => n})}, :update => 'content'},
70 {:href => url_for(:action => 'list', :params => @params.merge({:page => n}))})
71 end || '')
72
73 html << ' ' + link_to_remote((l(:label_next) + ' &#187;'),
74 {:update => "content", :url => { :page => paginator.current.next }},
75 {:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.next}))}) if paginator.current.next
66 html
76 html
67 end
77 end
68
78
@@ -108,7 +108,10 module SortHelper
108 end
108 end
109 caption = titleize(Inflector::humanize(column)) unless caption
109 caption = titleize(Inflector::humanize(column)) unless caption
110 params = {:params => {:sort_key => column, :sort_order => order}}
110 params = {:params => {:sort_key => column, :sort_order => order}}
111 link_to(caption, params) + (icon ? nbsp(2) + image_tag(icon) : '')
111 link_to_remote(caption,
112 {:update => "content", :url => { :sort_key => column, :sort_order => order}},
113 {:href => url_for(:params => { :sort_key => column, :sort_order => order})}) +
114 (icon ? nbsp(2) + image_tag(icon) : '')
112 end
115 end
113
116
114 # Returns a table header <th> tag with a sort link for the named column
117 # Returns a table header <th> tag with a sort link for the named column
@@ -2,11 +2,11
2
2
3 <table class="listTableContent">
3 <table class="listTableContent">
4 <tr class="ListHead">
4 <tr class="ListHead">
5 <td><%=l(:field_name)%></td>
5 <th><%=l(:field_name)%></th>
6 <td><%=l(:field_type)%></td>
6 <th><%=l(:field_type)%></th>
7 <td><%=l(:field_host)%></td>
7 <th><%=l(:field_host)%></th>
8 <td></td>
8 <th></th>
9 <td></td>
9 <th></th>
10 </tr>
10 </tr>
11
11
12 <% for source in @auth_sources %>
12 <% for source in @auth_sources %>
@@ -10,17 +10,17
10 <td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
10 <td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
11 <td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
11 <td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
12 <td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
12 <td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
13
14 <td valign="bottom">
13 <td valign="bottom">
14 <%= hidden_field_tag 'set_filter', 1 %>
15 <%= submit_tag l(:button_apply), :class => 'button-small' %>
15 <%= submit_tag l(:button_apply), :class => 'button-small' %>
16 <%= end_form_tag %>
17
18 <%= start_form_tag %>
19 <%= submit_tag l(:button_clear), :class => 'button-small' %>
20 <%= end_form_tag %>
21 </td>
16 </td>
22 </tr>
17 <td valign="bottom">
18 <%= link_to l(:button_clear), :action => 'list_issues', :id => @project, :set_filter => 1 %>
19 </td>
20 </tr>
23 </table>
21 </table>
22 <%= end_form_tag %>
23
24 &nbsp;
24 &nbsp;
25
25
26 <%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %>
26 <%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %>
General Comments 0
You need to be logged in to leave comments. Login now