Commit 6644a5bb authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Add UsersController#show and GroupsController

parent 5956e063
class GroupsController < ApplicationController
......@@ -4,4 +4,8 @@ class UsersController < ApplicationController
def index
@users = User.find :all, '*'
def show
@u = User.find :first, params[:id]
......@@ -2,7 +2,7 @@
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Usermanager
%title UserManager
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag 'application', media: 'all'
%h1 User list
%a.btn.btn-primary{role: 'button', href: new_user_path} Create user
%caption List of users
%th User ID
%th First Name
%th Last Name
%th Primary Group
%th Given name
%th Surame
%th Primary group
%th Groups
%th Status
- @users.each do |u|
%td= link_to, user_path(u)
%td= u.givenname
%td= if u.primary_group.exists?
%td= {|g|}.join(', ')
- if u.primary_group.exists?
= link_to, group_path(u.primary_group)
%td!= {|g| link_to, group_path(g)}.join(', ')
%td{class: ? 'table-success' : 'table-warning'}
%span{class: [:fas, ? 'fa-check' : 'fa-lock'], aria: {hidden: :true}, title: ? 'Enabled' : 'Disabled'} ? 'Enabled' : 'Disabled'
%h1 User details
%a.btn.btn-danger{role: 'button'} Disable user
%a.btn.btn-primary{role: 'button'} Change group(s)
%td User ID
%td Given name
%td= @u.givenname
%td Surname
%td Status
%td{class: ? 'table-success' : 'table-warning'}
%span{class: [:fas, ? 'fa-check' : 'fa-lock'], aria: {hidden: :true}, title: ? 'Enabled' : 'Disabled'}
= ? 'Enabled' : 'Disabled'
%td Primary group
- if @u.primary_group.exists?
%td= link_to, group_path(@u.primary_group)
- else
%td.table-warning No primary group
%td Groups
%td{class: @u.groups.empty? && 'table-warning'}
- if @u.groups.empty?
No groups
- else
- @u.groups.each do |g|
%li.list-group-item= link_to, group_path(g)
......@@ -3,4 +3,5 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see
resources :users
resources :groups
require 'test_helper'
class GroupsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment