Class: Dhatu::ResourceController

Inherits:
ApplicationController show all
Includes:
ResourceHelper
Defined in:
app/controllers/dhatu/resource_controller.rb

Instance Method Summary collapse

Instance Method Details

#configure_filter_param_mappingObject



21
22
23
24
25
26
27
28
# File 'app/controllers/dhatu/resource_controller.rb', line 21

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
end

#get_category_filters(category_type) ⇒ Object



12
13
14
15
16
17
18
19
# File 'app/controllers/dhatu/resource_controller.rb', line 12

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