Sha256: deeca048ad6f9c65cf938a0879548bc7c60988a252dfc0ea867b8716a15ceb73
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Decidim module Posts class PostCommentCell < Decidim::ViewModel include Cell::ViewModel::Partial include Decidim::ResourceHelper include Decidim::Comments::CommentsHelper def show render :show end def post model end def model_type if model.is_a?(Decidim::Posts::Post) "Post" elsif model.is_a?(Decidim::Meetings::Meeting) "Meeting" else "Post" end end def post_commentable? if model.respond_to?(:enable_comments?) model.enable_comments? elsif model.respond_to?(:comments_enabled?) model.comments_enabled? else false # Default to false if neither method exists end end def machine_translations_toggled? RequestStore.store[:toggle_machine_translations] end def comments_count model.comments_count end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-posts-1.0.0 | app/cells/decidim/posts/post_comment_cell.rb |