diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 8b23d5c..227d4a1 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,44 +1,46 @@ class Admin::UsersController < Admin::BaseController # GET /admin/users def index @baculized_host_names = Hash.new { |h, k| h[k] = [] } @non_baculized_host_names = Hash.new { |h, k| h[k] = [] } @unverified_host_names = Hash.new { |h, k| h[k] = [] } @users = User.all.includes(:hosts) + @users = @users.admin if params[:type] == 'admin' + @users = @users.vima if params[:type] == 'vima' @users.each do |user| user.hosts.each do |host| if host.deployed? || host.updated? || host.dispatched? || host.for_removal? @baculized_host_names[user.id] << host.name else @non_baculized_host_names[user.id] << host.name @unverified_host_names[user.id] << host.name if !host.verified? end end end end # PATCH /admin/users/1/ban def ban @user = User.find(params[:id]) if @user.ban flash[:success] = 'User banned' else flash[:error] = 'User NOT banned' end redirect_to admin_users_path end # PATCH /admin/users/1/unban def unban @user = User.find(params[:id]) if @user.unban flash[:success] = 'User enabled' else flash[:error] = 'User NOT enabled' end redirect_to admin_users_path end end diff --git a/app/views/shared/_nav.html.erb b/app/views/shared/_nav.html.erb index dd0e7e5..ca41736 100644 --- a/app/views/shared/_nav.html.erb +++ b/app/views/shared/_nav.html.erb @@ -1,58 +1,73 @@