Files
Brenda Wallace 85b5ff9ecd Add feature flags, with job ideas as the first
Admins switch features on and off at /admin/features, kept in Flipper.
Job ideas (the page, the banners and the overlay) only show while its
flag is on. Features are off until switched on.

Closes #5050
2026-10-24 18:01:56 +13:00

20 lines
589 B
Ruby

# frozen_string_literal: true
module Admin
# The features admins can switch on and off for everyone.
class FeaturesController < ApplicationController
before_action :authenticate_member!
before_action { authorize! :manage, :all }
def index
@features = Feature.all
end
def update
feature = Feature.find(params[:id])
feature.enabled = ActiveModel::Type::Boolean.new.cast(params[:enabled])
redirect_to admin_features_path, notice: t(".#{feature.enabled? ? 'on' : 'off'}", feature: t("admin.features.names.#{feature.name}"))
end
end
end