Sha256: a1009e683ba4549db3145c8e8ebfa24a9780c5d8c973e5767503ffa3f4ad5689

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

class <%= page_name.classify %>Presenter < PagePresenter
  include EntryPresenter

  # We need to tell the admin UI which fields to show when presenting a
  # table of entries in the admin UI. Each key in the column hash should
  # be a symbol matching the name of one of the fields defined on the
  # page.
  #
  # The hash's values (e.g. 'Date Published') will be used for the
  # column headings in the admin UI.

  @columns = {
    name: 'Name',
    # published_at: 'Date Published'
  }
  class << self
    attr_reader :columns
  end

<%- if options.with_entry_templates? -%>
  def main_extra_templates
    super + ['<%= file_name %>/<%= page_name %>_main']
  end

  def meta_extra_templates
    super + ['<%= file_name %>/<%= page_name %>_meta']
  end
<%- else -%>
  # If you want to display extra information while editing a page you'll need
  # to define some .hbs files, and then tell the CMS to use them by
  # uncommenting these methods.

  # def main_extra_templates
  #   super + ['<%= file_name %>/<%= page_name %>_main']
  # end

  # def meta_extra_templates
  #   super + ['<%= file_name %>/<%= page_name %>_meta']
  # end
<%- end -%>

  # The CMS needs to know how to present the data stored on a page;
  # it's not always good enough just to convert it to a string and
  # render it into the page. You can access the page through the @source
  # variable.

  def name
    @source.name.blank? ? "(name isn't set)" : @source.name
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slices-2.0.2 lib/generators/slice/templates/presenter.rb
slices-2.0.1 lib/generators/slice/templates/presenter.rb
slices-2.0.0 lib/generators/slice/templates/presenter.rb