Sha256: 1a9b22c295a0c116e561e077a7ffa2cb184244bafa607b497ed4432c6fd42f80

Contents?: true

Size: 644 Bytes

Versions: 13

Compression:

Stored size: 644 Bytes

Contents

require 'flipper/ui/action'
require 'flipper/ui/decorators/feature'

module Flipper
  module UI
    module Actions
      class BooleanGate < UI::Action
        include FeatureNameFromRoute

        route %r{\A/features/(?<feature_name>.*)/boolean/?\Z}

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

          feature = flipper[feature_name]
          @feature = Decorators::Feature.new(feature)

          if params['action'] == 'Enable'
            feature.enable
          else
            feature.disable
          end

          redirect_to "/features/#{@feature.key}"
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
flipper-ui-1.0.0 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-1.0.0.pre lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.28.3 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.28.2 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.28.1 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.28.0 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.27.1 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.27.0 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.26.2 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.26.0 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.26.0.rc2 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.26.0.rc1 lib/flipper/ui/actions/boolean_gate.rb
flipper-ui-0.25.4 lib/flipper/ui/actions/boolean_gate.rb