Class: Decidim::Posts::PostHostCell

Inherits:
ViewModel
  • Object
show all
Includes:
ActiveModel::Conversion, Cell::ViewModel::Partial, PostCellsHelper
Defined in:
app/cells/decidim/posts/post_host_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

#official_postObject



67
68
69
# File 'app/cells/decidim/posts/post_host_cell.rb', line 67

def official_post
  participatory_space.admins.exists?(id: post.author.id)
end

#postObject



16
17
18
# File 'app/cells/decidim/posts/post_host_cell.rb', line 16

def post
  model
end

#post_bodyObject



20
21
22
# File 'app/cells/decidim/posts/post_host_cell.rb', line 20

def post_body
  translated_attribute model.body
end

#post_categoryObject



24
25
26
# File 'app/cells/decidim/posts/post_host_cell.rb', line 24

def 
  model.category
end

#post_commentable?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'app/cells/decidim/posts/post_host_cell.rb', line 63

def post_commentable?
  model.enable_comments?
end

#post_highlightedObject



59
60
61
# File 'app/cells/decidim/posts/post_host_cell.rb', line 59

def post_highlighted
  model.highlighted
end

#post_statusObject

post status / for host post 0 default 1 bearbeitung 2 erledigt



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

def post_status
  model.status
end

#post_status_textObject



50
51
52
53
54
55
56
57
# File 'app/cells/decidim/posts/post_host_cell.rb', line 50

def post_status_text
  case post_status
    when 1
      I18n.t('decidim.posts.posts.host.status.processing')
    when 2
      I18n.t('decidim.posts.posts.host.status.done')
  end
end

#showObject



12
13
14
# File 'app/cells/decidim/posts/post_host_cell.rb', line 12

def show
  render :show
end

#status_classObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/cells/decidim/posts/post_host_cell.rb', line 37

def status_class
  case post_status
    when 0
      nil
    when 1
      'warning'
    when 2
      'success'
    else
      nil
    end
end