client_management/app/views/admin/site_panel/edit_server_info.html.erb

107 lines
4.1 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<% end
delete_domain_button = button_tag("#{t('delete_')} domain", class: 'btn btn-danger',
:onclick=> "delete_domain(this)",
:type => 'button')
%>
<script type="text/javascript">
function add_domain(ele){
var tp=$(ele);
var tp2=tp.parents('.controls').eq(0).find('.group');
var tp3=tp2.find('.domain_name').eq(0).clone();
tp3.val('');
tp2.append('<br>');
tp2.append(tp3);
tp2.append('<%= delete_domain_button %>')
}
function delete_domain(ele){
$(ele).prev('input').remove()
$(ele).prev('br').remove()
$(ele).remove()
}
</script>
<%= form_for @site_server ,:url=>{:action=>"edit_server_info",:type=>'update'},:method=>:post, :html => {:class=>"form-horizontal main-forms"} do |f|%>
<fieldset>
<input type='hidden' name='id' value='<%=@site_server.id.to_s%>'/>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t(:category) %></label>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
<!-- Tag Module -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<%= select_tags(f, @module_app) %>
</div>
<div class="control-group">
<label class="control-label muted" for="server_name">Server name:</label>
<div class="controls">
<% if @site_server.new_record? %>
<%= f.text_field :server_name,{:id=>'server_name'} %>
<% else %>
<span style=" display: inline-block; vertical-align: -webkit-baseline-middle; font-size: 1.5em;"><%= @site_server.server_name %></span>
<% f.hidden_field :server_name,{:id=>'server_name'} %>
<% end%>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="domain_name">Domain name:</label>
<div class="controls">
<div class="group">
<%
tp = @site_server.domain_names
tp << '' if tp.length == 0
tp.each_with_index do |domain_name,i| %>
<%= '<br>'.html_safe if i !=0 %>
<%= text_field_tag "site_server[domain_names][]",domain_name,{:id=>nil,:class=>"domain_name"} %>
<% delete_domain_button if i !=0 %>
<% end %>
</div>
<%= f.button "#{t('add')} domain", class: 'btn btn-info',
:onclick=> "add_domain(this)",
:type => 'button'
%>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="ip">IP:</label>
<div class="controls">
<%= f.text_field :ip,{:id=>'ip'} %>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="account">Account:</label>
<div class="controls">
<%= f.text_field :account,{:id=>'account'} %>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="password">Password:</label>
<div class="controls">
<%= f.text_field :password,{:id=>'password'} %>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
</fieldset>
<% end %>