Class: Decidim::Posts::PostCell

Inherits:
ViewModel
  • Object
show all
Includes:
Cell::ViewModel::Partial, PostCellsHelper
Defined in:
app/cells/decidim/posts/post_cell.rb

Instance Method Summary collapse

Methods included from PostCellsHelper

#component_settings, #current_component, #current_settings, #participatory_space

Methods included from ApplicationHelper

#category_label, #category_label_singular, #posts_component_for_meeting

Instance Method Details

#has_image?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/cells/decidim/posts/post_cell.rb', line 37

def has_image?
  resource_image_path.present?
end

#postObject



13
14
15
# File 'app/cells/decidim/posts/post_cell.rb', line 13

def post
  model
end

#post_bodyObject



17
18
19
# File 'app/cells/decidim/posts/post_cell.rb', line 17

def post_body
  simple_format(post_presenter.body)
end

#post_categoryObject



25
26
27
# File 'app/cells/decidim/posts/post_cell.rb', line 25

def 
  model.category
end

#post_commentable?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/cells/decidim/posts/post_cell.rb', line 29

def post_commentable?
  model.enable_comments?
end

#post_presenterObject



21
22
23
# File 'app/cells/decidim/posts/post_cell.rb', line 21

def post_presenter
  @post_presenter ||= present(model)
end

#resource_image_pathObject



33
34
35
# File 'app/cells/decidim/posts/post_cell.rb', line 33

def resource_image_path
  model.attachments.first&.url
end

#showObject



9
10
11
# File 'app/cells/decidim/posts/post_cell.rb', line 9

def show
  render :show
end