Files
old-saburly-confighub/web/app/views/configuration_files/update.html.erb
2016-02-21 20:53:35 +01:00

83 lines
2.2 KiB
Plaintext

<% 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 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>
<br />
<div class="row">
<h3>Sync:</h3>
</div>
<div class="row">
<div class="col-md-6">
<% command = pull_command(@record) %>
CHUB -> Your Server<br />
<%= text_field_tag 'command_pull', command, readonly: true, class: 'form-control-sm click-to-select-all', size: command.length %>
</div>
<div class="col-md-6">
<% command = push_command(@record) %>
Your Server -> CHUB<br />
<%= text_field_tag 'command_push', command, readonly: true, class: 'form-control-sm click-to-select-all', size: command.length %>
</div>
</div>
<table class="table">
<thead>
<tr>
<th>Version</th>
<th>Last Modified</th>
<th></th>
</tr>
</thead>
<tbody>
<% @record.file_versions[1..-1].each do |version| %>
<tr>
<td>v<%= version.number %></td>
<td><%= distance_of_time_in_words(version.updated_at, Time.now) %></td>
<td><%= button_to(file_version_path(version), method: :get, class: "btn btn-default inline") do %>
View
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= 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 %>