docbrown/app/controllers/admin/application_controller.rb
Julianna Tetreault 807e11b80c
Provide "Help" on the Creator Onboarding Setup Page (#15308)
* Adds a help icon to the creator settings setup page

* Moves the help icon styles from the a tag to the inline_svg_tag

* Removes reused class and aligns help icon to the right

* Refactors help icon out into a partial used across necessary views

* Moves .admin-help-button class from admin.scss to scaffolds.scss

* Adds further utility classes to align help icon as expected
2021-11-11 08:42:56 -07:00

40 lines
1.8 KiB
Ruby

module Admin
class ApplicationController < ApplicationController
before_action :authorize_admin
before_action :assign_help_url
after_action :verify_authorized
HELP_URLS = {
articles: "https://admin.forem.com/docs/forem-basics/posts",
badges: "https://admin.forem.com/docs/forem-basics/badges",
badge_achievements: "https://admin.forem.com/docs/forem-basics/badges",
chat_channels: "https://admin.forem.com/docs/advanced-customization/chat-channels",
display_ads: "https://admin.forem.com/docs/advanced-customization/display-ads",
feedback_messages: "https://admin.forem.com/docs/advanced-customization/reports",
html_variants: "https://admin.forem.com/docs/advanced-customization/html-variants",
navigation_links: "https://admin.forem.com/docs/advanced-customization/navigation-links",
organizations: "https://admin.forem.com/docs/managing-your-community/organization-pages",
pages: "https://admin.forem.com/docs/forem-basics/pages",
permissions: "https://admin.forem.com/docs/forem-basics/user-roles",
podcasts: "https://admin.forem.com/docs/advanced-customization/content-manager/podcasts",
settings: "https://admin.forem.com/docs/advanced-customization/config",
tags: "https://admin.forem.com/docs/forem-basics/tags",
users: "https://admin.forem.com/docs/forem-basics/user-roles",
creator_settings: "https://admin.forem.com/docs/getting-started/first-user-registration"
}.freeze
protected
def authorization_resource
self.class.name.sub("Admin::", "").sub("Controller", "").singularize.constantize
end
def authorize_admin
authorize(authorization_resource, :access?, policy_class: InternalPolicy)
end
def assign_help_url
@help_url = HELP_URLS[controller_name.to_sym]
end
end
end