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

View File

@ -6,6 +6,11 @@
</script> </script>
<%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %> <% end %>
<% if issues.count == 10%> <div style="text-align:center;">
<%= link_to "点击展开更多",project_issues_path({:project_id => project.id}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%> <div class="pages" style="width:auto; display:inline-block;">
<% end%> <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> </script>
@ -92,6 +116,11 @@
) )
%> %>
</div><!--filter_form end--> </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>
<div class="fl">&nbsp;</div> <div class="fl">&nbsp;</div>
<div> <div>
@ -113,6 +142,7 @@
<% end %> <% end %>
</div> </div>
<div class="contextual"> <div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %> <% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> <%= 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})%>"); //$("#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})%>");
$("#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 %>');
<%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%>

View File

@ -95,9 +95,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</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> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){