app/views/usman/users/_index.html.erb in usman-0.3.9 vs app/views/usman/users/_index.html.erb in usman-0.3.10
- old
+ new
@@ -7,11 +7,13 @@
<th>Name</th>
<th class="hidden-xs hidden-sm">Username</th>
<th class="hidden-xs hidden-sm">Email</th>
<th class="hidden-xs hidden-sm">Roles</th>
<th>Status</th>
+ <% if display_manage_links? %>
<th style="text-align: center;" colspan="2">Actions</th>
+ <% end %>
</tr>
</thead>
<tbody>
<% @users.each_with_index do |user, i| %>
@@ -70,29 +72,31 @@
<% elsif user.suspended? %>
<span class="ml-5 mt-5 label label-danger">Suspended</span>
<% end %>
</td>
- <td class="action-links" style="width:15%">
+ <% if display_manage_links? %>
+ <td class="action-links" style="width:15%">
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" if user.can_be_edited? %>
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" if user.can_be_edited? && display_edit_links? %>
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if user.can_be_deleted? && (@current_user != user) %>
-
- </td>
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? && user.can_be_deleted? && (@current_user != user) %>
+ </td>
+ <% end %>
- <td class="action-links" style="width:15%">
+ <% if display_edit_links? %>
+ <td class="action-links" style="width:15%">
- <!-- Approve -->
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_user_path(:id =>user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_approved? && (@current_user != user) %>
+ <!-- Approve -->
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_user_path(:id =>user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_approved? && (@current_user != user) %>
- <!-- Mark as Pending -->
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_user_path(:id =>user.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_marked_as_pending? && (@current_user != user) %>
-
- <!-- Suspend -->
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_user_path(:id =>user.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_suspended? && (@current_user != user) %>
-
- </td>
+ <!-- Mark as Pending -->
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_user_path(:id =>user.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_marked_as_pending? && (@current_user != user) %>
+
+ <!-- Suspend -->
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_user_path(:id =>user.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" if user.can_be_suspended? && (@current_user != user) %>
+ </td>
+ <% end %>
</tr>
<% end %>
</tbody>
</table>