From d96b442ec6a125c3cbeb866e343a560332e4cdcb Mon Sep 17 00:00:00 2001 From: Nils Rauch Date: Tue, 21 May 2024 14:34:53 +0200 Subject: [PATCH] WIP membership verify page --- app/assets/images/logo_gegenrecht.svg | 107 ++++++++++++++++++ .../images/membership_verify_partner_ad.jpg | Bin 0 -> 3207 bytes app/assets/images/sac_logo_de.svg | 1 + app/assets/images/sac_logo_fr.svg | 1 + app/assets/images/sac_logo_it.svg | 1 + .../hitobito/customizable/_wagon.scss | 39 ++++++- app/helpers/membership_verify_helper.rb | 16 +++ app/models/sac_cas/person.rb | 2 + .../people/membership/verify/show.html.haml | 64 +++++++++++ config/locales/wagon.de.yml | 7 +- lib/hitobito_sac_cas/wagon.rb | 2 + spec/features/membership_verification_spec.rb | 2 +- 12 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 app/assets/images/logo_gegenrecht.svg create mode 100644 app/assets/images/membership_verify_partner_ad.jpg create mode 100644 app/assets/images/sac_logo_de.svg create mode 100644 app/assets/images/sac_logo_fr.svg create mode 100644 app/assets/images/sac_logo_it.svg create mode 100644 app/helpers/membership_verify_helper.rb create mode 100644 app/views/people/membership/verify/show.html.haml diff --git a/app/assets/images/logo_gegenrecht.svg b/app/assets/images/logo_gegenrecht.svg new file mode 100644 index 000000000..6776a7660 --- /dev/null +++ b/app/assets/images/logo_gegenrecht.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + RECIPROCITÀ . RECIPROCIDADGEGENRECHT . RÉCIPROCITÉ + + + + + diff --git a/app/assets/images/membership_verify_partner_ad.jpg b/app/assets/images/membership_verify_partner_ad.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4c2b17a601ef228935f1b480631aed9f986168fb GIT binary patch literal 3207 zcmcIm2UHX37QQo+P!h@n0wSOU#Dai=*infhO;BSHr7EFF=t!|(3rOr9Kzzc|35W&3 zf>;)nBC-|~Sy_q&L9rmRpp+F+^8Unn-g)}YJ7@RiPv$$f{N+yC?){GA(7!+n*}Uq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kLLbm^*Fuw4F>9QiHo&r3=@l9%F{Zl(39*wY0O3;E;yx0>AT>(hd=DSAm@ZchIOV=f` zWAhb@Tx+z9`uAzn#hpHp6IEm1GMmq;bQZ&8hY{EAYrF5OlCM3<*BGrWYMb#=ncw7Q zreT^Rqv|QAc1!n9-NO93_>_wMI_$ipC!WoIwDS|flGl;wr<7Mt(~HTefx23)8eAekSxXPHnX+{(wu57 zcXcz0V^?X2T6pHdLlHAHH}O`QdNOj4mcZPLr-X&m;zU|ArazqF7D(l|%~^9~o2O{> zl8nTM2FObO@D2U#fTG) z-5*(s^OIZ;R@f^$H%zMwc}?1fq)xiB@ZMdc>K-!JbI3}mLA8tGyg$)n_amc4GYy__ zQ39hoLW_vvtGHIto0gVZsup+y0p%5c7foW8r96iYMl8z za&5*(p8c7<+^XEzOmk&M^nSf_K~BZ=j?(Q@N1e3u4@f(@lpMjS?0KOuXO3}n5)StY zJBN0=5sU0iv@H&1Av&ecRp~p4JYc8)j}C#n{sCJ`g6(&!V32_RV9jU6vOxt!B^!X) z`4oXXB-l|%_IH_I_NMX${4HBe`bkeqx}N->UH>U#B8eWENWwVvOWUK@om9bVW5~pu z(>*M9g+#z@Ujw>r)i(zUnN~2+Uhnkv%-c%Cq2M zW4*~vwpMf0!0I_3v|SqmyZXHLQm|Gres?MV^r+i^~TP?7-C_7VDR?KP`2OG2Sd9Hw$7XpJ#Or#_U!llVldbyZvHn*U+n7u literal 0 HcmV?d00001 diff --git a/app/assets/images/sac_logo_de.svg b/app/assets/images/sac_logo_de.svg new file mode 100644 index 000000000..0546feb23 --- /dev/null +++ b/app/assets/images/sac_logo_de.svg @@ -0,0 +1 @@ +sac_logo_cmyk_d \ No newline at end of file diff --git a/app/assets/images/sac_logo_fr.svg b/app/assets/images/sac_logo_fr.svg new file mode 100644 index 000000000..57056e62d --- /dev/null +++ b/app/assets/images/sac_logo_fr.svg @@ -0,0 +1 @@ +sac_logo_cmyk_f_pos \ No newline at end of file diff --git a/app/assets/images/sac_logo_it.svg b/app/assets/images/sac_logo_it.svg new file mode 100644 index 000000000..df0f0a2a2 --- /dev/null +++ b/app/assets/images/sac_logo_it.svg @@ -0,0 +1 @@ +sac_logo_cmyk_i_pos \ No newline at end of file diff --git a/app/assets/stylesheets/hitobito/customizable/_wagon.scss b/app/assets/stylesheets/hitobito/customizable/_wagon.scss index 5e573b6b7..92ce587dc 100644 --- a/app/assets/stylesheets/hitobito/customizable/_wagon.scss +++ b/app/assets/stylesheets/hitobito/customizable/_wagon.scss @@ -14,14 +14,51 @@ #membership-verify { header { + justify-content: end; #logo { img { width: 100%; } } } + + #details { + #member-info { + dl { + display: flex; + flex-direction: column; + + div { + display: flex; + justify-content: center; + } + } + } + + .alert-success { + background-color: rgb(128, 255, 0); // cmyk(50, 0, 100, 0) + color: black; + } + + .alert-danger { + background-color: rgb(255, 179, 128); // cmyk(50, 0, 100, 0) + color: black; + } + + #logo-reciprocate { + height: 4em; + display: flex; + justify-content: center; + } + } + #footer { + margin: 0; + img { + width: 100%; + } + } } .turbo-progress-bar { background-color: $link-color !important; -} \ No newline at end of file +} diff --git a/app/helpers/membership_verify_helper.rb b/app/helpers/membership_verify_helper.rb new file mode 100644 index 000000000..086fd1def --- /dev/null +++ b/app/helpers/membership_verify_helper.rb @@ -0,0 +1,16 @@ + +module MembershipVerifyHelper + + def localized_logo_path + "sac_logo_#{I18n.locale.downcase}.svg" + end + + def localized_sac_sponsors_url + { + de: 'https://www.sac-cas.ch/de/der-sac/unsere-partner/', + fr: 'https://www.sac-cas.ch/fr/le-cas/nos-partenaires/', + it: 'https://www.sac-cas.ch/it/il-cas/i-nostri-partner/' + }[I18n.locale] + end + +end diff --git a/app/models/sac_cas/person.rb b/app/models/sac_cas/person.rb index b0ba00c13..e4e2818c4 100644 --- a/app/models/sac_cas/person.rb +++ b/app/models/sac_cas/person.rb @@ -18,6 +18,8 @@ module SacCas::Person Person.used_attributes.delete(:nickname) + reflect_on_attachment(:picture).variant(:profile, resize_to_fill: [200, 200]) + has_many :external_trainings has_many :roles_with_deleted, -> { with_deleted }, class_name: 'Role', foreign_key: 'person_id' diff --git a/app/views/people/membership/verify/show.html.haml b/app/views/people/membership/verify/show.html.haml new file mode 100644 index 000000000..4ecd595ab --- /dev/null +++ b/app/views/people/membership/verify/show.html.haml @@ -0,0 +1,64 @@ +- title = t('verify_membership.title') + +%html{lang: I18n.locale} + %head + %meta{charset: 'utf-8'} + %title= "#{Settings.application.name} - #{title}" + %meta{name: 'viewport', content: 'width=device-width, initial-scale=1.0'} + = stylesheet_pack_tag 'application' + = javascript_pack_tag 'membership_verify' + %body + #membership-verify + %header + %div#logo + - logo = Settings.application.membership_verify_logo + - if logo + = wagon_image_pack_tag(logo.image, alt: Settings.application.name) + - else + = image_pack_tag(localized_logo_path, alt: 'define logo in wagon settings (membership_verify_logo)') + #details + - if person + #member-img + = image_tag(upload_url(person, :picture)) + #member-name + = person.full_name + #member-info + %dl.dl-horizontal + %div + %strong=t('.membership_number', membership_number: person.membership_number) + %div + - membership_years = Person.where(id: person.id).with_membership_years.first.membership_years + %strong=t('.membership_years', membership_years: membership_years) + - if member? + %div.alert.alert-success + %span.fas.fa-check + = t('verify_membership.status_valid') + - else + %div.alert.alert-danger + %span.fas.fa-times-circle + = t('verify_membership.status_invalid') + + #sections.mb-5 + - main_section_role = person.roles.find_by(type: Group::SektionsMitglieder::Mitglied.sti_name) + - if main_section_role.present? + %div + %div + %strong= main_section_role.to_s + %div + %strong= main_section_role.group.layer_group.to_s + - person.roles.where(type: Group::SektionsMitglieder::MitgliedZusatzsektion.sti_name).each do |secondary_role| + %div + %div= secondary_role.to_s + %div= secondary_role.group.layer_group.to_s + + #logo-reciprocate + = image_pack_tag('logo_gegenrecht.svg', alt: 'define logo in wagon settings (membership_verify_logo)') + + - else + %div.alert.alert-danger + %span.fas.fa-times-circle + = t('verify_membership.not_found') + #footer + %a{href: localized_sac_sponsors_url, target: '_blank'} + = image_pack_tag('membership_verify_partner_ad.jpg', alt: 'define logo in wagon settings (membership_verify_logo)') + diff --git a/config/locales/wagon.de.yml b/config/locales/wagon.de.yml index 377b91703..4a7a867fa 100644 --- a/config/locales/wagon.de.yml +++ b/config/locales/wagon.de.yml @@ -630,6 +630,11 @@ de: https://www.sac-cas.ch/de/der-sac/sektionen' people: + membership: + verify: + show: + membership_number: 'Mitglied: %{membership_number}' + membership_years: 'Anzahl Mitgliedsjahre: %{membership_years}' neuanmeldungen: multiselect_actions: accept: Übernehmen @@ -798,7 +803,7 @@ de: title: Verifizierung SAC CAS Mitgliedschaft not_found: Ungültiger Verifikationscode status_valid: Mitgliedschaft gültig - status_invalid: Keine gültige Mitgliedschaft + status_invalid: Mitgliedschaft ungültig passes: membership: diff --git a/lib/hitobito_sac_cas/wagon.rb b/lib/hitobito_sac_cas/wagon.rb index 5c4cdb011..430a737f6 100644 --- a/lib/hitobito_sac_cas/wagon.rb +++ b/lib/hitobito_sac_cas/wagon.rb @@ -131,6 +131,8 @@ class Wagon < Rails::Engine SubscriptionsController.prepend SacCas::SubscriptionsController + People::Membership::VerifyController.include Localizable + ## Jobs Export::PeopleExportJob.prepend SacCas::Export::PeopleExportJob Export::SubscriptionsJob.prepend SacCas::Export::SubscriptionsJob diff --git a/spec/features/membership_verification_spec.rb b/spec/features/membership_verification_spec.rb index f0f5b321e..d648bcb2a 100644 --- a/spec/features/membership_verification_spec.rb +++ b/spec/features/membership_verification_spec.rb @@ -22,7 +22,7 @@ person.roles.destroy_all visit "/verify_membership/#{token}" - expect(page).to have_css('.alert-danger', text: 'Keine gültige Mitgliedschaft') + expect(page).to have_css('.alert-danger', text: 'Mitgliedschaft ungültig') end it 'shows valid membership information' do