Module: Flipper::UI

Defined in:
lib/flipper/ui.rb,
lib/flipper/ui/util.rb,
lib/flipper/ui/actor.rb,
lib/flipper/ui/error.rb,
lib/flipper/ui/eruby.rb,
lib/flipper/ui/action.rb,
lib/flipper/ui/middleware.rb,
lib/flipper/ui/actions/file.rb,
lib/flipper/ui/actions/gate.rb,
lib/flipper/ui/actions/home.rb,
lib/flipper/ui/actions/feature.rb,
lib/flipper/ui/decorators/gate.rb,
lib/flipper/ui/actions/features.rb,
lib/flipper/ui/action_collection.rb,
lib/flipper/ui/decorators/feature.rb,
lib/flipper/ui/actions/actors_gate.rb,
lib/flipper/ui/actions/add_feature.rb,
lib/flipper/ui/actions/groups_gate.rb,
lib/flipper/ui/actions/boolean_gate.rb,
lib/flipper/ui/actions/percentage_of_time_gate.rb,
lib/flipper/ui/actions/percentage_of_actors_gate.rb

Defined Under Namespace

Modules: Actions, Decorators, Util Classes: Action, ActionCollection, Actor, Eruby, Middleware

Constant Summary collapse

Error =

All flipper ui errors inherit from this.

Class.new(StandardError)
RequestMethodNotSupported =

Raised when a request method (get, post, etc.) is called for an action that does not know how to handle it.

Class.new(Error)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.application_breadcrumb_hrefObject

Public: If you set this, the UI will always have a first breadcrumb that says “App” which points to this href. The href can be a path (ie: “/”) or full url (“app.example.com/”).



23
24
25
# File 'lib/flipper/ui.rb', line 23

def application_breadcrumb_href
  @application_breadcrumb_href
end

.feature_creation_enabledObject

Public: Is feature creation allowed from the UI? Defaults to true. If set to false, users of the UI cannot create features. All feature creation will need to be done through the conigured flipper instance.



28
29
30
# File 'lib/flipper/ui.rb', line 28

def feature_creation_enabled
  @feature_creation_enabled
end

Class Method Details

.app(flipper, options = {}) {|builder| ... } ⇒ Object

Yields:

  • (builder)


37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/flipper/ui.rb', line 37

def self.app(flipper, options = {})
  app = lambda { |env| [200, {'Content-Type' => 'text/html'}, ['']] }
  builder = Rack::Builder.new
  yield builder if block_given?
  builder.use Rack::Protection
  builder.use Rack::Protection::AuthenticityToken
  builder.use Rack::MethodOverride
  builder.use Flipper::Middleware::Memoizer, flipper
  builder.use Middleware, flipper
  builder.run app
  builder
end

.rootObject



33
34
35
# File 'lib/flipper/ui.rb', line 33

def self.root
  @root ||= Pathname(__FILE__).dirname.expand_path.join('ui')
end