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
Instance Attribute Summary
Attributes inherited from Flipper::UI::Action
Instance Method Summary collapse
Methods inherited from Flipper::UI::Action
#breadcrumb, #csrf_input_tag, #halt, #header, #initialize, #json_response, public_path, #public_path, #redirect_to, regex, #request_method_name, route, #run, run, #run_other_action, #script_name, #status, #view, #view_response, #view_with_layout, #view_without_layout, views_path, #views_path
Constructor Details
This class inherits a constructor from Flipper::UI::Action
Instance Method Details
#get ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/flipper/ui/actions/features.rb', line 12 def get @page_title = "Features" @features = flipper.features.map { |feature| Decorators::Feature.new(feature) }.sort @show_blank_slate = @features.empty? "Home", "/" "Features" view_response :features end |
#post ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/flipper/ui/actions/features.rb', line 26 def post unless Flipper::UI.feature_creation_enabled status 403 "Home", "/" "Features", "/features" "Noooooope" halt view_response(:feature_creation_disabled) end value = params["value"] if Util.blank?(value) error = Rack::Utils.escape("#{value.inspect} is not a valid feature name.") redirect_to("/features/new?error=#{error}") end flipper.adapter.add(flipper[value]) redirect_to "/features/#{Rack::Utils.escape_path(value)}" end |