Sha256: 1f5406df29a5af7029a0de6eff9a06773b7ed5bd171addc98fe48632c3400f3f
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require 'flipper/ui/action' require 'flipper/ui/decorators/feature' module Flipper module UI module Actions class GroupsGate < UI::Action route %r{features/[^/]*/groups/?\Z} def get feature_name = Rack::Utils.unescape(request.path.split('/')[-2]) feature = flipper[feature_name.to_sym] @feature = Decorators::Feature.new(feature) breadcrumb "Home", "/" breadcrumb "Features", "/features" breadcrumb @feature.key, "/features/#{@feature.key}" breadcrumb "Add Group" view_response :add_group end def post feature_name = Rack::Utils.unescape(request.path.split('/')[-2]) feature = flipper[feature_name.to_sym] value = params["value"].to_s.strip case params["operation"] when "enable" feature.enable_group value when "disable" feature.disable_group value end redirect_to("/features/#{feature.key}") rescue Flipper::GroupNotRegistered => e error = Rack::Utils.escape("The group named #{value.inspect} has not been registered.") redirect_to("/features/#{feature.key}/groups?error=#{error}") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flipper-ui-0.10.2 | lib/flipper/ui/actions/groups_gate.rb |