Newer
Older
dmpopidor / app / views / users / admin_grant_permissions.html.erb
<div class="row">
  <div class="col-md-12">
    <h1><%= _('Edit User Privileges') %></h1>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <%= form_tag( admin_update_permissions_user_path(@user), method: :put) do %>
    <div class="table-responsive">
      <table class="table tablesorter table-hover table-striped">
        <thead>
          <tr>
            <th><%= _('Name') %></th>
          
            <% @perms.each do |perm| %>
              <% case perm.name when 'grant_permissions' %>
                <th data-toggle="tooltip" title="<%= _('Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves') %>">
                  <%= _('Grant permissions') %>
                </th>
              <% when 'modify_templates' %>
                <th data-toggle="tooltip" title="<%= _('Allows the user to create new institutional templates, edit existing ones and customise funder templates') %>">
                  <%= _('Modify templates') %>
                </th>
              <% when 'modify_guidance' %>
                <th data-toggle="tooltip" title="<%= _('Allows the user to create and edit guidance') %>">
                  <%= _('Modify guidance') %>
                </th>
              <% when 'use_api' %>
                <th data-toggle="tooltip" title="<%= _('Provides the user with an API token and grants rights to harvest information from the tool') %>">
                  <%= _('API rights') %>
                </th>
              <% when 'change_org_details' %>
                <th data-toggle="tooltip" title="<%= _('Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo') %>">
                  <%= _('Change organisation details') %>
                </th>
              <% end %>
            <% end %>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><%= @user.name(false) %></td>
            <% @perms.each do |perm| %>
              <td class="text-center"><%= check_box_tag "perm_ids[]", perm.id, @user.perms.include?(perm) %></td>
            <% end %>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="form-group">
      <%= submit_tag _('Save'), class: 'btn btn-primary' %>
    </div>
    <% end %>
  </div>
</div>