Class: Pageflow::PartialEditorFragmentRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/pageflow/partial_editor_fragment_renderer.rb

Overview

Helper class to be used as ‘editor_fragment_renderer` of EntryType objects to render fragments from partials.

Since:

  • 15.1

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ PartialEditorFragmentRenderer

Create object that implements methods required by ‘editor_fragment_renderer` of EntryType.

Parameters:

  • controller (ActionController::Base)

    Renders partials in the context of this controller. The controller determines which helpers are available in the template

Since:

  • 15.1



13
14
15
# File 'lib/pageflow/partial_editor_fragment_renderer.rb', line 13

def initialize(controller)
  @renderer = controller.renderer
end

Instance Method Details

#body_fragment(entry) ⇒ Object

Since:

  • 15.1



21
22
23
# File 'lib/pageflow/partial_editor_fragment_renderer.rb', line 21

def body_fragment(entry)
  render('body', entry)
end

#head_fragment(entry) ⇒ Object

Since:

  • 15.1



17
18
19
# File 'lib/pageflow/partial_editor_fragment_renderer.rb', line 17

def head_fragment(entry)
  render('head', entry)
end

#seed_fragment(entry) ⇒ Object

Since:

  • 15.1



25
26
27
# File 'lib/pageflow/partial_editor_fragment_renderer.rb', line 25

def seed_fragment(entry)
  render('seed', entry, format: :json)
end