Class: Spina::Admin::Journal::ArticlesListComponent
- Inherits:
-
ListComponent
- Object
- Spina::ApplicationComponent
- ApplicationComponent
- ListComponent
- Spina::Admin::Journal::ArticlesListComponent
- Defined in:
- app/components/spina/admin/journal/articles_list_component.rb
Overview
A list of articles. Articles should only be sortable if presented within the contex of an issue.
Instance Attribute Summary collapse
-
#sortable ⇒ Object
readonly
Returns the value of attribute sortable.
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(articles:, sortable: false) ⇒ ArticlesListComponent
constructor
A new instance of ArticlesListComponent.
- #sortable? ⇒ Boolean
Constructor Details
#initialize(articles:, sortable: false) ⇒ ArticlesListComponent
Returns a new instance of ArticlesListComponent.
11 12 13 14 |
# File 'app/components/spina/admin/journal/articles_list_component.rb', line 11 def initialize(articles:, sortable: false) @articles = articles @sortable = sortable end |
Instance Attribute Details
#sortable ⇒ Object (readonly)
Returns the value of attribute sortable.
9 10 11 |
# File 'app/components/spina/admin/journal/articles_list_component.rb', line 9 def sortable @sortable end |
Instance Method Details
#before_render ⇒ Object
16 17 18 |
# File 'app/components/spina/admin/journal/articles_list_component.rb', line 16 def before_render @list_items = generate_list_items(@articles) end |
#call ⇒ Object
20 21 22 23 24 |
# File 'app/components/spina/admin/journal/articles_list_component.rb', line 20 def call render ListComponent.new(list_items: @list_items, sortable: sortable?, sort_path: generate_sort_path) end |
#sortable? ⇒ Boolean
26 27 28 |
# File 'app/components/spina/admin/journal/articles_list_component.rb', line 26 def sortable? sortable end |