Newer
Older
dmpopidor / app / views / branded / paginable / plans / _administrator_visible.html.erb
      <div class="table-responsive">
        <table class="table table-hover" id="my-plans">
          <thead>
            <tr>
              <th scope="col"><%= _('Project Title') %>&nbsp;<%= paginable_sort_link('plans.title') %></th>
              <th scope="col"><%= _('Template') %>&nbsp;<%= paginable_sort_link('templates.title') %></th>
              <th scope="col"><%= _('Edited') %>&nbsp;<%= paginable_sort_link('plans.updated_at') %></th>
              <th scope="col"><%= _('Role') %></th>
              <th scope="col"><%= _('Owner') %></th>
              <th scope="col" class="text-center sorter-false"><%= _('Test') %></th>
              <th scope="col"><%= _('Visibility') %></th>
              <th scope="col"><%= _('Shared') %></th>
              <th scope="col" class="sorter-false">
                <span aria-hidden="false" class="sr-only"><%= _('Actions') %></span>
              </th>
            </tr>
          </thead>
          <tbody>
            <% scope.each do |plan| %>
              <tr id="<%= dom_id(plan) %>">
                <td>
                  <%= link_to "#{plan.title.length > 60 ? "#{plan.title[0..59]} ..." : plan.title}",
                      plan_path(plan) %>
                </td>
                <td><%= plan.template.title %></td>
                <td><%= l(plan.updated_at.to_date, formats: :short) %></td>
                <td><%= display_role(plan.roles.find_by(user: current_user)) %></td>
                <td><%= display_owner(plan.owner) %></td>
                <td class="text-center">
                  <% if plan.administerable_by?(current_user.id) then %>
                    <%= form_for plan, url: set_test_plan_path(plan), html: { method: :post, class: 'set_test_plan', remote: true } do |f| %>
                      <%= check_box_tag(:is_test, "1", (plan.visibility === 'is_test')) %>
                      <%= f.submit(_('Update'), style: 'display:none') %>
                    <% end %>
                  <% else %>
                    <%= plan.visibility === 'is_test' ? _('Yes') : _('No') %>
                  <% end %>
                </td>
                <td class="plan-visibility">
                  <%= plan.visibility === 'is_test' ? _('N/A') : sanitize(display_visibility(plan.visibility)) %>
                </td>
                <td>
                  <% if plan.shared? %>
                    <%= _("Yes") %>
                  <% else %>
                    <%= _('No') %>
                  <% end  %>
                </td>
                <td>
                  <div class="dropdown">
                    <button class="btn btn-link dropdown-toggle" type="button"
                            id="plan-<%= plan.id %>-actions" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="true">
                      <%= _('Actions') %><span class="caret"></span>
                    </button>

                    <ul class="dropdown-menu" aria-labelledby="plan-<%= plan.id %>-actions">
                    <% if plan.editable_by?(current_user.id) then %>
                      <li><%= link_to _('Edit'), plan_path(plan) %></li>
                      
                      <% if plan.administerable_by?(current_user.id) %>
                        <li><%= link_to _('Share'), share_plan_path(plan) %></li>
                      <% end %>

                      <li><%= link_to _('Download'), download_plan_path(plan) %></li>
                      <li><%= link_to(_('Copy'), duplicate_plan_path(plan), data: { method: :post }) %></li>
                    <% else %>
                      <li><%= link_to _('View'), plan_path(plan) %></li>
                      
                      <% if !plan.reviewable_by?(current_user.id) %>
                        <li><%= link_to _('Download'), download_plan_path(plan) %></li>
                      <% end %>
                    <% end %>
                    <% role = plan.roles.where(user_id: current_user.id).first %>
                    <% conf = (role.creator? && plan.publicly_visible?) ? _("Are you sure you wish to remove this public plan? This will remove it from the Public DMPs page but any collaborators will still be able to access it.") : _("Are you sure you wish to remove this plan? Any collaborators will still be able to access it.") %>
                    <li><%= link_to _('Remove'), deactivate_role_path(role), 'data-method': 'put', rel: 'nofollow', 'data-confirm': conf %></li>
                  </ul>
                </div>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>