Sha256: 7202fa3f541b35f0ed98a9738cf731b5b4fd96498e46296a55201eada9079a31
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
require 'flipper/ui/action' require 'flipper/ui/decorators/feature' module Flipper module UI module Actions class GroupsGate < UI::Action include FeatureNameFromRoute route %r{\A/features/(?<feature_name>.*)/groups/?\Z} def get feature = flipper[feature_name] @feature = Decorators::Feature.new(feature) view_response :add_group end def post render_read_only if read_only? feature = flipper[feature_name] value = params['value'].to_s.strip if Flipper.group_exists?(value) case params['operation'] when 'enable' feature.enable_group value when 'disable' feature.disable_group value end redirect_to("/features/#{feature.key}") else error = "The group named #{value.inspect} has not been registered." redirect_to("/features/#{feature.key}/groups?error=#{error}") end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems