* feat: make the sidebar more dynamic * refactor: use the action in the same controller instead of the whole path * feat: remove hardcoded routes * feat: move routes into file * feat: use rails 6 draw for the admin routes * add a helper method * oops: fix super * feat: add the hacky helper methods :( ) * WIP: created different path helpers for the new routes and point the old helpers to the new ones if the FF is toggled * feat: update the module * chore: add new paths * feat: change link_to's use paths instead * feat: feedback_messages to scoped admin route * chore: update the feature flag urls helpers * feat: feedback_messages issue * chore: remove all the workarounds * chore: rubucop * fix: oops remove helper * chore: comment out the tests that touch the tabbed navbar which is affected by the rails application needing to be reloaded * feat: ensure that we chcek if the db table exists
63 lines
2.7 KiB
Ruby
63 lines
2.7 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("/").fourth
|
|
end
|
|
|
|
def deduced_scope(request)
|
|
request.path.split("/").third
|
|
end
|
|
|
|
def display_name(group_name)
|
|
group_name.to_s.tr("_", " ").titleize
|
|
end
|
|
end
|