* feat: add the nested sidebar with some elements * feat: create a tabbed nav item menu * feat: add the tabbed nav_item partial to the views that need tabbed nav items * fix: change variable back * feat: style the sidebar a bit more * chore: add some more styles * feat: add a spec for the nested navigational items * refactor: a more dynamic tabbed admin helper * feat: add some more nav items * fix: controller for reports * refactor: shorthand if statement * chore: add the whitespace back * refactor: rubocop fixes * chore: use any * chore: remove whitespace * refactor: rename the variable * refactor: use a DSL style admin helper * chore: variable renaming and routes * rubocop: fixes * refactor: move files to more apt places * chore: keep overview as it was previously * Update app/views/admin/secrets/index.html.erb Co-authored-by: Michael Kohl <me@citizen428.net> * Update app/views/admin/shared/_tabbed_navbar.erb Co-authored-by: Michael Kohl <me@citizen428.net> * Update app/views/admin/badges/index.html.erb Co-authored-by: Michael Kohl <me@citizen428.net> * chore: disable blocklength * refactor: move the logic to the model instead of in the view * chore: remove get_ prefix * chore: move the request mangling to a helper that finds the controller and scope * Update app/helpers/admin_helper.rb Co-authored-by: rhymes <rhymes@hey.com> * Update app/helpers/admin_helper.rb Co-authored-by: rhymes <rhymes@hey.com> * refactor: Address feedback * oops * oops use tr * feat: update specs * fix: badge achievements Co-authored-by: Michael Kohl <me@citizen428.net> Co-authored-by: rhymes <rhymes@hey.com>
63 lines
2.8 KiB
Ruby
63 lines
2.8 KiB
Ruby
module AdminHelper
|
|
# This is used in app/views/admin/shared/_navbar.html.erb to build the
|
|
# side navbar in alphabetical order.
|
|
# If you add an item before "config", please update the insert call in
|
|
# admin_menu_items below.
|
|
|
|
# @ridhwana to delete these when we move over to new admin layout
|
|
MENU_ITEMS = [
|
|
{ name: "articles", controller: "articles" },
|
|
{ name: "broadcasts", controller: "broadcasts" },
|
|
{ name: "badges", controller: "badges" },
|
|
{ name: "badge_achievements", controller: "badge_achievements" },
|
|
{ name: "chat_channels", controller: "chat_channels" },
|
|
{ name: "comments", controller: "comments" },
|
|
{ name: "config", controller: "config" },
|
|
{ name: "display_ads", controller: "display_ads" },
|
|
{ name: "events", controller: "events" },
|
|
{ name: "html_variants", controller: "html_variants" },
|
|
{ name: "listings", controller: "listings" },
|
|
{ name: "moderator_actions", controller: "moderator_actions" },
|
|
{ name: "mods", controller: "mods" },
|
|
{ name: "navigation_links", controller: "navigation_links" },
|
|
{ name: "privileged_reactions", controller: "privileged_reactions" },
|
|
{ name: "organizations", controller: "organizations" },
|
|
{ name: "pages", controller: "pages" },
|
|
{ name: "permissions", controller: "permissions" },
|
|
{ name: "podcasts", controller: "podcasts" },
|
|
{ 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] }
|
|
|
|
PROFILE_ADMIN = { name: "config: profile setup", controller: "profile_fields" }.freeze
|
|
|
|
TECH_MENU_ITEMS = [
|
|
{ name: "data_update_scripts", controller: "data_update_scripts" },
|
|
].sort_by { |menu_item| menu_item[:name] }
|
|
|
|
def admin_menu_items
|
|
return MENU_ITEMS unless FeatureFlag.enabled?(:profile_admin)
|
|
|
|
MENU_ITEMS.dup.insert(7, PROFILE_ADMIN)
|
|
end
|
|
# @ridhwana end delete
|
|
|
|
def deduced_controller(request)
|
|
request.path.split("/").last
|
|
end
|
|
|
|
def deduced_scope(request)
|
|
request.path.split("/").second_to_last
|
|
end
|
|
|
|
def display_name(group_name)
|
|
group_name.to_s.tr("_", " ").titleize
|
|
end
|
|
end
|