created file sync

This commit is contained in:
Senad Uka
2016-02-21 19:17:04 +01:00
parent 709ce3e38c
commit ac099e3210
18 changed files with 230 additions and 28 deletions

View File

@@ -13,16 +13,16 @@
<% @templates.each do |template| %>
<div class="row template-selection" id="template_<%= template.id %>">
<div class="col-md-2 text-md-center">
<div class="thumbnail">
<div class="col-md-2 text-md-center unclickable">
<div class="thumbnail unclickable">
<%= image_tag(template.safe_icon, size: '128', class:"img-responsive" ) %>
<div class="caption text-md-center">
<h3 class="server-name"><%= template.name %></h3>
<div class="caption text-md-center unclickable">
<h3 class="server-name unclickable"><%= template.name %></h3>
</div>
</div>
</div>
<div class="col-md-10 template-description">
<div class="col-md-10 template-description unclickable">
<%= template.description %>
</div>
</div>
@@ -30,4 +30,5 @@
<%= form_tag(create_from_template_configuration_files_url, method: :post, id: "create_from_template_form") do %>
<%= hidden_field_tag('template_id','', id: 'template_id') %>
<%= hidden_field_tag('server_id', @server.id, id: 'server_id') %>
<% end %>

View File

@@ -1,12 +0,0 @@
<div class="row">
</div>
<div class="row">
<div class="col-md-10">
<div id="editor">
<%= @record.content %>
</div>
</div>
</div>

View File

@@ -0,0 +1,57 @@
<% content_for :javascript_includes do %>
<%= javascript_include_tag "edit_configuration_file_form.js" %>
<% end %>
<div class="row">
<h3><%= @record.file_type %>
file on
<%= @record.server.name %>
</h3>
<div><%= @record.namehash %></div>
<div>Version: v<%= @record.last_version.number %>
(modified
<%= distance_of_time_in_words(@record.last_version.updated_at, Time.now) %>
ago)
</div>
</div>
<div class="row">
<div class="col-md-10">
<% command = pull_command(@record) %>
Type this into your server's console to pull latest saved version<br />
<%= text_field_tag 'command_pull', command, readonly: true, class: 'form-control-sm', size: command.length %>
</div>
</div>
<div class="row">
<div class="col-md-10">
<% command = push_command(@record) %>
Type this into your server's console to push servers version into CHUB<br />
<%= text_field_tag 'command_push', command, readonly: true, class: 'form-control-sm', size: command.length %>
</div>
</div>
<div class="row editor">
<div class="col-md-5">
<div>
<%= text_field_tag 'file_path', @record.file_path, class: 'form-control-sm', id: 'visible_file_path' , size: "100%" %>
<br/>
<br/>
</div>
<div id="editor">
<%= @record.last_version.content %>
</div>
</div>
<br/><br/>
</div>
<div class="row">
<div class="col-md-2">
<%= button_tag(type: "button", class: "btn btn-success", id: "save_button") do %>Save as v<%= @record.last_version.number + 1 %>
<% end %>
</div>
</div>
<%= form_tag(update_by_form_configuration_file_url(@record), method: :put, id: "update_form") do %>
<%= hidden_field_tag('content','', id: 'content') %>
<%= hidden_field_tag('file_path', @record.file_path, id: 'file_path') %>
<% end %>

View File

@@ -25,6 +25,41 @@
<p><%= text_field_tag 'command', command, readonly: true, class: 'form-control-sm', size: command.length %></p>
</div>
<% else %>
<p><%= button_to(new_configuration_file_path, method: :get, params: { server_id: @record.id}, class: "btn btn-success pull-center") do %>
Create New Configuration File
<% end %><br/><br/>
</p>
<table class="table">
<thead>
<tr>
<th>File Path</th>
<th>Version</th>
<th>Last Modified</th>
<th></th>
</tr>
</thead>
<tbody>
<% @record.configuration_files.each do |file| %>
<tr>
<td><%= file.file_path %></td>
<td>v<%= file.last_version.number %></td>
<td><%= distance_of_time_in_words(file.last_version.updated_at, Time.now) %></td>
<td><%= button_to(edit_configuration_file_path(file), method: :get, class: "btn btn-default inline") do %>
Edit
<% end %>
</td>
<td>
<%= button_to(configuration_file_path(file), method: :delete, class: "btn btn-danger inline") do %>
Delete
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>