class Maglev::PagePreviewController

def create

def create
  render_maglev_page
end

def extract_content_locale(&block)

def extract_content_locale(&block)
  _, locale = maglev_services.extract_locale.call(params: params, locales: maglev_site.locale_prefixes)
  ::I18n.with_locale(locale, &block)
end

def fallback_to_default_locale

def fallback_to_default_locale
  maglev_rendering_mode == :editor
end

def fetch_maglev_page_sections

def fetch_maglev_page_sections
  return super if action_name == 'index'
  super(section_id: params[:section_id])
end

def fetch_maglev_site

def fetch_maglev_site
  super.tap do |site|
    raise ActiveRecord::RecordNotFound if site.nil?
    maglev_services.context.site = site
    site.style = JSON.parse(params[:style]) if params[:style]
  end
end

def index

def index
  render_maglev_page
end

def maglev_rendering_mode

def maglev_rendering_mode
  params[:rendering_mode] || super
end