<% content_for :title, 'Users' %> <% content_for :header_left do %> <%= content_tag :h1, 'Users' %> <% end %> <% content_for :header_right do %> <%= admin_new_button User %> <% end %> <%= render partial: 'admin/shared/header' %> <%= content_tag :div, class: 'w-100' do %> <% if @users.any? %> <%= content_tag :div, class: "table-responsive" do %> <%= content_tag :table, class: "table" do %> <%= content_tag :thead do %> <%= content_tag :tr do %> <%= content_tag :th, "ID" %> <%= content_tag :th, "Name" %> <%= content_tag :th, "Email Address" %> <%= content_tag :th, "Roles" %> <%= content_tag :th, "Status" %> <%= content_tag :th, nil, class: "actions" %> <% end %> <% end %> <%= content_tag :tbody do %> <% @users.each do |user| %> <%= content_tag :tr, class: (user.discarded? ? 'deactivated' : '') do %> <%= content_tag :td, user.id %> <%= content_tag :td, user.name %> <%= content_tag :td, user.email %> <%= content_tag :td, user.roles.map { |r| r.name.titleize }.join(", ") %> <%= content_tag :td, user.discarded? ? 'Inactive' : 'Active' %> <%= content_tag :td, class: "actions text-right" do %> <%= admin_edit_button user if user.undiscarded? %> <%= admin_deactivate_button user if user.undiscarded? %> <%= admin_reactivate_button user if user.discarded? %> <%= admin_destroy_button user %> <% end %> <% end %> <% end %> <% end %> <% end %> <% end %> <% else %> <%= content_tag :p, "No users found. #{link_to("Add one.", new_admin_user_path)}" %> <% end %> <% end %>