##// END OF EJS Templates
ajaxified paginators...
Jean-Philippe Lang -
r31:6a0022d7a146
parent child
Show More
@@ -34,7 +34,9 class AdminController < ApplicationController
34 34 @params['page']
35 35 @projects = Project.find :all, :order => sort_clause,
36 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 40 end
39 41
40 42 def mail_options
@@ -21,7 +21,7 class AuthSourcesController < ApplicationController
21 21
22 22 def index
23 23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 25 end
26 26
27 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 31 def list
32 32 @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
33 render :action => "list", :layout => false if request.xhr?
33 34 end
34 35
35 36 def new
@@ -21,11 +21,12 class CustomFieldsController < ApplicationController
21 21
22 22 def index
23 23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 25 end
26 26
27 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 30 end
30 31
31 32 def new
@@ -21,11 +21,12 class IssueStatusesController < ApplicationController
21 21
22 22 def index
23 23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 25 end
26 26
27 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 30 end
30 31
31 32 def new
@@ -29,7 +29,7 class ProjectsController < ApplicationController
29 29
30 30 def index
31 31 list
32 render :action => 'list'
32 render :action => 'list' unless request.xhr?
33 33 end
34 34
35 35 # Lists public projects
@@ -43,7 +43,9 class ProjectsController < ApplicationController
43 43 @projects = Project.find :all, :order => sort_clause,
44 44 :conditions => ["is_public=?", true],
45 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 49 end
48 50
49 51 # Add a new project
@@ -204,7 +206,7 class ProjectsController < ApplicationController
204 206 sort_update
205 207
206 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 211 @issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
210 212 @issue_pages = Paginator.new self, @issue_count, 15, @params['page']
@@ -212,7 +214,9 class ProjectsController < ApplicationController
212 214 :include => [ :author, :status, :tracker, :project ],
213 215 :conditions => search_filter_clause,
214 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 220 end
217 221
218 222 # Export filtered/sorted issues list to CSV
@@ -279,6 +283,7 class ProjectsController < ApplicationController
279 283 # Show news list of @project
280 284 def list_news
281 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 287 end
283 288
284 289 def add_file
@@ -21,11 +21,12 class RolesController < ApplicationController
21 21
22 22 def index
23 23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 25 end
26 26
27 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 30 end
30 31
31 32 def new
@@ -21,14 +21,15 class TrackersController < ApplicationController
21 21
22 22 def index
23 23 list
24 render :action => 'list'
24 render :action => 'list' unless request.xhr?
25 25 end
26 26
27 27 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
28 28 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list }
29 29
30 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 33 end
33 34
34 35 def new
@@ -26,7 +26,7 class UsersController < ApplicationController
26 26
27 27 def index
28 28 list
29 render :action => 'list'
29 render :action => 'list' unless request.xhr?
30 30 end
31 31
32 32 def list
@@ -38,7 +38,9 class UsersController < ApplicationController
38 38 @params['page']
39 39 @users = User.find :all,:order => sort_clause,
40 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 44 end
43 45
44 46 def add
@@ -59,10 +59,20 module ApplicationHelper
59 59 end
60 60
61 61 def pagination_links_full(paginator, options={}, html_options={})
62 html =''
63 html << link_to(('&#171; ' + l(:label_previous) ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous
64 html << (pagination_links(paginator, options, html_options) || '')
65 html << ' ' + link_to((l(:label_next) + ' &#187;'), { :page => paginator.current.next }) if paginator.current.next
62 html = ''
63 html << link_to_remote(('&#171; ' + l(:label_previous)),
64 {:update => "content", :url => { :page => paginator.current.previous }},
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 76 html
67 77 end
68 78
@@ -108,7 +108,10 module SortHelper
108 108 end
109 109 caption = titleize(Inflector::humanize(column)) unless caption
110 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 115 end
113 116
114 117 # Returns a table header <th> tag with a sort link for the named column
@@ -2,11 +2,11
2 2
3 3 <table class="listTableContent">
4 4 <tr class="ListHead">
5 <td><%=l(:field_name)%></td>
6 <td><%=l(:field_type)%></td>
7 <td><%=l(:field_host)%></td>
8 <td></td>
9 <td></td>
5 <th><%=l(:field_name)%></th>
6 <th><%=l(:field_type)%></th>
7 <th><%=l(:field_host)%></th>
8 <th></th>
9 <th></th>
10 10 </tr>
11 11
12 12 <% for source in @auth_sources %>
@@ -10,17 +10,17
10 10 <td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
11 11 <td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
12 12 <td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
13
14 13 <td valign="bottom">
14 <%= hidden_field_tag 'set_filter', 1 %>
15 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 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 21 </table>
22 <%= end_form_tag %>
23
24 24 &nbsp;
25 25
26 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