Sha256: 16963f00592669343cbe788e042498298e4edbd35c9f8eaca954c7064065aa5d

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

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

module Flipper
  module UI
    module Actions
      class Feature < UI::Action
        route %r{features/[^/]*/?\Z}

        def get
          feature_name = Rack::Utils.unescape(request.path.split('/').last)
          @feature = Decorators::Feature.new(flipper[feature_name])
          @page_title = "#{@feature.key} // Features"
          @percentages = [0, 1, 5, 10, 15, 25, 50, 75, 100]

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

          view_response :feature
        end

        def delete
          unless Flipper::UI.feature_removal_enabled
            status 403

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

            halt view_response(:feature_removal_disabled)
          end

          feature_name = Rack::Utils.unescape(request.path.split('/').last)
          feature = flipper[feature_name]
          feature.remove
          redirect_to '/features'
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flipper-ui-0.14.0 lib/flipper/ui/actions/feature.rb
flipper-ui-0.13.0 lib/flipper/ui/actions/feature.rb
flipper-ui-0.13.0.beta1 lib/flipper/ui/actions/feature.rb
flipper-ui-0.12.2 lib/flipper/ui/actions/feature.rb
flipper-ui-0.12.1 lib/flipper/ui/actions/feature.rb
flipper-ui-0.12.0 lib/flipper/ui/actions/feature.rb