Merge branch 'rep_quality' of https://git.trustie.net/jacknudt/trustieforge into rep_quality

This commit is contained in:
daiao 2016-09-22 16:13:45 +08:00
commit d0ae48bbf1
5 changed files with 68 additions and 31 deletions

View File

@ -66,16 +66,16 @@ class IssuesController < ApplicationController
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'
if @query.valid?
case params[:format]
when 'csv', 'pdf'
@limit = 10#Setting.issues_export_limit.to_i
when 'atom'
@limit = 10#Setting.feeds_limit.to_i
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 10})
else
@limit = 10#per_page_option
end
# case params[:format]
# when 'csv', 'pdf'
# @limit = 10#Setting.issues_export_limit.to_i
# when 'atom'
# @limit = 10#Setting.feeds_limit.to_i
# when 'xml', 'json'
# @offset, @limit = api_offset_and_limit({:limit => 10})
# else
# @limit = 10#per_page_option
# end
@assign_to_id = params[:assigned_to_id]
@author_id = params[:author_id]
@priority_id = params[:priority_id]
@ -83,17 +83,23 @@ class IssuesController < ApplicationController
@subject = params[:subject]
@done_ratio = params[:done_ratio]
@issue_count = @query.issue_count
@issue_pages = Paginator.new @issue_count, @limit, params['page']
params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
# @issue_pages = Paginator.new @issue_count, @limit, params['page']
# params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
# @offset ||= @issue_pages.offset
@issues_filter = @query.issues
# (:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
# :order => 'issues.updated_on desc',
# :offset => @offset,
# :limit => @limit)
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
:order => 'issues.updated_on desc',
:offset => @offset,
:limit => @limit)
if params[:set_filter]
@set_filter = params[:set_filter]
end
@issue_count_by_group = @query.issue_count_by_group
@issues = paginateHelper @issues_filter, @limit
# if params[:set_filter]
# @set_filter = params[:set_filter]
# end
# @issue_count_by_group = @query.issue_count_by_group
respond_to do |format|
format.js
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young

View File

@ -6,6 +6,11 @@
</script>
<%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %>
<% if issues.count == 10%>
<%= link_to "点击展开更多",project_issues_path({:project_id => project.id}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="issue_list_pagination">
<%= pagination_links_full @issue_pages, @issue_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>

View File

@ -43,6 +43,30 @@
}
}
// 点击的时候让过滤条件选中assign_to
function switch_assign_to(assign) {
var assign = "option[value =" + assign + "]"
$("#assignToMe").click(function(){
});
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
remote_function();
}
// 点击的时候让过滤条件选中user_id
function createByMe(user_id) {
var user = "option[value =" + user_id + "]"
$("#createByMe").click(function(){
});
$("select[id='author_id']").find(user).attr("selected", "selected");
remote_function();
}
function all_reset_form() {
$("#issue_query_form")[0].reset();
remote_function();
}
</script>
@ -92,6 +116,11 @@
)
%>
</div><!--filter_form end-->
<a href="javascript:void(0);" onclick="switch_assign_to(<%= User.current.id %>)" id="assignToMe">指派我的</a>
<a href="javascript:void(0);" onclick="all_reset_form();">所有的</a>
<a href="javascript:void(0);" onclick="createByMe(<%= User.current.id %>)" id="createByMe">我发布的</a>
<div>
<div class="fl">&nbsp;</div>
<div>
@ -113,6 +142,7 @@
<% end %>
</div>
<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>

View File

@ -1,6 +1,4 @@
//$("#issue_list").html("<%#= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");
<% if @set_filter && @issue_pages.page == 1%> //只有搜索的第一页才需要替换整个issue_list其余的都是替换show_more_issues
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project})%>");
<%else%>
$("#show_more_issues").replaceWith("<%= escape_javascript( render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project} )%>");
<%end%>
$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query, :issue_pages=> @issue_pages, :issue_count => @issue_count, :project=> @project})%>");
$("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');

View File

@ -95,9 +95,7 @@
</div>
<div class="cl"></div>
</div>
<div id="div_user_issue_reply_<%=user_activity_id%>">
<%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
<script type="text/javascript">
$(function(){