Class: Decidim::Notify::ChapterCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::Notify::ChapterCell
- Includes:
- LayoutHelper
- Defined in:
- app/cells/decidim/notify/chapter_cell.rb
Overview
This cell renders the card for an instance of a Notify Chapter
Instance Method Summary collapse
- #active ⇒ Object
- #id ⇒ Object
- #note_taker? ⇒ Boolean
- #notes ⇒ Object
- #show ⇒ Object
- #update_path ⇒ Object
Instance Method Details
#active ⇒ Object
34 35 36 |
# File 'app/cells/decidim/notify/chapter_cell.rb', line 34 def active model&.active end |
#id ⇒ Object
16 17 18 19 20 |
# File 'app/cells/decidim/notify/chapter_cell.rb', line 16 def id return "unclassified" unless model&.id model.id end |
#note_taker? ⇒ Boolean
22 23 24 25 26 |
# File 'app/cells/decidim/notify/chapter_cell.rb', line 22 def note_taker? return unless current_user Author.for(model.component).note_takers.find_by(user: current_user) end |
#notes ⇒ Object
28 29 30 31 32 |
# File 'app/cells/decidim/notify/chapter_cell.rb', line 28 def notes return [] unless model&.notes model.notes end |
#show ⇒ Object
11 12 13 14 |
# File 'app/cells/decidim/notify/chapter_cell.rb', line 11 def show @form = Decidim::Notify::ChapterForm.from_params(title: title) render end |
#update_path ⇒ Object
38 39 40 |
# File 'app/cells/decidim/notify/chapter_cell.rb', line 38 def update_path EngineRouter.main_proxy(model.component).chapter_path(model.id) end |