Class: PinFlags::FeatureTagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PinFlags::FeatureTagsController
- Defined in:
- app/controllers/pin_flags/feature_tags_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/pin_flags/feature_tags_controller.rb', line 38 def create @feature_tag = PinFlags::FeatureTag.new(feature_tag_params) if @feature_tag.save @feature_tags = @paginator = PinFlags::Page.new(@feature_tags, page: @current_page, page_size: PER_PAGE) @feature_tags = @paginator.records handle_success(:create) else render :new, status: :unprocessable_content end end |
#destroy ⇒ Object
59 60 61 62 |
# File 'app/controllers/pin_flags/feature_tags_controller.rb', line 59 def destroy @feature_tag.destroy handle_success(:delete) end |
#index ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/pin_flags/feature_tags_controller.rb', line 14 def index @paginator = PinFlags::Page.new(, page: @current_page, page_size: PER_PAGE) @feature_tags = @paginator.records # Handle overflow (when page number is too high) if @paginator.index > @paginator.pages_count && @paginator.pages_count&.positive? redirect_to (search: @filter_param, enabled: @enabled_param, subscriptions: @subscriptions_param) end end |
#new ⇒ Object
34 35 36 |
# File 'app/controllers/pin_flags/feature_tags_controller.rb', line 34 def new @feature_tag = PinFlags::FeatureTag.new end |
#show ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/pin_flags/feature_tags_controller.rb', line 24 def show @paginator = PinFlags::Page.new(fetch_feature_subscriptions, page: @current_page, page_size: PER_PAGE) @feature_subscriptions = @paginator.records # Handle overflow for feature subscriptions if @paginator.index > @paginator.pages_count && @paginator.pages_count&.positive? redirect_to feature_tag_path(@feature_tag, feature_taggable_type: @feature_taggable_type, filter: @filter_param) end end |
#update ⇒ Object
51 52 53 54 55 56 57 |
# File 'app/controllers/pin_flags/feature_tags_controller.rb', line 51 def update if @feature_tag.update(feature_tag_params) handle_success(:update) else render :index, status: :unprocessable_content end end |