Class: Flipper::UI::Actions::GroupsGate
- Inherits:
-
Flipper::UI::Action
- Object
- Flipper::UI::Action
- Flipper::UI::Actions::GroupsGate
- Includes:
- FeatureNameFromRoute
- Defined in:
- lib/flipper/ui/actions/groups_gate.rb
Constant Summary
Constants inherited from Flipper::UI::Action
Flipper::UI::Action::CONTENT_SECURITY_POLICY, Flipper::UI::Action::SOURCES, Flipper::UI::Action::VALID_REQUEST_METHOD_NAMES
Instance Attribute Summary
Attributes inherited from Flipper::UI::Action
Instance Method Summary collapse
Methods inherited from Flipper::UI::Action
#asset_hash, #bootstrap_css, #bootstrap_js, #csrf_input_tag, #halt, #header, #initialize, #json_response, #popper_js, public_path, #public_path, #read_only?, #redirect_to, #render_read_only, #request_method_name, route, route_match?, route_regex, #run, run, #run_other_action, #script_name, #status, #url_for, #valid_request_method?, #view, #view_response, #view_with_layout, #view_without_layout, #views_path, views_path, #write_allowed?
Constructor Details
This class inherits a constructor from Flipper::UI::Action
Instance Method Details
#get ⇒ Object
12 13 14 15 16 17 |
# File 'lib/flipper/ui/actions/groups_gate.rb', line 12 def get feature = flipper[feature_name] @feature = Decorators::Feature.new(feature) view_response :add_group end |
#post ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/flipper/ui/actions/groups_gate.rb', line 19 def post render_read_only if read_only? feature = flipper[feature_name] value = params['value'].to_s.strip if Flipper.group_exists?(value) case params['operation'] when 'enable' feature.enable_group value when 'disable' feature.disable_group value end redirect_to("/features/#{feature.key}") else error = "The group named #{value.inspect} has not been registered." redirect_to("/features/#{feature.key}/groups?error=#{error}") end end |