Sha256: e23c8663bc4c32c779796e6c5b41c7957bbf851e17eadda5fc2905ccc401875c

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

module SolidusPromotions
  class PromotionCategoriesController < SolidusAdmin::BaseController
    include SolidusAdmin::ControllerHelpers::Search

    def index
      promotion_categories = apply_search_to(
        SolidusPromotions::PromotionCategory.all,
        param: :q
      )

      set_page_and_extract_portion_from(promotion_categories)

      respond_to do |format|
        format.html { render component("promotion_categories/index").new(page: @page) }
      end
    end

    def destroy
      @promotion_categories = SolidusPromotions::PromotionCategory.where(id: params[:id])

      SolidusPromotions::PromotionCategory.transaction { @promotion_categories.destroy_all }

      flash[:notice] = t(".success")
      redirect_back_or_to solidus_promotions.promotion_categories_path, status: :see_other
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_promotions-4.4.0 lib/controllers/admin/solidus_promotions/promotion_categories_controller.rb