Sha256: dc7fbfb42cc5f6b67af063044a3306014265302c51671105c3aeeba5a7e7cc79

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

module Dhatu
	class ResourceController < ApplicationController

		include ResourceHelper

	  before_action :configure_resource_controller
    before_action :require_read_permission, only: [:index, :show]
    before_action :require_create_permission, only: [:create]
    before_action :require_update_permission, only: [:update, :update_status, :mark_as_featured, :remove_from_featured]
    before_action :require_delete_permission, only: [:destroy]

    def get_category_filters(category_type)
      if params[:ct].to_s == "-1"
        @category = Dhatu::Category.new(id: -1, name: "None")
      elsif params[:ct]
        @category = Dhatu::Category.find_by_id(params[:ct])
      end
      @categories = Dhatu::Category.where(category_type: category_type).order("priority ASC, name ASC").all
    end

    def configure_filter_param_mapping
      @filter_param_mapping = default_filter_param_mapping
      @filter_param_mapping[:promotion] = :pr
      @filter_param_mapping[:category] = :ct
      @filter_param_mapping[:category_type] = :ctype
      @filter_param_mapping[:feature] = :ft
      @filter_param_mapping[:featured] = :featured
      @filter_param_mapping[:manufacturer] = :mf
    end

	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dhatu-0.3.9.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.8.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.7.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.6.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.5.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.4.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.3.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.2.pre.materialize app/controllers/dhatu/resource_controller.rb
dhatu-0.3.1.pre.materialize app/controllers/dhatu/resource_controller.rb