Class: Pageflow::EntriesController Private

Inherits:
ApplicationController
  • Object
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
25
26
# 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
    respond_to do |format|
      format.html { handle_public_entry_request(entry) }
    end
  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.



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

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.



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

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.



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

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.



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

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