Class: Caboose::BlockTypeStoreController

Inherits:
ApplicationController show all
Defined in:
app/controllers/caboose/block_type_store_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#add_ga_event, #admin_add, #admin_bulk_add, #admin_bulk_delete, #admin_bulk_update, #admin_delete, #admin_edit, #admin_json, #admin_json_single, #admin_update, #before_action, #before_before_action, #hashify_query_string, #init_cart, #logged_in?, #logged_in_user, #login_user, #logout_user, #parse_url_params, #reject_param, #under_construction_or_forwarding_domain?, #user_is_allowed, #user_is_allowed_to, #validate_cookie, #validate_token, #var, #verify_logged_in

Instance Method Details

#admin_detailsObject



35
36
37
38
39
# File 'app/controllers/caboose/block_type_store_controller.rb', line 35

def admin_details
  return unless user_is_allowed('blocktypestore', 'add')
  @block_type_summary = BlockTypeSummary::find(params[:block_type_summary_id])
  render :layout => 'caboose/admin'
end

#admin_downloadObject



24
25
26
27
28
29
30
31
32
# File 'app/controllers/caboose/block_type_store_controller.rb', line 24

def admin_download
  return unless user_is_allowed('blocktypestore', 'add')

  bts = BlockTypeSummary::find(params[:block_type_summary_id])
  bts.source.refresh(bts.name)

  resp = StdClass.new('success' => 'The block type has been downloaded successfully.')
  render :json => resp
end

#admin_indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/caboose/block_type_store_controller.rb', line 6

def admin_index
  return unless user_is_allowed('blocktypestore', 'add')
  @pager = PageBarGenerator.new(params, {
		  'block_type_source_id' => '',
		  'name_like'	           => '',
		  'description_like'	   => ''    		  
		},{
		  'model'          => 'Caboose::BlockTypeSummary',
	    'sort'			     => 'block_type_source_id, name',
		  'desc'			     => false,
		  'base_url'		   => '/admin/block-types/store',
		  'use_url_params' => false
	})
	@block_type_summaries = @pager.items
	render :layout => 'caboose/admin'
end