hitobito-kjv/app/domain/kjv/event_contact_email.rb
KJV Bautzen f301d72572 Nur Vorstandsadresse als Kontakt bei Kursen und Anlässen, Version 0.4.1 🤖
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 18:03:07 +02:00

76 lines
2.7 KiB
Ruby

# frozen_string_literal: true
# Copyright (c) 2026, Kreisjagdverband Bautzen e.V. This file is part of
# hitobito_kjv and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory.
# Weitere Stellen, an denen der Core die E-Mail der Kontaktperson eines Anlasses ausgibt.
# Überall wird die Vorstandsadresse statt der privaten Haupt-E-Mail verwendet.
# Die Methoden sind Kopien der Core-Methoden mit ausgetauschter E-Mail; bei Core-Updates
# mit dem Original abgleichen.
module Kjv::EventContactEmail
# Export::Ics::Events: Beschreibung im (öffentlichen) Kalender-Feed
module IcsEvents
def event_description(event)
return event.description unless event.contact
[
event.description, "",
event.contact.person_name,
event.contact.phone_numbers.map { |pn| "#{pn.label}: #{pn.number}" if pn.public },
Kjv::VorstandEmail.for(event.contact), "",
url(event)
].flatten.compact.join("\n")
end
end
# Export::Pdf::Participation::Confirmation: Teilnahmebestätigung
module ParticipationConfirmation
def render_contact_address
text(I18n.t("event.applied_to"), style: :bold)
email = Kjv::VorstandEmail.for(contact)
pdf.bounding_box([10, cursor], width: bounds.width) do
if email
text(I18n.t("contactable.address_or_email", address: contact_address, email: email))
else
text(contact_address)
end
end
move_down_line
end
end
# Event::ParticipationMailer: Anlass-Angaben in Mails an Teilnehmende
module ParticipationMailer
def event_details # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
infos = []
infos << event.name
infos << labeled(:dates) { join_lines(event.dates.map(&:to_s)) }
infos << labeled(:motto)
infos << labeled(:cost)
infos << labeled(:description) { convert_newlines_to_breaks(event.description) }
infos << labeled(:location) { convert_newlines_to_breaks(event.location) }
infos << labeled(:contact) do
email = Kjv::VorstandEmail.for(event.contact)
email ? escape_html(event.contact) + br_tag + email : escape_html(event.contact)
end
infos << answers_details
infos << additional_information_details
infos << placeholder_participation_details
join_lines(infos.compact, br_tag * 2)
end
end
# Event::ReplyToContact: Antwortadresse (nur wenn event.use_contact_as_reply_to aktiv)
module ReplyToContact
private
def set_reply_to_from_event_contact
return unless Settings.event.use_contact_as_reply_to
email = Kjv::VorstandEmail.for(event&.contact)
message.reply_to = email if email
end
end
end