Module: PagesCore::PreviewPagesController

Extended by:
ActiveSupport::Concern
Included in:
Frontend::PagesController
Defined in:
app/controllers/concerns/pages_core/preview_pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#previewObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/concerns/pages_core/preview_pages_controller.rb', line 11

def preview
  redirect_to(page_url(@locale, @page)) && return unless logged_in?

  @preview = true
  @page.attributes = page_params.merge(
    status: 2,
    published_at: Time.zone.now,
    locale: @locale,
    redirect_to: nil
  )
  render_page
end

#preview?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/controllers/concerns/pages_core/preview_pages_controller.rb', line 24

def preview?
  @preview || false
end