From bd383f50102e852bef39846811e36b153ce67ee4 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 28 Sep 2016 16:04:53 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=8F=90=E7=A4=BA=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=B8=80=E7=BA=A7setting=E4=B8=AD=E6=8E=A7=E5=88=B6=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 7 ++- .../settings/_new_repositories.html.erb | 44 ++----------------- 2 files changed, 7 insertions(+), 44 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index df40eb378..79d82b36a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -357,10 +357,8 @@ class ProjectsController < ApplicationController def settings # 修改查看消息状态 applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0) - applied_messages.each do |applied_message| - applied_message.update_attributes(:viewed => true) - end - # end + applied_messages.update_all(:viewed => true) + @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @project.members.new @@ -397,6 +395,7 @@ class ProjectsController < ApplicationController @repository = Repository.factory(scm) @repository.is_default = @project.repository.nil? @repository.project = @project + @gitlab_rep = Repository.where(:type => "Repository::Gitlab", :project_id => @project).first unless @project.gpid.nil? g = Gitlab.client @gitlab_branches = g.branches(@project.gpid) diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index be6330d9b..a346f21b1 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -10,18 +10,10 @@ <%= str = error_messages_for 'repository' %> <% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %> <% ip = RepositoriesHelper::REPO_IP_ADDRESS %> -<%# 提示 %> -<% if @project.repositories.count>1 %> -
- 项目管理员您好!近日平台完成了版本库升级,以后每个项目将唯一的对应一个版本库。请您按照以下步骤完成项目版本库的更新: -

1. 点击下面的"创建版本库按钮",为本项目创建一个新的版本库;

-

2. 从本项目的历史版本库中选择一个您将使用的版本库,将其完整的克隆(clone)到本地(需要提供您之前设置的版本库口令),然后推送(push)到新建的版本库(注意不能仅推送代码,否则之前各开发者的提交记录将丢失)。

-

3. 本项目的历史版本库将在您新建版本库的一周内自动隐藏,如果您以后需要这些版本库,请与网站联系,我们将为您提供这些版本库的所有数据。

