mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-29 18:28:28 -04:00
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
20 lines
589 B
Ruby
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
|