Class: Workarea::Storefront::ContentBlocksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/workarea/storefront/content_blocks_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_layout, #current_user_info, #health_check, #layout_content

Methods included from OrderLookup

#lookup_order, #lookup_order=

Methods included from CurrentCheckout

#clear_current_order, #completed_order, #completed_order=, #current_checkout, #current_order, #current_order=, #current_shipping, #current_shippings, #logout

Instance Method Details

#draftObject



26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/workarea/storefront/content_blocks_controller.rb', line 26

def draft
  draft = Content::BlockDraft.find(params[:id])

  @content = draft.content
  @block = Storefront::ContentBlockViewModel.wrap(
    draft.to_block,
    view_model_options
  )

  render :show
end

#newObject



10
11
12
13
14
15
16
17
# File 'app/controllers/workarea/storefront/content_blocks_controller.rb', line 10

def new
  @content = Content.find(params[:content_id])
  block = @content.blocks.build(type_id: params[:type_id])
  block.data = block.type.defaults
  @block = Storefront::ContentBlockViewModel.wrap(block, view_model_options)

  render :show
end

#showObject



19
20
21
22
23
24
# File 'app/controllers/workarea/storefront/content_blocks_controller.rb', line 19

def show
  @content = Content.from_block(params[:id])
  block = @content.blocks.find(params[:id])

  @block = Storefront::ContentBlockViewModel.wrap(block, view_model_options)
end