Sha256: 69ffbf101de6477d5eeee23187d5af3506134d5d31e3f203ecdffde3e2668bf6

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Decidim
  module Comments
    # A cell to display when a comment has been created.
    class CommentActivityCell < ActivityCell
      delegate :root_commentable, to: :comment

      def renderable?
        comment.present? && root_commentable.present?
      end

      def resource_link_text
        comment.formatted_body
      end

      def resource_link_path
        resource_locator(root_commentable).path(url_params)
      end

      def title
        I18n.t(
          "decidim.comments.last_activity.new_comment_at_html",
          link: link_to(
            root_commentable_title,
            resource_locator(root_commentable).path
          )
        )
      end

      def participatory_space
        model.participatory_space_lazy
      end

      def comment
        model.resource_lazy
      end

      def root_commentable_title
        decidim_html_escape(translated_attribute(root_commentable.title))
      end

      def url_params
        { anchor: "comment_#{comment.id}" }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-comments-0.21.0 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.20.1 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.20.0 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.19.1 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.18.1 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.19.0 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.17.2 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.18.0 app/cells/decidim/comments/comment_activity_cell.rb
decidim-comments-0.17.1 app/cells/decidim/comments/comment_activity_cell.rb