目标版本 :
+<%=l(:milestone)%> :
<%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 38cc93fe3..3ddbcd9d6 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -58,57 +58,15 @@ class IssuesController < ApplicationController include ApplicationHelper def index - retrieve_query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) - sort_update(@query.sortable_columns) - @query.sort_criteria = sort_criteria.to_a - - @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 - @tracker_id = params[:tracker_id] - @assign_to_id = params[:assigned_to_id] - @author_id = params[:author_id] - @status_id = params[:status_id] - @subject = params[:subject] - @done_ratio = params[:done_ratio] - @fixed_version_id = params[:fixed_version_id] - @issue_count = @query.issue_count - @test = params[:test] - # @issue_pages = Paginator.new @issue_count, @limit, params['page'] - # params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 - # @offset ||= @issue_pages.offset - @project_sort = 'issues.updated_on desc' - if params[:test] != "0" - case @test - when "1" - @project_sort = 'issues.created_on desc' - when "2" - @project_sort = 'issues.created_on asc' - when "3" - @project_sort = 'issues.updated_on desc' - when "4" - @project_sort = 'issues.updated_on asc' - end - end - @issues_filter_assign_count = @query.issues.select{|issue| issue.assigned_to_id == User.current.id }.count - @issues_filter_author_count = @query.issues.select{|issue| issue.author_id == User.current.id }.count - @issues_filter = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => @project_sort) + if params[:set_filter] != "1" + @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base' + @issues = @project.issues.visible.all + @issue_count = @issues.count @limit = 10 @is_remote = true @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1 @offset ||= @issue_pages.offset - @issues = paginateHelper @issues_filter, @limit + @issues = paginateHelper @issues, @limit # if params[:set_filter] # @set_filter = params[:set_filter] # end @@ -118,21 +76,106 @@ class IssuesController < ApplicationController format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young format.api {Issue.load_visible_relations(@issues) if include_in_api_response?('relations')} # format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json} - format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } - format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') } - format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') } + # format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } + # format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') } + # format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') } format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls" - send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) } end else - respond_to do |format| - format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young - format.any(:atom, :csv, :pdf) { render(:nothing => true) } - format.api { render_validation_errors(@query) } - format.js + retrieve_query + sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) + sort_update(@query.sortable_columns) + @query.sort_criteria = sort_criteria.to_a + + @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 + @tracker_id = params[:tracker_id] + @assign_to_id = params[:assigned_to_id] + @author_id = params[:author_id] + @status_id = params[:status_id] + @subject = params[:subject] + @done_ratio = params[:done_ratio] + @fixed_version_id = params[:fixed_version_id] + @issue_count = @query.issue_count + @test = params[:test] + # @issue_pages = Paginator.new @issue_count, @limit, params['page'] + # params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 + # @offset ||= @issue_pages.offset + @project_sort = 'issues.updated_on desc' + if params[:test] != "0" + case @test + when "1" + @project_sort = 'issues.created_on desc' + when "2" + @project_sort = 'issues.created_on asc' + when "3" + @project_sort = 'issues.updated_on desc' + when "4" + @project_sort = 'issues.updated_on asc' + end + end + @issues_filter_assign_count = @query.issues.select{|issue| issue.assigned_to_id == User.current.id }.count + @issues_filter_author_count = @query.issues.select{|issue| issue.author_id == User.current.id }.count + @issues_filter = @query.issues(:order => @project_sort) + @limit = 10 + @is_remote = true + @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1 + @offset ||= @issue_pages.offset + @issues = paginateHelper @issues_filter, @limit + # if params[:set_filter] + # @set_filter = params[:set_filter] + # end + # @issue_count_by_group = @query.issue_count_by_group + if params[:export_issue_hidden] == "1" + # index(:format=>'xls', :export_issue_hidden => 0) + params[:export_issue_hidden] = "0" + redirect_to project_issues_path(:project_id => @project, :format => 'xls') + + # respond_to do |format| + # format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls" + # send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + # return + # } + # return + # end + else + respond_to do |format| + format.js + format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young + format.api {Issue.load_visible_relations(@issues) if include_in_api_response?('relations')} + # format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json} + format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } + format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') } + format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') } + format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls" + send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } + end + end + else + respond_to do |format| + format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young + format.any(:atom, :csv, :pdf) { render(:nothing => true) } + format.api { render_validation_errors(@query) } + format.js + end end end + + rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 5d9528f87..d4042abf5 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -77,7 +77,7 @@ class RepositoriesController < ApplicationController respond_to do |format| format.html format.xls{ - filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}_#{@rev}_#{l(:label_rep_xls)}.xls" + filename = "#{@project.name.to_s}_#{l(:label_rep_xls)}.xls" send_data(export_rep_xls(gpid, :rev => rev, :cycle => "1"), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bf4ced4c6..6215a79d0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -68,29 +68,31 @@ module ApplicationHelper g = Gitlab.client cycle = params[:cycle] rev = params[:rev] - # branch = g.branche(gpid, rev) - statics = g.rep_stats(gpid, :rev => rev) - + if cycle == "week" + statics = g.rep_stats_week(gpid, :rev => rev) + elsif cycle == "month" + statics = g.rep_stats_month(gpid, :rev => rev) + end xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "版本库" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_author_mail),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle)]) + sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle),l(:rep_author_mail)]) count_row = 1 statics.each do |static| user = User.where(:mail => static.email).first sheet1[count_row,0] = rev sheet1[count_row,1] = user.nil? ? static.uname : user.show_name - sheet1[count_row,2] = static.email + sheet1[count_row,2] = static.commits_num sheet1[count_row,3] = static.add sheet1[count_row,4] = static.del sheet1[count_row,5] = static.changes - sheet1[count_row,6] = Time.now - sheet1[count_row,7] = "1周" + sheet1[count_row,6] = Time.now.strftime('%Y-%m-%d %H:%M:%S') + sheet1[count_row,7] = cycle == "week" ? "最近1周" : "最近一月" + sheet1[count_row,8] = static.email count_row += 1 end - book.write xls_report xls_report.string end @@ -102,21 +104,21 @@ module ApplicationHelper sheet1 = book.create_worksheet :name => "issues" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:issue_xls_version),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)]) + sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:milestone),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)]) count_row = 1 issues.each do |issue| sheet1[count_row,0] = issue.id sheet1[count_row,1] = issue_tracker_change(issue.tracker_id) sheet1[count_row,2] = issue.subject - sheet1[count_row,3] = issue.description + sheet1[count_row,3] = (issue.description.gsub(/<\/?.*?>/,"")).html_safe sheet1[count_row,4] = issue_status_change(issue.status_id) sheet1[count_row,5] = issue.assigned_to.try(:show_name) sheet1[count_row,6] = issue_priority_change(issue.priority_id) sheet1[count_row,7] = issue.author.show_name - sheet1[count_row,8] = issue.created_on + sheet1[count_row,8] = issue.created_on.nil? ? issue.created_on : issue.created_on.strftime('%Y-%m-%d %H:%M:%S') sheet1[count_row,9] = issue.fixed_version.try(:name) - sheet1[count_row,10] = issue.start_date - sheet1[count_row,11] = issue.due_date + sheet1[count_row,10] = issue.start_date.nil? ? issue.start_date : issue.start_date.strftime('%Y-%m-%d') + sheet1[count_row,11] = issue.due_date.nil? ? issue.due_date : issue.due_date.strftime('%Y-%m-%d') sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id) count_row += 1 end @@ -1863,6 +1865,10 @@ module ApplicationHelper content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(:class => "BlueCirBtnMini ml10",:style => "display:inline-block; height:20px; line-height:20px;")) end + def link_to_function_none(name, function, html_options={}) + content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(:style => "display:inline-block; height:20px; line-height:20px;")) + end + # Helper to render JSON in views def raw_json(arg) arg.to_json.to_s.gsub('/', '\/').html_safe @@ -1882,8 +1888,8 @@ module ApplicationHelper end def check_all_links(form_name) - link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + " ".html_safe + " | "+ " ".html_safe + - link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") + link_to_function_none(l(:button_check_all), "checkAll('#{form_name}', true)") + " ".html_safe + " | "+ " ".html_safe + + link_to_function_none(l(:button_uncheck_all), "checkAll('#{form_name}', false)") end # 本次修改,修改为只显示关闭的所占%比 diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 39ac2032b..759f8c232 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -48,10 +48,10 @@ -
- <%= gantt_zoom_link(@gantt, :in) %> - <%= gantt_zoom_link(@gantt, :out) %> -
+ + + +<%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %>
-<% end %> +<%# if @gantt.truncated %> + +<%# end %>目标版本 :
<%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %> +<%=l(:milestone)%> :
<%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %><%= l(:label_project_ivite_code)%>
<%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>
目标版本 :
+<%=l(:milestone)%> :
<%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %>