Class: Decidim::Notify::ChapterCell

Inherits:
ViewModel
  • Object
show all
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

Instance Method Details

#activeObject



34
35
36
# File 'app/cells/decidim/notify/chapter_cell.rb', line 34

def active
  model&.active
end

#idObject



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

Returns:

  • (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

#notesObject



28
29
30
31
32
# File 'app/cells/decidim/notify/chapter_cell.rb', line 28

def notes
  return [] unless model&.notes

  model.notes
end

#showObject



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_pathObject



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