Newer
Older
dmpopidor / app / views / templates / admin_template_history.html.erb
@Jimmy Angelakos Jimmy Angelakos on 18 May 2017 2 KB Template versioning update.
<%= stylesheet_link_tag "admin" %>

<h1>
  <%= @template.title %>
</h1>
<div class="div_clear"></div>
<h2>
  <%= _('Template History') %>
</h2>

<div class="div_left">
  <%= raw _('<p>Here you can view previously published versions of your template.  These can no longer be modified.</p>')%>
</div>
<div class="move_2_right">
  <%= link_to _('View all templates'),
      admin_index_template_path,
      class: 'btn btn-primary' %>
</div>

<div class="div_clear"></div>

<!-- List of own templates -->
<% if @templates.length > 0 then %>
  <table id="dmp_table" class="dmp_table tablesorter">
    <thead>
      <tr>
        <th class="dmp_th_medium"><%= _('Title') %></th>
        <th class="dmp_th_small"><%= _('Version') %></th> <!-- TODO: Add this entry into locale/app.pot and any .po file-->
        <th class="dmp_th_small"><%= _('Published') %></th>
        <th class="dmp_th_small"><%= _('Last updated') %></th>
        <td class="dmp_th_small"><%= _('Actions') %></td>
      </tr>
    </thead>
    <tbody>
      <% @templates.each do |org_template| %>
        <tr>
          <td class="dmp_td_medium">
            <%= org_template.title%>
            <% if org_template == @current && !org_template.published%>
              &nbsp;&nbsp;<i class="fa fa-pencil-square-o" aria-hidden="true"></i>&nbsp;&nbsp;<em><%=_('Draft')%></em>
            <% end %>
          </td>
            <td class="dmp_td_small">
              <%= org_template.version %>
            </td>
            <td class="dmp_td_small">
              <%= (org_template.published? ? _('Yes') : _('No')) %>
          </td>
          <td class="dmp_td_small">
            <% last_temp_updated = org_template.updated_at %>
            <% org_template.phases.each do |phase|%>
              <% if org_template.updated_at.to_date < phase.updated_at.to_date %>
                <% last_temp_updated = phase.updated_at %>
              <% end %>
            <% end %>
            <%= l last_temp_updated.to_date, formats: :short %>
          </td>
            <td class="dmp_td_small">
            <%= link_to (org_template == @current ? _('Edit') : _('View')), admin_template_template_path(id: org_template), class: "dmp_table_link"%>
            </td>
         </tr>
        <%end%>
      </tbody>
    </table>

<%end%>