socialforge/app/views/shixuns/_settings_repository.html.erb

83 lines
2.9 KiB
Plaintext
Raw Normal View History

2017-03-14 17:25:06 +08:00
<div class="task-pd15-box task-setting-tab">
<div class="alert alert-blue mb15" id="warning_frame">
<button data-dismiss="alert" class="task-close fr" type="button" onclick="close_waring_frame();">×</button>
温馨提示:每个项目只能创建一个版本库。
</div>
2017-03-15 09:40:07 +08:00
<%= error_messages_for 'project' %>
<% if @repository.nil? %>
<div class=" sy_new_tchbox clear" style="margin-left:0; margin-right:0;" >
<%= labelled_form_for :repository, @repository, :url => shixun_repositories_path(@shixun), :html => {:method => "post", :autocomplete => 'off'} do |f| %>
<ul class="pro_newsetting_con mb15" >
<li class="mb10 clear">
<label class=" fl" style="line-height:40px;"><span class="c_red f12">*</span>&nbsp;版本库名称&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :identifier, :no_label => true, :class => "panel-form-width-690 panel-form-height-30 fl", :style => "width:830px;", :id => "shixun_identifier" %>
<span style="display: none" class="c_orange ml100" id="valid_repository_name">版本库名是无效的</span>
</li>
<li class="clear">
<label class=" fl" style="width:100px;">&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="project_repository_commit();" class=" task-btn task-btn-green fr">保存</a>
<a href="javascript:void(0)" onclick="cancel_for_create();" class=" task-btn fr mr10">取消</a>
<% end %>
</div>
<% else %>
<table class="sy_new_table" cellpadding="0" cellspacing="0">
2017-03-03 18:49:56 +08:00
<thead>
<tr>
2017-03-15 09:40:07 +08:00
<th>版本库名</th>
<th>管理系统</th>
<th>库路径</th>
2017-03-03 18:49:56 +08:00
</tr>
</thead>
<tbody>
<tr>
2017-03-15 09:40:07 +08:00
<th><%= @repository.identifier %></th>
<th>Git</th>
2017-03-15 15:15:55 +08:00
<th><%= h @repos_url %></th>
2017-03-03 18:49:56 +08:00
</tr>
</tbody>
</table>
2017-03-15 09:40:07 +08:00
<% end %>
</div>
2017-03-03 18:49:56 +08:00
<script>
function pro_st_show_ku()
{
$("#pro_st_edit_ku").toggle();
}
function cancel_for_create()
{
$("#shixun_identifier").val('');
}
function project_repository_commit()
{
2017-03-13 14:37:39 +08:00
if(regex_repoistory_name())
2017-03-03 18:49:56 +08:00
{
$("#new_repository").submit();
}
}
function regex_repoistory_name()
{
var name = $.trim($("#shixun_identifier").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>