Class: Www::CollectionPagePresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- BasePresenter
- Www::CollectionPagePresenter
- Defined in:
- app/presenters/www/collection_page_presenter.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#page_description ⇒ Object
readonly
Returns the value of attribute page_description.
-
#page_title ⇒ Object
readonly
Returns the value of attribute page_title.
-
#page_url ⇒ Object
readonly
Returns the value of attribute page_url.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#initialize(page_title, page_description, page_url, items = [], request = nil) ⇒ CollectionPagePresenter
constructor
A new instance of CollectionPagePresenter.
- #schema_dot_org_structure ⇒ Object
- #to_json_ld ⇒ Object
Methods inherited from BasePresenter
#can?, #capture, #concat, #content_tag, #fa_icon, #h, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u
Constructor Details
#initialize(page_title, page_description, page_url, items = [], request = nil) ⇒ CollectionPagePresenter
Returns a new instance of CollectionPagePresenter.
7 8 9 10 11 12 13 14 |
# File 'app/presenters/www/collection_page_presenter.rb', line 7 def initialize(page_title, page_description, page_url, items = [], request = nil) @page_title = page_title @page_description = page_description @page_url = page_url @items = items @request = request super(nil) # Pass nil since we don't need a model end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
5 6 7 |
# File 'app/presenters/www/collection_page_presenter.rb', line 5 def items @items end |
#page_description ⇒ Object (readonly)
Returns the value of attribute page_description.
5 6 7 |
# File 'app/presenters/www/collection_page_presenter.rb', line 5 def page_description @page_description end |
#page_title ⇒ Object (readonly)
Returns the value of attribute page_title.
5 6 7 |
# File 'app/presenters/www/collection_page_presenter.rb', line 5 def page_title @page_title end |
#page_url ⇒ Object (readonly)
Returns the value of attribute page_url.
5 6 7 |
# File 'app/presenters/www/collection_page_presenter.rb', line 5 def page_url @page_url end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'app/presenters/www/collection_page_presenter.rb', line 5 def request @request end |
Instance Method Details
#schema_dot_org_structure ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/presenters/www/collection_page_presenter.rb', line 16 def schema_dot_org_structure SchemaDotOrg::CollectionPage.new( name: page_title, description: page_description, url: page_url, mainEntity: build_item_list ) end |
#to_json_ld ⇒ Object
25 26 27 |
# File 'app/presenters/www/collection_page_presenter.rb', line 25 def to_json_ld schema_dot_org_structure.to_s end |