Sha256: a0a5382ea583e261094dcb6dbc11ef111445f2723b533c735d5eda94a418f881
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Renalware module Patients class MessagesComponent < ApplicationComponent include ToggleHelper include Pagy::Backend include Pagy::Frontend rattr_initialize [:patient!, :current_user!] def pagination load_messages unless @pagination @pagination end def messages load_messages unless @messages @messages end def formatted_title(title) if pagination.items < pagination.count "#{title} (#{pagination.items} of #{pagination.count})" else "#{title} (#{pagination.count})" end end private def load_messages @pagination, @messages = pagy(scope, items: 5, link_extra: "data-remote='true'") end def messaging_patient @messaging_patient ||= Messaging.cast_patient(patient) end def scope messaging_patient.messages.where(public: true).order(created_at: :desc) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
renalware-core-2.1.1 | app/components/renalware/patients/messages_component.rb |
renalware-core-2.1.0 | app/components/renalware/patients/messages_component.rb |