Class: Flipper::UI::Actions::Feature

Inherits:
Flipper::UI::Action show all
Includes:
FeatureNameFromRoute
Defined in:
lib/flipper/ui/actions/feature.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

#flipper, #request

Instance Method Summary collapse

Methods inherited from Flipper::UI::Action

#bootstrap_css, #bootstrap_js, #breadcrumb, #csrf_input_tag, #halt, #header, #initialize, #jquery_js, #json_response, #popper_js, public_path, #public_path, #read_only, #redirect_to, #request_method_name, route, route_match?, route_regex, #run, run, #run_other_action, #script_name, #status, #valid_request_method?, #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

#deleteObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/flipper/ui/actions/feature.rb', line 27

def delete
  read_only if Flipper::UI.configuration.read_only

  unless Flipper::UI.configuration.feature_removal_enabled
    status 403

    breadcrumb 'Home', '/'
    breadcrumb 'Features', '/features'

    halt view_response(:feature_removal_disabled)
  end

  feature = flipper[feature_name]
  feature.remove
  redirect_to '/features'
end

#getObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/flipper/ui/actions/feature.rb', line 12

def get
  flipper_feature = flipper[feature_name]
  @feature = Decorators::Feature.new(flipper_feature)
  descriptions = Flipper::UI.configuration.descriptions_source.call([flipper_feature.key])
  @feature.description = descriptions[@feature.key]
  @page_title = "#{@feature.key} // Features"
  @percentages = [0, 1, 5, 10, 25, 50, 100]

  breadcrumb 'Home', '/'
  breadcrumb 'Features', '/features'
  breadcrumb @feature.key

  view_response :feature
end