rkokkelk/siso

View on GitHub
app/views/repositories/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :header do %>
    <%= @repository.title %>
<% end %>

<%= render 'layouts/notifications.html.erb' %>

<% if not @repository.description.blank? %>
  <p class="description">
    <%= @repository.description %>
  </p>
<% end %>

<p>
  <strong><%=translate :repo_created%></strong>
  <%= @repository.created_at.in_time_zone.to_s(:siso_date) %>
</p>

<p>
  <strong><%=translate :repo_deleted%></strong>
  <%= @repository.deleted_at.in_time_zone.to_s(:siso_date) %>
</p>

<table>
  <thead>
    <tr>
      <th><%=translate :repo_file_name%></th>
      <th><%=translate :repo_size%></th>
      <th><%=translate :repo_file_created%></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
  <% if @records.length == 0 %>
    <tr>
      <td><%=translate :repo_no_records%></td><td colspan="3"></td>
    </tr>
  <% else %>
    <% @records.each do |record| %>
      <tr>
        <td>
          <%= link_to record.file_name, {controller: :records, action: :show, id: @repository.token, record_id: record.token}, {class: 'filename'} %>
        </td>
        <td class="center"><%= human_readable_bytes(record.size) %></td>
        <td class="center"><%= record.created_at.to_s(:date_time) %></td>
        <td class="right"><%= button_to('Delete', {controller: :records, action: :delete, id: @repository.token, record_id: record.token}, method: 'delete')%></td>
      </tr>
    <% end %>
  <% end %>
  </tbody>
</table>


<h3><%=translate :repo_file_upload%></h3>
<%= form_tag({controller: :records, action: :create}, method: :put, multipart: true, form_class: 'float_left') do %>
    <%= file_field_tag 'file' %><%= submit_tag translate(:repo_btn_upload) %>
<% end %>

<% content_for :info do %>
<div id="info">
  <%= mail_to '', translate(:repo_btn_share), subject: translate(:share_subject), body: translate(:share_body, :url => request.original_url), class: 'button float_left' %>
  <%= button_to(translate(:repo_btn_delete), {controller: :repositories, action: :delete, id: @repository.token},
                data: { confirm: translate(:repo_btn_delete_confirm)}, method: 'delete', form_class: 'delete  float_right', id: 'delete_btn')%>
  <%= button_to(translate(:repo_btn_audit), {controller: :repositories, action: :audit, id: @repository.token},
                method: 'get', form_class: 'right')%>
  <div id="clear"></div>
</div>
<% end %>