diff --git a/app/assets/stylesheets/internal/layout.scss b/app/assets/stylesheets/internal/layout.scss index 1f9da0b7d..ef971cb4b 100644 --- a/app/assets/stylesheets/internal/layout.scss +++ b/app/assets/stylesheets/internal/layout.scss @@ -97,3 +97,16 @@ body { display: flex; justify-content: space-between; } + +#profileFields .card-header { + cursor: pointer; +} + +.profile__group-toggle { + text-decoration: underline; + cursor: pointer; + font-size: 12px; + color: grey; + margin: 1em 0; + text-align: end; +} diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index 70ba11919..35ed8df09 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -6,32 +6,32 @@ module Admin # This is used in app/views/admin/shared/_navbar.html.erb to build the # side navbar in alphabetical order. MENU_ITEMS = [ - { name: "articles", controller: "articles" }, - { name: "broadcasts", controller: "broadcasts" }, - { name: "badges", controller: "badges" }, - { name: "chat_channels", controller: "chat_channels" }, - { name: "comments", controller: "comments" }, - { name: "config", controller: "config" }, - { name: "events", controller: "events" }, - { name: "growth", controller: "growth" }, - { name: "listings", controller: "listings" }, - { name: "moderator_actions", controller: "moderator_actions" }, - { name: "mods", controller: "mods" }, - { name: "privileged_reactions", controller: "privileged_reactions" }, - { name: "organizations", controller: "organizations" }, - { name: "pages", controller: "pages" }, - { name: "permissions", controller: "permissions" }, - { name: "podcasts", controller: "podcasts" }, - { name: "profile setup", controller: "profile_fields" }, - { name: "reports", controller: "reports" }, - { name: "response_templates", controller: "response_templates" }, - { name: "sponsorships", controller: "sponsorships" }, - { name: "tags", controller: "tags" }, - { name: "tools", controller: "tools" }, - { name: "users", controller: "users" }, - { name: "vault secrets", controller: "secrets" }, - { name: "webhooks", controller: "webhook_endpoints" }, - { name: "welcome", controller: "welcome" }, + { name: "articles", controller: "articles" }, + { name: "broadcasts", controller: "broadcasts" }, + { name: "badges", controller: "badges" }, + { name: "chat_channels", controller: "chat_channels" }, + { name: "comments", controller: "comments" }, + { name: "config", controller: "config" }, + { name: "events", controller: "events" }, + { name: "growth", controller: "growth" }, + { name: "listings", controller: "listings" }, + { name: "moderator_actions", controller: "moderator_actions" }, + { name: "mods", controller: "mods" }, + { name: "privileged_reactions", controller: "privileged_reactions" }, + { name: "organizations", controller: "organizations" }, + { name: "pages", controller: "pages" }, + { name: "permissions", controller: "permissions" }, + { name: "podcasts", controller: "podcasts" }, + { name: "config: profile setup", controller: "profile_fields" }, + { name: "reports", controller: "reports" }, + { name: "response_templates", controller: "response_templates" }, + { name: "sponsorships", controller: "sponsorships" }, + { name: "tags", controller: "tags" }, + { name: "tools", controller: "tools" }, + { name: "users", controller: "users" }, + { name: "vault secrets", controller: "secrets" }, + { name: "webhooks", controller: "webhook_endpoints" }, + { name: "welcome", controller: "welcome" }, ].sort_by { |menu_item| menu_item[:name] }.freeze private diff --git a/app/controllers/admin/profile_fields_controller.rb b/app/controllers/admin/profile_fields_controller.rb index 05705c043..b21ec5e0d 100644 --- a/app/controllers/admin/profile_fields_controller.rb +++ b/app/controllers/admin/profile_fields_controller.rb @@ -6,7 +6,7 @@ module Admin layout "admin" def index - @profile_fields = ProfileField.all.group_by(&:group) + @grouped_profile_fields = ProfileField.all.group_by(&:group) end def update diff --git a/app/models/profile_field.rb b/app/models/profile_field.rb index 50a4445d4..40fa5ee30 100644 --- a/app/models/profile_field.rb +++ b/app/models/profile_field.rb @@ -19,6 +19,7 @@ class ProfileField < ApplicationRecord validates :label, presence: true, uniqueness: { case_sensitive: false } validates :attribute_name, presence: true, on: :update validates :show_in_onboarding, inclusion: { in: [true, false] } + validates :group, presence: true def type return :boolean if check_box? diff --git a/app/views/admin/profile_fields/_form.html.erb b/app/views/admin/profile_fields/_form.html.erb index 89a77999c..14d64e70f 100644 --- a/app/views/admin/profile_fields/_form.html.erb +++ b/app/views/admin/profile_fields/_form.html.erb @@ -1,7 +1,3 @@ -