Class: MetadataPresenter::PagesController

Inherits:
EngineController show all
Defined in:
app/controllers/metadata_presenter/pages_controller.rb

Instance Method Summary collapse

Methods inherited from EngineController

#allow_analytics?, #analytics_cookie_name, #analytics_tags_present?, #answered?, #authorised_session!, #back_link, #external_or_relative_link, #get_saved_progress, #increment_record_counter, #invalidate_record, #load_autocomplete_items, #load_page_content, #maintenance_mode?, #reload_user_data, #require_basic_auth, #save_form_progress, #session_authorised?, #show_cookie_confirmation?, #show_cookie_request?

Instance Method Details

#answered_pagesObject



34
35
36
# File 'app/controllers/metadata_presenter/pages_controller.rb', line 34

def answered_pages
  TraversedPages.new(service, load_user_data, @page).all
end

#conditional_components_present?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/controllers/metadata_presenter/pages_controller.rb', line 38

def conditional_components_present?
  @page.conditional_components.any?
end

#pages_presentersObject



20
21
22
23
24
25
26
# File 'app/controllers/metadata_presenter/pages_controller.rb', line 20

def pages_presenters
  PageAnswersPresenter.map(
    view: view_context,
    pages: answered_pages,
    answers: @user_data
  )
end

#showObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/metadata_presenter/pages_controller.rb', line 5

def show
  @user_data = load_user_data # method signature

  @page ||= service.find_page_by_url(request.env['PATH_INFO'])
  if @page
    load_autocomplete_items
    load_page_content

    @page_answers = PageAnswers.new(@page, @user_data)
    render template: @page.template
  else
    not_found
  end
end

#show_save_and_returnObject



29
30
31
# File 'app/controllers/metadata_presenter/pages_controller.rb', line 29

def show_save_and_return
  @page.upload_components.none?
end