Sha256: e35cae3ef29a71cbb5374837d67fa73ff17b5a6b1296bece4021dced96af1e6e

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Posts
    class PostCell < Decidim::ViewModel
      include PostCellsHelper
      include Cell::ViewModel::Partial

      def show
        render :show
      end

      def post
        model
      end

      def post_body
        simple_format(post_presenter.body)
        # translated_attribute model.body
      end

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

      def post_category
        model.category
      end

      def post_commentable?
        model.enable_comments?
      end

       def resource_image_path
        model.attachments.first&.url
      end

      def has_image?
        resource_image_path.present?
      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_cell.rb