-
-<% end %> + <%# 新建版本库 %> -<% if @project.repositories.count == 0 || rep_is_gitlab?(@project) %> -
+<% if @gitlab_rep.nil? %> +
<% course_tag = @project.project_type %> @@ -60,36 +52,8 @@
<% end %>
-<% end %> - - -<% if @project.repositories.any? %> +<% else %> <%= render :partial => 'projects/settings/rep_gitlab', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %> - <%#= render :partial => 'projects/settings/rep_forge', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %> -
历史版本库
- - - <% rep_forge(@project).sort.each do |repository| %> - - - - <%if repository.scm_name=="Git"%> - <% rep_url = "http://" + repository.login.to_s + '_'+ repository.identifier.to_s + "@" + ip.to_s + h( repository.url.slice(project_path_cut, repository.url.length)) %> - - <%else %> - - <% end %> - - <% end %> - -
- <%= repository.identifier %><%=h repository.scm_name %> - - - - <%#= rep_url %> - - <%=h truncate(repository.url,:length=>10) %>
<% end %> From 25b2602d3ebc410ee3bfa6781f80f68f59101cbd Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 28 Sep 2016 16:51:25 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=94=AF=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index d4042abf5..3fdbe2f89 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -410,11 +410,11 @@ update @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token # 获取版本库路径,主要分为两种,一种随Gitlab类型,另一种为Git类型,Git类型为无用数据,最终需要删掉这种类型。 - if @repository.type.to_s == "Repository::Gitlab" + # if @repository.type.to_s == "Repository::Gitlab" @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" - else - @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s - end + # else + # @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s + # end render :action => 'show', :layout => 'base_projects' end end From 0906da513239c89f9fa4cf7ad58554c2b83eda89 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 8 Oct 2016 10:10:59 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 38 ++++++++-------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3fdbe2f89..491699cd3 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -376,11 +376,21 @@ update def show ## TODO: the below will move to filter, done. + # 访问版本庫后更新project_score表数据;changeset_num为提交总数 + project_score = @project.project_score + if project_score.nil? + ProjectScore.create(:project_id => @project.id, :score => false) + else + project_score.update_column(:changeset_num, @changesets_all_count) + end + unless @changesets_latest_coimmit.blank? + update_commits_date(@project, @changesets_latest_coimmit) + end # 获取版本库目录结构 - @entries = @repository.entries(@path, @rev) + #@entries = @repository.entries(@path, @rev) if request.xhr? - @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) + #@entries ? render(:partial => 'dir_list_content') : render(:nothing => true) else @changesets = @g.commits(@project.gpid, :ref_name => @rev) # 最近一次提交 @@ -388,34 +398,14 @@ update g_project = @g.project(@project.gpid) # 总的提交数 @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count - # 获取默认分支 @g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch - - # 访问版本庫后更新project_score表数据;changeset_num为提交总数 - project_score = @project.project_score - if project_score.nil? - ProjectScore.create(:project_id => @project.id, :score => false) - else - project_score.update_column(:changeset_num, @changesets_all_count) - end - - unless @changesets_latest_coimmit.blank? - update_commits_date(@project, @changesets_latest_coimmit) - end @creator = @project.owner.to_s gitlab_address = Redmine::Configuration['gitlab_address'] - # REDO:需优化,仅测试用 @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token - - # 获取版本库路径,主要分为两种,一种随Gitlab类型,另一种为Git类型,Git类型为无用数据,最终需要删掉这种类型。 - # if @repository.type.to_s == "Repository::Gitlab" - @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" - # else - # @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s - # end - render :action => 'show', :layout => 'base_projects' + @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" + render :layout => 'base_projects' end end From b7b94fb0509826e081e5c634984e07dfc78a47c7 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 8 Oct 2016 14:57:55 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 79 +++++++++------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 491699cd3..d1f3ffa7f 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -34,16 +34,18 @@ 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, :export_rep_static] + # 连接gitlab + # before_filter :connect_gitlab, :only => [:quality_analysis, :commit_diff] + 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 - before_filter :connect_gitlab, :only => [:quality_analysis, :show, :commit_diff, :find_project_repository] # 版本库新增权限 before_filter :show_rep, :only => [:show] accept_rss_auth :revisions # hidden repositories filter // 隐藏代码过滤器 - before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ] + before_filter :check_hidden_repo, :only => [:stats, :revisions, :revision, :diff ] helper :repositories include RepositoriesHelper helper :project_score @@ -329,7 +331,7 @@ update def quality_analysis gitlab_branches = @g.branches(@project.gpid) @branch_names = gitlab_branches.map{|b| b.name} - @gitlab_default_branch = @g.project(@project.gpid).default_branch + @gitlab_default_branch = @g_project.default_branch # language = params[:language] # branch = params[:branch] # path = params[:path] @@ -375,7 +377,23 @@ update end def show - ## TODO: the below will move to filter, done. + # 获取版本库目录结构 + @entries = @repository.entries(@path, @rev) + @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] + + # 总的提交数 + @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'] + # REDO:需优化,仅测试用 + @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token + @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" + + # 一些数据的异步同步更新 # 访问版本庫后更新project_score表数据;changeset_num为提交总数 project_score = @project.project_score if project_score.nil? @@ -387,26 +405,7 @@ update update_commits_date(@project, @changesets_latest_coimmit) end - # 获取版本库目录结构 - #@entries = @repository.entries(@path, @rev) - if request.xhr? - #@entries ? render(:partial => 'dir_list_content') : render(:nothing => true) - else - @changesets = @g.commits(@project.gpid, :ref_name => @rev) - # 最近一次提交 - @changesets_latest_coimmit = @changesets[0] - g_project = @g.project(@project.gpid) - # 总的提交数 - @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'] - # REDO:需优化,仅测试用 - @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token - @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" - render :layout => 'base_projects' - end + render :layout => 'base_projects' end alias_method :browse, :show @@ -662,7 +661,7 @@ update @g_project = @g.project(@project.gpid) end rescue => e - logger.error("failed to connect gitlab ==> #{e}") + logger.error("connect gitlab failed ==> #{e}") end end @@ -681,31 +680,19 @@ update end REV_PARAM_RE = %r{\A[a-f0-9]*\Z}i + REP_TYPE = "Repository::Gitlab" + # 获取项目、版本库、路劲、默认分支 def find_project_repository @project = Project.find(params[:id]) - if params[:repository_id].present? - @repository = @project.repositories.find_by_identifier_param(params[:repository_id]) - else - # 多版本库,如果一个版本库为空则去下一个 - rep_count = @project.repositories.count - if @project.repository.nil? - for i in 0..rep_count - unless @project.repositories[i].nil? - @repository = @project.repositories[i] - break - end - end - else - @repository = @project.repository - end - end - (render_404; return false) unless @repository + @repository = Repository.where(:type => REP_TYPE, :project_id => @project).first + (render_404; return false) unless (@repository || @project.gpid) @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s + @g = Gitlab.client + @g_project = @g.project(@project.gpid) + @g_default_branch = @g_project.default_branch # gitlab端获取默认分支 - g = Gitlab.client - gitlab_branchs = g.project(@project.gpid).default_branch - @project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip) + @rev = params[:rev].blank? ? @g_default_branch : params[:rev].to_s.strip @rev_to = params[:rev_to] unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) if @repository.branches.blank? From 84fd99ced1b8d48bbcead0fd047af5d28c4c054f Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 8 Oct 2016 15:09:59 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=A1=B9=E7=9B=AEbase=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_projects.html.erb | 77 ------------------- .../projects/_development_group.html.erb | 5 +- 2 files changed, 3 insertions(+), 79 deletions(-) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index fced40737..93bc665b3 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -102,83 +102,6 @@ <%= render :partial => 'layouts/footer' %>
- -
- - <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> -
-
-

