Skip to content

Commit

Permalink
Fix(Users index): Return to prev. role display. Tests depend on it,
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisma committed Mar 23, 2019
1 parent 41de964 commit e9cd2ba
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@
<td><%= user.email %></td>
<%# https://datatables.net/manual/data/orthogonal-data#HTML-5 %>
<td data-order="<%= user.role %>" data-search="<%= user.role %>">
<% if editable_for user %>
<div role="group"
class="btn-group border rounded
border-<%= if editable_for user then 'primary' else 'secondary' end %>">
<% User.roles.map(&:first).each do |role| %>
<div role="group"
class="btn-group border rounded
border-<%= if editable_for user then 'primary' else 'secondary' end %>">
<% User.roles.map(&:first).each do |role| %>
<% if editable_for user %>
<%= link_to role.capitalize,
update_role_user_path(user, role: role),
id: "btn-#{role}-#{user.id}",
method: :patch,
id: "btn-#{role}-#{user.id}",
class: "btn btn-#{if user.role == role then 'primary' else 'light' end}" %>
<% else %>
<span id= "btn-<%= role %>-<%= user.id %>"
class="btn btn-<%= if user.role == role then 'secondary' else 'light' end %> disabled">
<%= role.capitalize %>
</span>
<% end %>
<% else %>
<%= user.role.capitalize %>
<% end %>
</div>
<td data-order="<%= user.current_sign_in_at.to_i %>">
Expand Down

0 comments on commit e9cd2ba

Please sign in to comment.