From 1a2482434cd2e4d495901bf865e7a892d628cb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 23 Feb 2023 21:53:12 +0800 Subject: [PATCH] Rename admin users controller/route Started out as a simple helper page to list LDAP users, but turning into proper user management now. --- .../admin/{ldap_users_controller.rb => users_controller.rb} | 4 ++-- app/helpers/ldap_users_helper.rb | 2 -- app/helpers/users_helper.rb | 2 ++ app/views/admin/{ldap_users => users}/index.html.erb | 4 ++-- app/views/shared/_admin_nav.html.erb | 4 ++-- config/routes.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) rename app/controllers/admin/{ldap_users_controller.rb => users_controller.rb} (80%) delete mode 100644 app/helpers/ldap_users_helper.rb create mode 100644 app/helpers/users_helper.rb rename app/views/admin/{ldap_users => users}/index.html.erb (88%) diff --git a/app/controllers/admin/ldap_users_controller.rb b/app/controllers/admin/users_controller.rb similarity index 80% rename from app/controllers/admin/ldap_users_controller.rb rename to app/controllers/admin/users_controller.rb index 5109041..70a7e1d 100644 --- a/app/controllers/admin/ldap_users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,4 +1,4 @@ -class Admin::LdapUsersController < Admin::BaseController +class Admin::UsersController < Admin::BaseController before_action :set_current_section def index @@ -15,6 +15,6 @@ class Admin::LdapUsersController < Admin::BaseController private def set_current_section - @current_section = :ldap_users + @current_section = :users end end diff --git a/app/helpers/ldap_users_helper.rb b/app/helpers/ldap_users_helper.rb deleted file mode 100644 index 81e2eff..0000000 --- a/app/helpers/ldap_users_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module LdapUsersHelper -end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/views/admin/ldap_users/index.html.erb b/app/views/admin/users/index.html.erb similarity index 88% rename from app/views/admin/ldap_users/index.html.erb rename to app/views/admin/users/index.html.erb index e39bd6f..d78a4af 100644 --- a/app/views/admin/ldap_users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -1,4 +1,4 @@ -<%= render HeaderComponent.new(title: "LDAP Users: #{@ou}") %> +<%= render HeaderComponent.new(title: "Users: #{@ou}") %> <%= render MainSimpleComponent.new do %>
@@ -22,7 +22,7 @@ diff --git a/app/views/shared/_admin_nav.html.erb b/app/views/shared/_admin_nav.html.erb index dd8c8b8..7762431 100644 --- a/app/views/shared/_admin_nav.html.erb +++ b/app/views/shared/_admin_nav.html.erb @@ -1,7 +1,7 @@ <%= link_to "Dashboard", admin_root_path, class: main_nav_class(@current_section, :dashboard) %> -<%= link_to "Users", admin_ldap_users_path, - class: main_nav_class(@current_section, :ldap_users) %> +<%= link_to "Users", admin_users_path, + class: main_nav_class(@current_section, :users) %> <%= link_to "Invitations", admin_invitations_path, class: main_nav_class(@current_section, :invitations) %> <%= link_to "Donations", admin_donations_path, diff --git a/config/routes.rb b/config/routes.rb index 7559393..f86a64b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,7 +39,7 @@ Rails.application.routes.draw do namespace :admin do root to: 'dashboard#index' - get 'ldap_users', to: 'ldap_users#index' + resources 'users', only: ['index'] get 'invitations', to: 'invitations#index' resources :donations get 'lightning', to: 'lightning#index'