Sha256: dc919af9bbf78edc595d556cd3cd71df289db2c20fb638a0850c31d452196055

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Notify
    # This cell renders the card for an instance of a Notify Participant
    class NoteCell < Decidim::ViewModel
      include Decidim::LayoutHelper

      property :id
      property :body
      property :author
      property :creator
      property :user
      property :chapter
      property :created_at

      def notify_author
        Author.find_by(user: model.author, component: model.component)
      end

      def note_taker?
        return unless current_user

        Author.for(model.component).note_takers.find_by(user: current_user)
      end

      def note_author_class
        return "by-note-taker" if author&.admin

        "by-participant"
      end

      def edit_path
        EngineRouter.main_proxy(model.component).conversation_path(model.id)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-notify-0.5 app/cells/decidim/notify/note_cell.rb
decidim-notify-0.4 app/cells/decidim/notify/note_cell.rb
decidim-notify-0.3 app/cells/decidim/notify/note_cell.rb