diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 76808a392..14d5961cd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -686,35 +686,6 @@ class ApplicationController < ActionController::Base :content_type => 'application/atom+xml' end - # 项目列表导出Excel功能 - def issue_list_xls issues - xls_report = StringIO.new - book = Spreadsheet::Workbook.new - 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)]) - 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,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,9] = issue.fixed_version.try(:name) - sheet1[count_row,10] = issue.start_date - sheet1[count_row,11] = issue.due_date - sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id) - count_row += 1 - end - book.write xls_report - xls_report.string - end - def issue_ratio_change done_ratio, status_id if done_ratio == 100 || status_id == 3 "已完成" diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index a79890870..5d9528f87 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -34,7 +34,7 @@ class RepositoriesController < ApplicationController before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis] before_filter :find_repository, :only => [:edit, :update, :destroy, :committers] - before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive] + before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive, :export_rep_static] before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis] # 链接gitlab @@ -69,6 +69,20 @@ class RepositoriesController < ApplicationController end + def export_rep_static + @project = Project.find(params[:id]) + gpid = @project.gpid + rev = params[:rev] + cycle = params[:cycle] + respond_to do |format| + format.html + format.xls{ + filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}_#{@rev}_#{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 + end + def forked @project = Project.find(params[:id]) @repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab") diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 92e96e84c..a204ac524 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -63,6 +63,67 @@ module ApplicationHelper result end + # 项目版本库导出Excel功能 + def export_rep_xls(gpid, options = {}) + g = Gitlab.client + cycle = params[:cycle] + rev = params[:rev] + # branch = g.branche(gpid, rev) + statics = g.rep_stats(gpid, :rev => rev) + + 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)]) + 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,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周" + count_row += 1 + end + + book.write xls_report + xls_report.string + end + + # 项目issue列表导出Excel功能 + def issue_list_xls issues + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + 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)]) + 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,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,9] = issue.fixed_version.try(:name) + sheet1[count_row,10] = issue.start_date + sheet1[count_row,11] = issue.due_date + sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id) + count_row += 1 + end + book.write xls_report + xls_report.string + end + # 获取用户单位 # 优先获取高校信息,如果改信息不存在则获取occupation def get_occupation_from_user user diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 39cab4a53..26ad8501c 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,4 +1,4 @@ -
+

<%= @query.new_record? ? l(:label_calendar) : h(@query.name) %>

@@ -40,3 +40,7 @@ <% end %> <% html_title(l(:label_calendar)) -%> + + diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 0790b73f4..39ac2032b 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -1,4 +1,4 @@ -
+

<% @gantt.view = self %> <%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

@@ -320,3 +320,7 @@ $("#draw_progress_line").change(drawGanttHandler); }); <% end %> + + diff --git a/app/views/projects/_history.html.erb b/app/views/projects/_history.html.erb index 113689344..d9abdf47b 100644 --- a/app/views/projects/_history.html.erb +++ b/app/views/projects/_history.html.erb @@ -3,7 +3,7 @@ <% for journal in journals %>
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
-
+
<%= link_to journal.user.show_name, user_path(journal.user), :class => 'c_blue fb fl mb10 f14', :target => "_blank" %> diff --git a/app/views/projects/_project_jours.html.erb b/app/views/projects/_project_jours.html.erb index eacc2a152..a9f145c8a 100644 --- a/app/views/projects/_project_jours.html.erb +++ b/app/views/projects/_project_jours.html.erb @@ -1,214 +1,214 @@ - -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> -<% end %> - -
- <% reply_allow = JournalsForMessage.create_by_user? User.current %> -

<%= l(:label_user_response) %>

- <% if !User.current.logged?%> -
- <%= l(:label_user_login_tips) %> - <%= link_to l(:label_user_login_new), signin_path %> -
-
- <% else %> - <%= form_for('new_form', :method => :post, :html => {:id => 'project_feedback_form', :multipart => true}, - :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> - <%= f.text_area 'project_message', :rows => 3, :cols => 65, - :placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %> -

-
- <%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %> - 留言 - <%#= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %> - <% end %> - - <% end %> -
-
-
- <%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %> -
-
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
- -
- + +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + +
+ <% reply_allow = JournalsForMessage.create_by_user? User.current %> +

<%= l(:label_user_response) %>

+ <% if !User.current.logged?%> +
+ <%= l(:label_user_login_tips) %> + <%= link_to l(:label_user_login_new), signin_path %> +
+
+ <% else %> + <%= form_for('new_form', :method => :post, :html => {:id => 'project_feedback_form', :multipart => true}, + :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> + <%= f.text_area 'project_message', :rows => 3, :cols => 65, :style => "width:718px", + :placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %> +

+
+ <%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %> + 留言 + <%#= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %> + <% end %> + + <% end %> +
+
+
+ <%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %> +
+
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+ +
+ diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index fc474afaa..77f754567 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -1,4 +1,4 @@ -
+

<%= l(:label_project_tool_response)%>

<% reply_allow = JournalsForMessage.create_by_user? User.current %> @@ -47,4 +47,8 @@ function checkMaxLength() { -<% html_title(l(:label_project_tool_response)) -%> \ No newline at end of file +<% html_title(l(:label_project_tool_response)) -%> + + \ No newline at end of file diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb index fc9beae35..faf3a48f8 100644 --- a/app/views/projects/settings.html.erb +++ b/app/views/projects/settings.html.erb @@ -16,15 +16,16 @@ <% end%> <% end%> $("div[nhname='pro_setting']").show(); + $("#RSide").css('width',"730px"); }); -
+

配置

-