From 0629b31e53d6f59140ac71c55c554629fc0f93d5 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 22 Feb 2017 10:14:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=83=A8=E5=88=86=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=EF=BC=88=E6=AF=94=E5=A6=82=EF=BC=9A594=EF=BC=89?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=89=88=E6=9C=AC=E5=BA=93=E5=88=86=E6=94=AF?= =?UTF-8?q?500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 30 ++--- .../repositories/_latest_commit.html.erb | 14 +- app/views/repositories/show.html.erb | 124 ++++++++---------- 3 files changed, 75 insertions(+), 93 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index a955fa88b..b1e23a96a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -410,23 +410,21 @@ update if request.xhr? @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) else - unless @entries.blank? - @changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path) - # @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path) - # 总的提交数 - @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count - # 获取默认分支 - @g_default_branch = @g_project.default_branch.nil? ? "master" : @g_project.default_branch + @changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path) + # @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path) + # 总的提交数 + @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count + # 获取默认分支 + @g_default_branch = @g_project.default_branch.nil? ? "master" : @g_project.default_branch - @creator = @project.owner.to_s - gitlab_address = Redmine::Configuration['gitlab_address'] - gitlab_token = Gitlab.private_token - # token值加密解密 - token = aes_encrypt("priEn3UwXfJs3Pmy", gitlab_token) - # token值解密 - # gitlab_token = aes_dicrypt("priEn3UwXfJs3Pmy", token) - @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + token - end + @creator = @project.owner.to_s + gitlab_address = Redmine::Configuration['gitlab_address'] + gitlab_token = Gitlab.private_token + # token值加密解密 + token = aes_encrypt("priEn3UwXfJs3Pmy", gitlab_token) + # token值解密 + # gitlab_token = aes_dicrypt("priEn3UwXfJs3Pmy", token) + @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + token @creator = @project.owner.to_s gitlab_address = Redmine::Configuration['gitlab_address'] diff --git a/app/views/repositories/_latest_commit.html.erb b/app/views/repositories/_latest_commit.html.erb index 204196442..acce15cd8 100644 --- a/app/views/repositories/_latest_commit.html.erb +++ b/app/views/repositories/_latest_commit.html.erb @@ -1,11 +1,11 @@ -
- <% if @changesets_latest_coimmit %> +<% if @changesets_latest_coimmit && @changesets_latest_coimmit.try(:time) %> +
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.try(:author_email))), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> <%= link_to_user_mail(@changesets_latest_coimmit.try(:author_email), "fb fontGrey3 mr5 fl hidden maxwidth150 ml5") %>
提交于 <%= time_tag(@changesets_latest_coimmit.try(:time)) %> 前:
<%= @changesets_latest_coimmit.message %>
- <% end %> - <% if @entry && @entry.kind == 'file' %> - <%= render :partial => 'link_to_functions' %> - <% end %> -
\ No newline at end of file + <% if @entry && @entry.kind == 'file' %> + <%= render :partial => 'link_to_functions' %> + <% end %> +
+<% end %> \ No newline at end of file diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index d8afa6a4c..bd8d48e9a 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -1,86 +1,70 @@ -<%#= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
-
- <% if @entries.nil? %> - <%# 未提交代码提示 %> -
- <% if @entries.nil? && authorize_for('repositories', 'browse') %> -
- 该版本库还没有上传代码! -
- <% end %> - <% if @repository.type.to_s == "Repository::Gitlab" %> - 版本库地址:<%= @repos_url %> - <% else %> - 版本库地址:<%= h @repository.url %> - <% end %> -
-
- <% else %> -
    -
  • - <%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}", - {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, - :rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"}, :class => "linkBlue fb" %> 提交 -
  • -
  • - <%= @repository.branches.count %>分支 -
  • -
  • - <%=link_to "贡献统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, - :creator => @creator, :default_branch => @g_default_branch ) %> -
  • -
-
-
- <%= render :partial => 'navigation' %> -
- ZIP下载 - <% if User.current.member_of?(@project) && @project.is_public? %> - <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fl ml10" %> - <% else %> - <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fl ml10" %> - <% end %> - <% end %> - <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> - <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fl ml10" %> - <% end %> - -
- - - -
-
- -
- <%= render :partial => 'latest_commit' %> -
+
+
    +
  • + <%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}", + {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, + :rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"}, :class => "linkBlue fb" %> 提交 +
  • +
  • + <%= @repository.branches.count %>分支 +
  • +
  • + <%=link_to "贡献统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, + :creator => @creator, :default_branch => @g_default_branch ) %> +
  • +
+
+
+ <%= render :partial => 'navigation' %> +
+ ZIP下载 + <% if !@entries.blank? && User.current.member_of?(@project) && @project.is_public? %> + <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fl ml10" %> + <% else %> + <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fl ml10" %> + <% end %> + <% end %> + <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fl ml10" %> <% end %> - <% if !@entries.nil? && authorize_for('repositories', 'browse') %> +
+ + + +
+
+ +
+ <%= render :partial => 'latest_commit' %> +
+ + <% if !@entries.blank? && authorize_for('repositories', 'browse') %> <%= render :partial => 'dir_list' %> + <% else %> + <%= render :partial => "projects/no_data" %> <% end %> <% memo = Memo.where(:id => 1232).first %> <% unless memo.nil? %> - <%=Setting.host_name %>/forums/1/memos/1232" class="linkBlue2" target="_blank">如何提交代码 + <%=Setting.host_name %>/forums/1/memos/1232" class="linkBlue2" target="_blank">如何提交代码 <% end %> <% unless @entries.blank? %> -
- 导出统计结果: - <%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "week" }, :class => "linkBlue2" %> | - <%= link_to "最近一月", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "month" }, :class => "linkBlue2" %> -
-
+
+ 导出统计结果: + <%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "week" }, :class => "linkBlue2" %> | + <%= link_to "最近一月", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "month" }, :class => "linkBlue2" %> +
+
<% end %> - <%#= link_to "导出excel", {:controller => 'repositories', :action => 'export_rep_static', :rev => @rev}, :format => 'xls' %> - -
+ <%#= link_to "导出excel", {:controller => 'repositories', :action => 'export_rep_static', :rev => @rev}, :format => 'xls' %> + +
<%# content_for :header_tags do %> - <%#= stylesheet_link_tag "scm" %> +<%#= stylesheet_link_tag "scm" %> <%# end %> <% html_title(l(:label_repository)) -%>