docbrown/app/models/extension.rb
Ridhwana 74a16beacb
Introduce "extensions" (#16840)
* feat: add the feature flag route and controller

* feat: add a ff page

* feat: update to a post with a success banner

* feat: test the feature

* feat: update the styling

* feat: change feature flag to extension witha  few more improvements like adding a model not backed by a table

* feat: update the text

* refactor: if you enable a FF, it gets added under the hood as well

* feat: accessibility name for label

* use keyword args

* use locales

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update config/locales/controllers/admin/fr.yml

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/controllers/admin/extensions_controller.rb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* fix: rubucop

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-18 11:22:17 +02:00

16 lines
409 B
Ruby

# This "model" is not backed by the database. Its main purpose is to
# setup and provide methods to interact with Extensions.
Extension = Struct.new(:name, :description, :feature_flag_name, keyword_init: true) do
def enabled?
FeatureFlag.enabled?(feature_flag_name)
end
def enable
FeatureFlag.enable(feature_flag_name)
end
def disable
FeatureFlag.disable(feature_flag_name)
end
end