* Add ProfileField model * Fix schema.rb * Add service objects for base and link fields * feat: show an index of profile fields and allow them to be edited * Fix schema.rb * Add service objects for base and link fields * Add link fields to seeds * Make placeholder a keyword argument * Add work fields * Add explanation column to profile fields * Add coding fields * Switch from inheritance to mixin * Add email checkbox to base fields * Add branding fields * Add spec for ProfileFields::FieldDefinition * chore: moved the migration file * feat: add a create and destroy route * feat: render a partial form * fix: oops form instead of f * Move migration back into correct location * Rename column from explanation to description * Rename attribute in mixin * chore: update classed for buttons * chore: rename from explanation to description * chore: explanation to description * chore: new profie field * fix: only one submit button per form * fix: update the form * fix: remove files that got merged mistakenly * chore: finally, some specs... Co-authored-by: Michael Kohl <citizen428@dev.to>
47 lines
2.2 KiB
Ruby
47 lines
2.2 KiB
Ruby
module Internal
|
|
class ApplicationController < ApplicationController
|
|
before_action :authorize_admin
|
|
after_action :verify_authorized
|
|
|
|
# This is used in app/views/internal/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" },
|
|
].sort_by { |menu_item| menu_item[:name] }.freeze
|
|
|
|
private
|
|
|
|
def authorization_resource
|
|
self.class.name.demodulize.sub("Controller", "").singularize.constantize
|
|
end
|
|
|
|
def authorize_admin
|
|
authorize(authorization_resource, :access?, policy_class: InternalPolicy)
|
|
end
|
|
end
|
|
end
|