Sha256: a249c80f724923a5c017298d6848c9d69a70fe5f6bd31a4f4534c895cbcf244e

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

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

    def index
      promotion_categories = apply_search_to(
        Spree::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 = Spree::PromotionCategory.where(id: params[:id])

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

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
solidus_legacy_promotions-4.4.1 lib/controllers/admin/solidus_admin/promotion_categories_controller.rb
solidus_legacy_promotions-4.4.0 lib/controllers/admin/solidus_admin/promotion_categories_controller.rb
solidus_admin-0.2.0 app/controllers/solidus_admin/promotion_categories_controller.rb