diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 8a1b3bbe0..0acf75c62 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -215,11 +215,11 @@ update end end - unless @repository.gitlab? - # redirect_to to_gitlab_project_repository_path(@project, @repository) - render :to_gitlab - return - end + # unless @repository.gitlab? + # # redirect_to to_gitlab_project_repository_path(@project, @repository) + # render :to_gitlab + # return + # end #if( !User.current.member_of?(@project) || @project.hidden_repo) @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? @@ -252,11 +252,10 @@ update project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT ip = RepositoriesHelper::REPO_IP_ADDRESS gitlab_address = Redmine::Configuration['gitlab_address'] - if @repository.type.to_s=="Repository::Gitlab" + if @repository.type.to_s == "Repository::Gitlab" @repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@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 + @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 if @course_tag == 1 render :action => 'show', :layout => 'base_courses' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 84364b4f6..01b126c26 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -609,6 +609,12 @@ module ApplicationHelper return @result end + # 判断版本库是否初始为gitlab + def rep_is_gitlab?(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + return rep.blank? ? true :false + end + # 判断当前用户是否为项目管理员 def is_project_manager?(user_id, project_id) @result = false diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 41f25d1a3..48766813c 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -117,6 +117,22 @@ module ProjectsHelper end end + # 获取新增gitlab版本库 + def rep_gitlab(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab") + end + + # 获取新项目的版本库地址 + def rep_gitlab_url(project) + gitlab_address = Redmine::Configuration['gitlab_address'] + url = gitlab_address.to_s+"/"+project.owner.to_s+"/"+project.identifier+"."+"git" + end + + # # 获取Forge历史版本库 + def rep_forge(project) + rep = Repository.where("project_id =? and type =?", project, "Repository::Git") + end + # Added by young def course_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 1770291f5..67867ffbf 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -41,8 +41,15 @@ <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <% if visible_repository?(@project) %>
<%= l(:field_identifier) %> | -<%= l(:field_repository_is_default) %> | -<%= l(:label_scm) %> | -<%= l(:label_repository_path) %> | -- | - |
- <%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %> | -<%= checked_image repository.is_default? %> | -<%=h repository.scm_name %> | + <% rep_forge(@project).sort.each do |repository| %> +|||
+ <%= repository.identifier %> | +<%=h repository.scm_name %> | <%if repository.scm_name=="Git"%> - + <%else %> - + <% end %> -- <% if repository.scm_name=="Git"%> - <%if User.current.allowed_to?(:manage_repository, @project) %> - <%= link_to(l(:label_user_plural), committers_repository_path(repository)) %> - <% end %> - <% end %> - | -- <% if repository.login.to_s==User.current.login.to_s %> - <%= delete_new_link repository_path(repository) %> - <% end %> |
<%= l(:label_repository_no_data) %>
+温馨提示:<%= l(:label_repository_no_data) %>
<% end %> -<%# 新建版本库 %> -<% if @project.repositories.count == 0 %> - - - <% course_tag = @project.project_type %> - <% if User.current.allowed_to?(:manage_repository, @project) %> - - <%= link_to l(:label_repository_new_repos),"#" , :onclick=>"pro_st_show_ku();", :class => 'c_blue fl' %> - <% end %> - - - <%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %> -<%= l(:field_identifier) %> | +<%= l(:field_repository_is_default) %> | +<%= l(:label_scm) %> | +<%= l(:label_repository_path) %> | ++ | + |
+ <%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %> | +<%= checked_image repository.is_default? %> | +<%=h repository.scm_name %> | + <%if repository.scm_name=="Git"%> + + <%else %> + + <% end %> ++ <% if repository.scm_name=="Git"%> + <%if User.current.allowed_to?(:manage_repository, @project) %> + <%= link_to(l(:label_user_plural), committers_repository_path(repository)) %> + <% end %> + <% end %> + | ++ <% if repository.login.to_s==User.current.login.to_s %> + <%= delete_new_link repository_path(repository) %> + <% end %> | +
<%= l(:field_identifier) %> | +<%= l(:label_scm) %> | +<%= l(:label_repository_path) %> | +
+ <%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %> + | +<%=h repository.scm_name %> | + <%if repository.scm_name=="Gitlab"%> + + <%else %> + + <% end %> +