Method: Pageflow::PageType#json_seed_template

Defined in:
lib/pageflow/page_type.rb

#json_seed_templateObject

View path of a template containing additional json to pass to the editor. The data is available in the javascript definition of the page type’s configuration editor. By default nothing is added.

In particular this can be used to make configuration options of page type engines available to the editor.

Example:

class RainbowPageType < Pageflow::PageType
  name 'rainbow'

  def json_seed_template
    'pageflow/rainbow/page_type.json.jbuilder'
  end
end

# page_types/pageflow/rainbow/page_type.json.jbuilder
json.colors ['red', 'blue', 'yellow']

# page_types/pageflow/rainbow/editor.js
pageflow.ConfigurationEditorView.register('rainbow', {
  configure: function() {
    var colors = this.options.pageType.colors;
    // ...
  }
});


151
152
# File 'lib/pageflow/page_type.rb', line 151

def json_seed_template
end