Class: Flipper::UI::Actions::Features
- Inherits:
-
Flipper::UI::Action
- Object
- Flipper::UI::Action
- Flipper::UI::Actions::Features
- Defined in:
- lib/flipper/ui/actions/features.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
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/flipper/ui/actions/features.rb', line 11 def get @page_title = 'Features' keys = flipper.features.map(&:key) descriptions = if Flipper::UI.configuration.show_feature_description_in_list? Flipper::UI.configuration.descriptions_source.call(keys) else {} end @features = flipper.features.map do |feature| decorated_feature = Decorators::Feature.new(feature) if Flipper::UI.configuration.show_feature_description_in_list? decorated_feature.description = descriptions[feature.key] end decorated_feature end.sort @show_blank_slate = @features.empty? view_response :features end |
#post ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/flipper/ui/actions/features.rb', line 35 def post render_read_only if read_only? unless Flipper::UI.configuration.feature_creation_enabled status 403 halt view_response(:feature_creation_disabled) end value = params['value'].to_s.strip if Util.blank?(value) error = "#{value.inspect} is not a valid feature name." redirect_to("/features/new?error=#{error}") end feature = flipper[value] feature.add redirect_to "/features/#{value}" end |