版本库配置默认分支
This commit is contained in:
parent
555a9131c4
commit
a10e973c75
|
@ -409,7 +409,12 @@ class ProjectsController < ApplicationController
|
|||
@repository = Repository.factory(scm)
|
||||
@repository.is_default = @project.repository.nil?
|
||||
@repository.project = @project
|
||||
|
||||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
@gitlab_branches = g.branches(@project.gpid)
|
||||
@branch_names = g.branches(@project.gpid).map{|b| b.name}
|
||||
@gitlab_default_branch = g.project(@project.gpid).default_branch
|
||||
end
|
||||
end
|
||||
|
||||
# 项目邀请用户加入实现过程
|
||||
|
@ -670,8 +675,7 @@ class ProjectsController < ApplicationController
|
|||
# 更新公开私有时同步gitlab公开私有
|
||||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
gproject = g.project(@project.gpid)
|
||||
params[:project][:is_public] ? g.edit_project(gproject.id, 20) : g.edit_project(gproject.id, 0)
|
||||
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
|
||||
end
|
||||
# end
|
||||
if validate_parent_id && @project.save
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
<textarea class="w543" id="project_description" name="project[description]" rows="8" placeholder="最多3000个汉字(或6000个英文字符)"><%= @project.description%></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% if !@project.gpid.nil? && !@gitlab_branches.blank? %>
|
||||
<li>
|
||||
<label class="label02"> 默认分支 :</label>
|
||||
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch' %>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<li >
|
||||
<label class="label02">公开 :</label>
|
||||
<input id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<span class="f14"><span class="c_red">*</span><%=l(:label_repository_name)%>:</span>
|
||||
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
|
||||
<% unless @repository.identifier_frozen? %>
|
||||
<%# unless @repository.identifier_frozen? %>
|
||||
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<!-- Branches Dropdown -->
|
||||
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
|
||||
<%= l(:label_branch) %>:
|
||||
<%= select_tag :branch, options_for_select([''] + @repository.branches, @rev), :id => 'branch' %>
|
||||
<%= select_tag :branch, options_for_select(@repository.branches, @rev), :id => 'branch' %>
|
||||
<% end -%>
|
||||
|
||||
<% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
|
||||
|
|
|
@ -85,8 +85,8 @@ class Gitlab::Client
|
|||
# public (optional) - if true same as setting visibility_level = 20
|
||||
# visibility_level (optional)
|
||||
|
||||
def edit_project(id, visibility_level)
|
||||
put("/projects/#{id}", :body => {:visibility_level => visibility_level})
|
||||
def edit_project(id, visibility_level, default_branch)
|
||||
put("/projects/#{id}", :body => {:visibility_level => visibility_level, :default_branch => default_branch})
|
||||
end
|
||||
|
||||
# Deletes a project.
|
||||
|
|
Loading…
Reference in New Issue