Sha256: aa7f020895370c00e2cdf0884fc60308214032c834579d1376c91f5c99a9d253

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

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

    def index
      properties = apply_search_to(
        Spree::Property.order(created_at: :desc, id: :desc),
        param: :q,
      )

      set_page_and_extract_portion_from(
        properties,
      )

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

    def destroy
      @properties = Spree::Property.where(id: params[:id])

      Spree::Property.transaction do
        @properties.destroy_all
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/controllers/solidus_admin/properties_controller.rb
solidus_admin-0.3.1 app/controllers/solidus_admin/properties_controller.rb
solidus_admin-0.3.0 app/controllers/solidus_admin/properties_controller.rb
solidus_admin-0.2.0 app/controllers/solidus_admin/properties_controller.rb