Class: Pageflow::EntriesController Private

Inherits:
ApplicationController show all
Includes:
ControllerDelegation, EntryPasswordProtection, PublicHttpsMode
Defined in:
app/controllers/pageflow/entries_controller.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods included from ControllerDelegation

#delegate_to_rack_app!, #dispatch

Instance Method Details

#indexObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/pageflow/entries_controller.rb', line 8

def index
  site = Site.for_request(request).first!

  entry = PublishedEntry.find_by_permalink(
    directory: '',
    slug: '',
    scope: site.entries
  )

  if entry
    handle_public_entry_request(entry)
  elsif site.home_url.present?
    redirect_to(site.home_url, allow_other_host: true)
  else
    raise ActiveRecord::RecordNotFound
  end
end

#manifestObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/pageflow/entries_controller.rb', line 42

def manifest
  respond_to do |format|
    format.webmanifest do
      entry = PublishedEntry.find(params[:id], entry_request_scope)

      return head :not_found unless entry.entry_type.web_app_manifest

      render json: entry.entry_type.web_app_manifest.call(entry)
    end
  end
end

#pageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



62
63
64
65
66
67
# File 'app/controllers/pageflow/entries_controller.rb', line 62

def page
  entry = PublishedEntry.find(params[:id], entry_request_scope)
  index = params[:page_index].split('-').first.to_i

  redirect_to(short_entry_path(entry.to_model, anchor: entry.pages[index].try(:perma_id)))
end

#showObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/pageflow/entries_controller.rb', line 26

def show
  respond_to do |format|
    format.html do
      entry = find_by_permalink

      return if !entry && redirect_according_to_permalink_redirect

      entry ||= find_by_slug!

      handle_public_entry_request(entry)
    rescue ActiveRecord::RecordNotFound
      render_custom_or_static_404_error_page
    end
  end
end

#stylesheetObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
57
58
59
60
# File 'app/controllers/pageflow/entries_controller.rb', line 54

def stylesheet
  respond_to do |format|
    format.css do
      @entry = PublishedEntry.find(params[:id], entry_request_scope)
    end
  end
end