1.添加工作台分页处理操作

2.分页处理路由函数添加
This commit is contained in:
zhanghaitao 2014-08-22 09:38:07 +08:00
parent cbd3610bf4
commit b635a6b3c5
7 changed files with 63 additions and 18 deletions

View File

@ -83,6 +83,10 @@ class IssuesController < ApplicationController
:limit => @limit)
@issue_count_by_group = @query.issue_count_by_group
respond_to do |format|
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
format.api {

View File

@ -37,6 +37,7 @@ class MyController < ApplicationController
}.freeze
def index
page
render :action => 'page'
end
@ -44,9 +45,33 @@ class MyController < ApplicationController
# Show user's page
def page
@user = User.current
@Issues= Issue.visible.open.
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
@limit = 10
@feedback_count = @Issues.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = @Issues[@offset, @limit]
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
end
def page2
@limit = 10
@user = User.current
@Issues= Issue.visible.open.
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
@feedback_count = @Issues.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = @Issues[@offset, @limit]
@state = false
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
respond_to do |format|
format.js
end
end
# Edit user's account
def account
@user = User.current

View File

@ -0,0 +1,26 @@
<% assigned_issues = issuesassignedtome_items %>
<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
<% if assigned_issues.length > 0 %>
<!--分页-->
<!--
<div class="pagination" style="float:left;">
<ul>
<%#= pagination_links_full(@feedback_pages,@feedback_count, :per_page_links => false){|text, parameters, options|
link_to text, my_page2_path(parameters.merge(:q => params[:q])) }%>
<%#= pagination_links_full @feedback_pages %>
</ul>
</div>
-->
<p class="small"><%= link_to l(:label_issue_view_all), :controller => 'issues',
:action => 'index',
:set_filter => 1,
:assigned_to_id => 'me',
:sort => 'priority:desc,updated_on:desc' %></p>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom,
{:controller => 'issues', :action => 'index', :set_filter => 1,
:assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key},
{:title => l(:label_assigned_to_me_issues)}) %>
<% end %>

View File

@ -1,18 +1,4 @@
<h3><%=l(:label_assigned_to_me_issues)%> (<%= Issue.visible.open.count(:conditions => {:assigned_to_id => ([User.current.id] + User.current.group_ids)})%>)</h3>
<% assigned_issues = issuesassignedtome_items %>
<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
<% if assigned_issues.length > 0 %>
<p class="small"><%= link_to l(:label_issue_view_all), :controller => 'issues',
:action => 'index',
:set_filter => 1,
:assigned_to_id => 'me',
:sort => 'priority:desc,updated_on:desc' %></p>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom,
{:controller => 'issues', :action => 'index', :set_filter => 1,
:assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key},
{:title => l(:label_assigned_to_me_issues)}) %>
<% end %>
<div id="asdsadwsc">
<%= render :partial => "my/blocks/assiagn_issue" %>
</div>

1
app/views/my/page.js.erb Normal file
View File

@ -0,0 +1 @@
$("#asdsadwsc").html("<%= escape_javascript(render :partial => 'my/blocks/assiagn_issue') %>");

View File

@ -0,0 +1 @@
$("#asdsadwsc").html("<%= escape_javascript(render :partial => 'my/blocks/assiagn_issue') %>");

View File

@ -275,6 +275,8 @@ RedmineApp::Application.routes.draw do
match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
get 'my/page2', :to => 'my#page2', :as => "my_page2"
resources :users
match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership'
match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete