unepwcmc/SAPI

View on GitHub
app/views/admin/ec_srgs/_list.html.erb

Summary

Maintainability
Test Coverage
<thead>
  <th>Name</th>
  <th>Effective from</th>
  <th>URL</th>
  <th>No of listing changes</th>
  <th>Documents</th>
  <th width="10%">Actions</th>
</thead>
<tbody>
  <% collection.each do |ec_srg| -%>
    <tr class="<%= if ec_srg.is_current? then "current_listing" end %>">
      <td>
        <a href="#" class="editable editable-click editable-required"
          data-type="text" data-resource="ec_srg" data-name="name"
          data-placeholder="Required" data-original-title="Enter the European Commission's SRG name"
          data-url="<%= resource_url(ec_srg) %>" data-pk="<%= ec_srg.id %>">
          <%= ec_srg.name %>
        </a>
      </td>
      <td><%= ec_srg.effective_at_formatted %></td>
      <td>
        <%= link_to_unless(
          ec_srg.url.blank?,
          '<i class="icon-share" title="Go to URL"></i>'.html_safe,
          ec_srg.url
        ) { '' } %>
        <%= link_to_unless(
          ec_srg.multilingual_url.blank?,
          '<i class="icon-share" title="Go to multilingual URL"></i>'.html_safe,
          ec_srg.multilingual_url
        ) { '' } %>
        <%= link_to_unless(
          ec_srg.private_url.blank?,
          '<i class="icon-share" title="Go to private URL"></i>'.html_safe,
          ec_srg.private_url
        ) { '' } %>
      </td>
      <td>
        <%= ec_srg.eu_opinions.count %>
      </td>
      <td>
        <%= link_to ec_srg.documents.count, admin_event_documents_path(ec_srg) %>
      </td>
      <td>
        <%= link_to edit_icon, edit_resource_url(ec_srg), :remote => true %>
        <%= link_to delete_icon, resource_url(ec_srg),
          data: { confirm: "Warning: you are about to delete data. Are you sure?" }, :method => :delete
        %>
      </td>
    </tr>
  <% end -%>
</tbody>