diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2006-10-21 10:38:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2006-10-21 10:38:53 +0000 |
commit | 6a0022d7a146d7827fc7acccde07cd3c159e2cfb (patch) | |
tree | f2e07525782e86326eb7063c634725fc1f4b49e3 | |
parent | e4d4a12c6a8a5507600b50e08c96da99789490ec (diff) | |
download | redmine-6a0022d7a146d7827fc7acccde07cd3c159e2cfb.tar.gz redmine-6a0022d7a146d7827fc7acccde07cd3c159e2cfb.zip |
ajaxified paginators
git-svn-id: http://redmine.rubyforge.org/svn/trunk@33 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | redmine/app/controllers/admin_controller.rb | 4 | ||||
-rw-r--r-- | redmine/app/controllers/auth_sources_controller.rb | 3 | ||||
-rw-r--r-- | redmine/app/controllers/custom_fields_controller.rb | 5 | ||||
-rw-r--r-- | redmine/app/controllers/issue_statuses_controller.rb | 5 | ||||
-rw-r--r-- | redmine/app/controllers/projects_controller.rb | 13 | ||||
-rw-r--r-- | redmine/app/controllers/roles_controller.rb | 5 | ||||
-rw-r--r-- | redmine/app/controllers/trackers_controller.rb | 5 | ||||
-rw-r--r-- | redmine/app/controllers/users_controller.rb | 6 | ||||
-rw-r--r-- | redmine/app/helpers/application_helper.rb | 18 | ||||
-rw-r--r-- | redmine/app/helpers/sort_helper.rb | 5 | ||||
-rw-r--r-- | redmine/app/views/auth_sources/list.rhtml | 10 | ||||
-rw-r--r-- | redmine/app/views/projects/list_issues.rhtml | 14 |
12 files changed, 60 insertions, 33 deletions
diff --git a/redmine/app/controllers/admin_controller.rb b/redmine/app/controllers/admin_controller.rb index 4b144e8d5..2c9f67586 100644 --- a/redmine/app/controllers/admin_controller.rb +++ b/redmine/app/controllers/admin_controller.rb @@ -34,7 +34,9 @@ class AdminController < ApplicationController @params['page']
@projects = Project.find :all, :order => sort_clause,
:limit => @project_pages.items_per_page,
- :offset => @project_pages.current.offset
+ :offset => @project_pages.current.offset
+
+ render :action => "projects", :layout => false if request.xhr?
end
def mail_options
diff --git a/redmine/app/controllers/auth_sources_controller.rb b/redmine/app/controllers/auth_sources_controller.rb index fe8536f99..86b58d365 100644 --- a/redmine/app/controllers/auth_sources_controller.rb +++ b/redmine/app/controllers/auth_sources_controller.rb @@ -21,7 +21,7 @@ class AuthSourcesController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) @@ -30,6 +30,7 @@ class AuthSourcesController < ApplicationController def list @auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10 + render :action => "list", :layout => false if request.xhr? end def new diff --git a/redmine/app/controllers/custom_fields_controller.rb b/redmine/app/controllers/custom_fields_controller.rb index d0ffddf7f..bfa152fd1 100644 --- a/redmine/app/controllers/custom_fields_controller.rb +++ b/redmine/app/controllers/custom_fields_controller.rb @@ -21,11 +21,12 @@ class CustomFieldsController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end def list - @custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 15 + @custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 15
+ render :action => "list", :layout => false if request.xhr? end def new
diff --git a/redmine/app/controllers/issue_statuses_controller.rb b/redmine/app/controllers/issue_statuses_controller.rb index be577ef19..18ca9c76d 100644 --- a/redmine/app/controllers/issue_statuses_controller.rb +++ b/redmine/app/controllers/issue_statuses_controller.rb @@ -21,11 +21,12 @@ class IssueStatusesController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end def list - @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10 + @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10
+ render :action => "list", :layout => false if request.xhr? end def new diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 8343c7a5f..a3dac1e04 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -29,7 +29,7 @@ class ProjectsController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end # Lists public projects @@ -43,7 +43,9 @@ class ProjectsController < ApplicationController @projects = Project.find :all, :order => sort_clause,
:conditions => ["is_public=?", true],
:limit => @project_pages.items_per_page,
- :offset => @project_pages.current.offset + :offset => @project_pages.current.offset
+
+ render :action => "list", :layout => false if request.xhr? end
# Add a new project @@ -204,7 +206,7 @@ class ProjectsController < ApplicationController sort_update
search_filter_init_list_issues
- search_filter_update if params[:set_filter] or request.post?
+ search_filter_update if params[:set_filter]
@issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
@issue_pages = Paginator.new self, @issue_count, 15, @params['page']
@@ -212,7 +214,9 @@ class ProjectsController < ApplicationController :include => [ :author, :status, :tracker, :project ],
:conditions => search_filter_clause,
:limit => @issue_pages.items_per_page,
- :offset => @issue_pages.current.offset
+ :offset => @issue_pages.current.offset
+
+ render :action => "list_issues", :layout => false if request.xhr?
end
# Export filtered/sorted issues list to CSV
@@ -279,6 +283,7 @@ class ProjectsController < ApplicationController # Show news list of @project
def list_news
@news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
+ render :action => "list_news", :layout => false if request.xhr?
end
def add_file
diff --git a/redmine/app/controllers/roles_controller.rb b/redmine/app/controllers/roles_controller.rb index 6d524cf14..e16127b61 100644 --- a/redmine/app/controllers/roles_controller.rb +++ b/redmine/app/controllers/roles_controller.rb @@ -21,11 +21,12 @@ class RolesController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end def list - @role_pages, @roles = paginate :roles, :per_page => 10 + @role_pages, @roles = paginate :roles, :per_page => 10
+ render :action => "list", :layout => false if request.xhr? end def new diff --git a/redmine/app/controllers/trackers_controller.rb b/redmine/app/controllers/trackers_controller.rb index bc76ea556..bbfb4f48b 100644 --- a/redmine/app/controllers/trackers_controller.rb +++ b/redmine/app/controllers/trackers_controller.rb @@ -21,14 +21,15 @@ class TrackersController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list } def list - @tracker_pages, @trackers = paginate :trackers, :per_page => 10 + @tracker_pages, @trackers = paginate :trackers, :per_page => 10
+ render :action => "list", :layout => false if request.xhr? end def new diff --git a/redmine/app/controllers/users_controller.rb b/redmine/app/controllers/users_controller.rb index 51c10ca8a..dee9e9d6b 100644 --- a/redmine/app/controllers/users_controller.rb +++ b/redmine/app/controllers/users_controller.rb @@ -26,7 +26,7 @@ class UsersController < ApplicationController def index list - render :action => 'list' + render :action => 'list' unless request.xhr? end def list
@@ -38,7 +38,9 @@ class UsersController < ApplicationController @params['page']
@users = User.find :all,:order => sort_clause,
:limit => @user_pages.items_per_page,
- :offset => @user_pages.current.offset + :offset => @user_pages.current.offset
+
+ render :action => "list", :layout => false if request.xhr? end def add diff --git a/redmine/app/helpers/application_helper.rb b/redmine/app/helpers/application_helper.rb index d3fc00cd5..4dc4acc27 100644 --- a/redmine/app/helpers/application_helper.rb +++ b/redmine/app/helpers/application_helper.rb @@ -59,10 +59,20 @@ module ApplicationHelper end
def pagination_links_full(paginator, options={}, html_options={})
- html =''
- html << link_to(('« ' + l(:label_previous) ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous - html << (pagination_links(paginator, options, html_options) || '')
- html << ' ' + link_to((l(:label_next) + ' »'), { :page => paginator.current.next }) if paginator.current.next
+ html = ''
+ html << link_to_remote(('« ' + l(:label_previous)),
+ {:update => "content", :url => { :page => paginator.current.previous }},
+ {:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
+
+ html << (pagination_links_each(paginator, options) do |n|
+ link_to_remote(n.to_s,
+ {:url => {:action => 'list', :params => @params.merge({:page => n})}, :update => 'content'},
+ {:href => url_for(:action => 'list', :params => @params.merge({:page => n}))})
+ end || '')
+
+ html << ' ' + link_to_remote((l(:label_next) + ' »'),
+ {:update => "content", :url => { :page => paginator.current.next }},
+ {:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.next}))}) if paginator.current.next
html
end
diff --git a/redmine/app/helpers/sort_helper.rb b/redmine/app/helpers/sort_helper.rb index bec2117ec..04a84c8e4 100644 --- a/redmine/app/helpers/sort_helper.rb +++ b/redmine/app/helpers/sort_helper.rb @@ -108,7 +108,10 @@ module SortHelper end caption = titleize(Inflector::humanize(column)) unless caption params = {:params => {:sort_key => column, :sort_order => order}} - link_to(caption, params) + (icon ? nbsp(2) + image_tag(icon) : '') + link_to_remote(caption, + {:update => "content", :url => { :sort_key => column, :sort_order => order}}, + {:href => url_for(:params => { :sort_key => column, :sort_order => order})}) + + (icon ? nbsp(2) + image_tag(icon) : '') end # Returns a table header <th> tag with a sort link for the named column diff --git a/redmine/app/views/auth_sources/list.rhtml b/redmine/app/views/auth_sources/list.rhtml index 1c27ddaf7..47cbeeaff 100644 --- a/redmine/app/views/auth_sources/list.rhtml +++ b/redmine/app/views/auth_sources/list.rhtml @@ -2,11 +2,11 @@ <table class="listTableContent"> <tr class="ListHead"> - <td><%=l(:field_name)%></td> - <td><%=l(:field_type)%></td> - <td><%=l(:field_host)%></td> - <td></td> - <td></td> + <th><%=l(:field_name)%></th> + <th><%=l(:field_type)%></th> + <th><%=l(:field_host)%></th> + <th></th> + <th></th> </tr> <% for source in @auth_sources %> diff --git a/redmine/app/views/projects/list_issues.rhtml b/redmine/app/views/projects/list_issues.rhtml index 7a924b134..6cd5f8070 100644 --- a/redmine/app/views/projects/list_issues.rhtml +++ b/redmine/app/views/projects/list_issues.rhtml @@ -10,17 +10,17 @@ <td><small><%=l(:field_fixed_version)%>:</small><br /><%= search_filter_tag 'fixed_version_id', :class => 'select-small' %></td>
<td><small><%=l(:field_assigned_to)%>:</small><br /><%= search_filter_tag 'assigned_to_id', :class => 'select-small' %></td>
<td><small><%=l(:label_subproject_plural)%>:</small><br /><%= search_filter_tag 'subproject_id', :class => 'select-small' %></td>
-
<td valign="bottom">
+ <%= hidden_field_tag 'set_filter', 1 %>
<%= submit_tag l(:button_apply), :class => 'button-small' %>
- <%= end_form_tag %>
-
- <%= start_form_tag %>
- <%= submit_tag l(:button_clear), :class => 'button-small' %>
- <%= end_form_tag %>
</td>
- </tr>
+ <td valign="bottom">
+ <%= link_to l(:button_clear), :action => 'list_issues', :id => @project, :set_filter => 1 %>
+ </td>
+ </tr>
</table>
+<%= end_form_tag %>
+
<%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %>
|