socialforge/app/views/projects/settings/_new_repositories.html.erb

88 lines
3.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="pro_new_prompt ml15 mr15 mb10"><p>温馨提示:每个项目只能创建一个版本库</p></div>
<% if @gitlab_repository.nil? %>
<div class="sy_new_tchbox clear">
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project), :html => {:id => 'repository-form', :method=>"post", :autocomplete => 'off'} do |f| %>
<ul class="pro_newsetting_con mb15">
<li style="display: none">
<label class="label02"><%=l(:label_scm)%></label>
<%= select_tag('repository_scm', options_for_select(["Git"],@repository.class.name.demodulize), :data => {:remote => true, :method => 'get'}) %>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<li>
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class=" fl"><span class="c_red f12">*</span>&nbsp;版本库名称&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %>
<span style="display: none" class="c_orange ml100" id="valid_repository_name">版本库名是无效的</span>
</li>
<li class="clear">
<label class=" fl">&nbsp;&nbsp;</label>
<p class=" fl c_grey pro_new_grey">1.长度必须在1到254个字符之间<br/>
2.仅限使用小写字母a-z、数字、破折号-和下划线_<br>
3.一旦保存,标识无法修改</p>
</li>
</ul>
<a href="javascript:void(0)" onclick="cancel_for_create();" class="fr sy_btn_grey"><%=l(:button_cancel)%></a>
<a href="javascript:void(0)" onclick="project_repository_commit();" class="fr sy_btn_blue mr5"><%=l(:lable_project_rep_create) %></a>
<% end %>
</div>
<% else %>
<div class=" clear ml15 mr15" >
<table class="sy_new_table clear mb15" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="w130 pl10 pr10 hidden fl">版本库名</th>
<th class="w90 pr10 hidden fl">管理系统</th>
<th class="w536 hidden fl">库路径</th>
</tr>
</thead>
<tbody>
<tr>
<th class="w130 pl10 pr10 hidden fl"><%= @gitlab_repository.identifier %></th>
<th class="w90 pr10 hidden fl">Git</th>
<th class="w536 hidden fl"><%=h @repos_url %></th>
</tr>
</tbody>
</table>
</div>
<% end %>
<script>
function pro_st_show_ku()
{
$("#pro_st_edit_ku").toggle();
}
function cancel_for_create()
{
$("#project_setting_repository").val('');
}
function project_repository_commit()
{
if(regex_repoistory_name())
{
$("#repository-form").submit();
}
}
function regex_repoistory_name()
{
var name = $.trim($("#project_setting_repository").val());
if(/^[a-zA-Z0-9_\-]*[a-zA-Z_\-]+[a-zA-Z0-9_\-]*$/.test(name))
{
$("#valid_repository_name").hide();
return true;
}
else
{
$("#valid_repository_name").show();
return false;
}
}
</script>