Class: Dhatu::CategoriesController
Instance Method Summary
collapse
#configure_filter_param_mapping, #get_category_filters
Instance Method Details
#choose_category_type ⇒ Object
7
8
|
# File 'app/controllers/dhatu/categories_controller.rb', line 7
def choose_category_type
end
|
#make_parent ⇒ Object
24
25
26
27
28
29
|
# File 'app/controllers/dhatu/categories_controller.rb', line 24
def make_parent
@category = @r_object = Dhatu::Category.find(params[:id])
@category.update_attribute(:parent_id, nil)
get_collections
render_accordingly
end
|
#mark_as_featured ⇒ Object
31
32
33
34
35
|
# File 'app/controllers/dhatu/categories_controller.rb', line 31
def mark_as_featured
@category = @r_object = Dhatu::Category.find(params[:id])
@category.update_attribute(:featured, true) if @category.published?
render_row
end
|
#remove_from_featured ⇒ Object
37
38
39
40
41
|
# File 'app/controllers/dhatu/categories_controller.rb', line 37
def remove_from_featured
@category = @r_object = Dhatu::Category.find(params[:id])
@category.update_attribute(:featured, false) if @category.featured?
render_row
end
|
#update_status ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/dhatu/categories_controller.rb', line 10
def update_status
@category = @r_object = Dhatu::Category.find(params[:id])
case params[:status]
when "unpublished"
@category.unpublish!
when "removed"
@category.remove!
when "published"
@category.publish!
end
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: @r_object.status))
render_row
end
|