parent
7c3fd54be1
commit
1c45afac89
|
@ -615,6 +615,11 @@ module ApplicationHelper
|
||||||
return rep.blank? ? true :false
|
return rep.blank? ? true :false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 获取单一gitlab项目
|
||||||
|
def gitlab_repository(project)
|
||||||
|
rep = Repository.where("project_id =? and type =?", project.id,"Repository::Gitlab" ).first
|
||||||
|
end
|
||||||
|
|
||||||
# 判断当前用户是否为项目管理员
|
# 判断当前用户是否为项目管理员
|
||||||
def is_project_manager?(user_id, project_id)
|
def is_project_manager?(user_id, project_id)
|
||||||
@result = false
|
@result = false
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<% if rep_is_gitlab?(@project) %>
|
<% if rep_is_gitlab?(@project) %>
|
||||||
<%= link_to l(:project_module_repository), {:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories'}, :class => "f14 c_blue02" %>
|
<%= link_to l(:project_module_repository), {:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories'}, :class => "f14 c_blue02" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id }, :class => "f14 c_blue02" %>
|
<%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
||||||
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %>
|
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %>
|
||||||
|
|
|
@ -7,8 +7,16 @@
|
||||||
<%= str = error_messages_for 'repository' %>
|
<%= str = error_messages_for 'repository' %>
|
||||||
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
|
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
|
||||||
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
|
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
|
||||||
|
<%# 提示 %>
|
||||||
|
<% if @project.repositories.count>1 %>
|
||||||
|
<div class="flash notice">
|
||||||
|
项目管理员您好!近日平台完成了版本库升级,以后每个项目将唯一的对应一个版本库。请您按照以下步骤完成项目版本库的更新:
|
||||||
|
<p>1. 点击下面的"创建版本库按钮",为本项目创建一个新的版本库;</p>
|
||||||
|
<p>2. 从本项目的历史版本库中选择一个您将使用的版本库,将其完整的克隆(clone)到本地,然后推送(push)到新建的版本库(注意不能仅推送代码,否则之前各开发者的提交记录将丢失)。</p>
|
||||||
|
<p>3. 本项目的历史版本库将在您新建版本库的一周内自动隐藏,如果您以后需要这些版本库,请与网站联系,我们将为您提供这些版本库的所有数据。</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<%# 新建版本库 %>
|
<%# 新建版本库 %>
|
||||||
|
|
||||||
<% if @project.repositories.count == 0 || rep_is_gitlab?(@project) %>
|
<% if @project.repositories.count == 0 || rep_is_gitlab?(@project) %>
|
||||||
<div style="padding-bottom: 40px">
|
<div style="padding-bottom: 40px">
|
||||||
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
|
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
|
||||||
|
|
|
@ -7,16 +7,17 @@ namespace :rep_fault do
|
||||||
if project.repositories.count > 0
|
if project.repositories.count > 0
|
||||||
unless Repository.where("project_id =? and type = ?",project, "Repository::Gitlab").blank?
|
unless Repository.where("project_id =? and type = ?",project, "Repository::Gitlab").blank?
|
||||||
project.repositories.each do |repository|
|
project.repositories.each do |repository|
|
||||||
repository.update_attributes(:is_default => false)
|
repository.is_default =1
|
||||||
|
repository.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "update ossean's data"
|
# desc "update ossean's data"
|
||||||
task :update_type => :environment do
|
# task :update_type => :environment do
|
||||||
repository = Repository.find(400)
|
# repository = Repository.find(400)
|
||||||
repository.update_attributes(:type => "Repository::Git")
|
# repository.update_attributes(:type => "Repository::Git")
|
||||||
end
|
# end
|
||||||
end
|
end
|
Loading…
Reference in New Issue