请选择项目类型:

-
    -
  • id="development_group"/>
  • -
  • id="research_group"/>
  • -
  • id="friend_organization"/>
  • -
- 确定 -
- - -
<% if hidden_unproject_infos %> <%= render :partial => 'layouts/new_feedback' %> <% end %> diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 1ddd9acac..c92d1b43b 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -1,9 +1,10 @@ <% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %> <% project_issue_count =Issue.where(:project_id => @project.id).count%> +<% acts_count = ForgeActivity.where("project_id = ?", @project.id).count %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> From 54b66b86dc52b36b1345b588bc3338299f6d0b15 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 8 Oct 2016 15:58:05 +0800 Subject: [PATCH 6/9] 0 --- app/controllers/repositories_controller.rb | 54 ++++++++++++---------- app/views/layouts/base_projects.html.erb | 2 +- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index d1f3ffa7f..08ffca920 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -379,33 +379,37 @@ update def show # 获取版本库目录结构 @entries = @repository.entries(@path, @rev) - @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] - - # 总的提交数 - @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'] - # REDO:需优化,仅测试用 - @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token - @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" - - # 一些数据的异步同步更新 - # 访问版本庫后更新project_score表数据;changeset_num为提交总数 - project_score = @project.project_score - if project_score.nil? - ProjectScore.create(:project_id => @project.id, :score => false) + if request.xhr? + @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) else - project_score.update_column(:changeset_num, @changesets_all_count) - end - unless @changesets_latest_coimmit.blank? - update_commits_date(@project, @changesets_latest_coimmit) - end + @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] - render :layout => 'base_projects' + # 总的提交数 + @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'] + # REDO:需优化,仅测试用 + @zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token + @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git" + + # 一些数据的异步同步更新 + # 访问版本庫后更新project_score表数据;changeset_num为提交总数 + project_score = @project.project_score + if project_score.nil? + ProjectScore.create(:project_id => @project.id, :score => false) + else + project_score.update_column(:changeset_num, @changesets_all_count) + end + unless @changesets_latest_coimmit.blank? + update_commits_date(@project, @changesets_latest_coimmit) + end + + render :layout => 'base_projects' + end end alias_method :browse, :show diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 93bc665b3..6f0b75b31 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -53,7 +53,7 @@ From baf556bd39d8bf40b6f3dddbcda7fa6f7d55230a Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 8 Oct 2016 17:20:27 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/other_poll.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/poll/other_poll.js.erb b/app/views/poll/other_poll.js.erb index 19dc17052..cbaa2bbec 100644 --- a/app/views/poll/other_poll.js.erb +++ b/app/views/poll/other_poll.js.erb @@ -1,6 +1,6 @@ <% if @polls.empty? %> - alert('您目前其他课程无问卷可导入'); + alert('您的其它班级下没有问卷可供导入'); <% else %> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); From 45d8e648404b7d6d5210aeea916e527604104152 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 9 Oct 2016 09:30:20 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9gitlab=20tree=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=B1=BB=E5=9E=8B=EF=BC=88lastrev=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 3 ++- app/models/repository.rb | 4 ++-- app/views/repositories/show.html.erb | 2 +- lib/redmine/scm/adapters/gitlab_adapter.rb | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 08ffca920..e2a3e2d2a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -382,7 +382,8 @@ update if request.xhr? @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) else - @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] + @changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev)) + # @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] # 总的提交数 @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count diff --git a/app/models/repository.rb b/app/models/repository.rb index 305c82f97..c9346e15b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -422,8 +422,8 @@ class Repository < ActiveRecord::Base def load_entries_changesets(entries) if entries entries.each do |entry| - if entry.lastrev && entry.lastrev.identifier - entry.changeset = find_changeset_by_name(entry.lastrev.identifier) + if entry.lastrev + entry.changeset = entry.lastrev end end end diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index a0ae74d73..8b47190e5 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -49,7 +49,7 @@
- <% if @changesets && !@changesets.empty? %> + <% if @changesets_latest_coimmit %> <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> diff --git a/lib/redmine/scm/adapters/gitlab_adapter.rb b/lib/redmine/scm/adapters/gitlab_adapter.rb index 7b2d18310..4aaf8fc91 100644 --- a/lib/redmine/scm/adapters/gitlab_adapter.rb +++ b/lib/redmine/scm/adapters/gitlab_adapter.rb @@ -96,7 +96,7 @@ module Redmine :path => File.join(path,tree.name), :kind => tree.type == 'tree' ? 'dir' : 'file', :size => nil, - :lastrev => nil + :lastrev => tree.commit_id }) end entries.sort_by_name From 57d13975978dd41356a1bcfb601668df4b221a08 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 12 Oct 2016 10:45:14 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=BC=98=E5=8C=96=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 5 +++ app/views/repositories/_dir_list.html.erb | 18 +++++--- .../repositories/_dir_list_content.html.erb | 44 +++++++++++++++---- config/routes.rb | 1 + 4 files changed, 54 insertions(+), 14 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 0b61de198..fe2b7f61f 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -420,6 +420,11 @@ update alias_method :browse, :show + # 获取版本文件目录的 + def tree_head_message + + end + def changes @entry = @repository.entry(@path, @rev) (show_error_not_found; return) unless @entry diff --git a/app/views/repositories/_dir_list.html.erb b/app/views/repositories/_dir_list.html.erb index 384ea36b0..3c446aee0 100644 --- a/app/views/repositories/_dir_list.html.erb +++ b/app/views/repositories/_dir_list.html.erb @@ -1,8 +1,14 @@
- - - -<%= render :partial => 'dir_list_content' %> - -
+ + + <%= render :partial => 'dir_list_content' %> + +
+ + diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index a25d7a94c..928360361 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -4,7 +4,7 @@ <% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %> <% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %> <% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %> - <% latest_changes = get_trees_last_changes(@project.gpid, @rev, ent_path, @g) %> + <%# latest_changes = get_trees_last_changes(@project.gpid, @rev, ent_path, @g) %> @@ -16,7 +16,7 @@ :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev, - :latest_changes => latest_changes, + # :latest_changes => latest_changes, :depth => (depth + 1), :parent_id => tr_id)) %>');"> 
<% end %> @@ -26,21 +26,49 @@
-