-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PEOPLE: QR Code Mitgliederausweis auf Profil
- Loading branch information
Showing
6 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,3 @@ def t(key) | |
|
||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...iews/people/_show_event_sac_cas.html.haml → ...ws/people/_show_right_z_sac_cas.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
-# frozen_string_literal: true | ||
- # Named with z so it will show up at the end. | ||
|
||
-# Copyright (c) 2023, Schweizer Alpen-Club. This file is part of | ||
-# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
-# or later. See the COPYING file at the top-level directory or at | ||
-# https://github.com/hitobito/hitobito_sac_cas. | ||
- if can?(:update, entry) && entry.sac_membership_active? | ||
%h2= t('.documents') | ||
- if can?(:update, entry) && entry.sac_membership_anytime? | ||
%div | ||
%dl.dl-horizontal | ||
= labeled t('.membership') do | ||
= link_to t('.download'), membership_path(format: :pdf), target: :new | ||
.d-flex.justify-content-center | ||
.qr-code-wrapper | ||
= qr_code_image_tag(entry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (c) 2012-2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas. | ||
|
||
require 'spec_helper' | ||
|
||
describe 'people/_show_right_z_sac_cas.html.haml' do | ||
include FormatHelper | ||
|
||
let(:dom) { render; Capybara::Node::Simple.new(@rendered) } | ||
|
||
before do | ||
allow(view).to receive_messages(current_user: person) | ||
allow(view).to receive_messages(entry: PersonDecorator.decorate(person)) | ||
allow(controller).to receive_messages(current_user: Person.new) | ||
allow(view).to receive(:can?).with(:update, person).and_return true | ||
end | ||
|
||
context 'member' do | ||
let(:person) { Person.with_membership_years.find(people(:mitglied).id) } | ||
|
||
it 'renders membership info for active membership' do | ||
expect(dom).to have_css '.qr-code-wrapper' | ||
end | ||
|
||
it 'renders membership info for past membership' do | ||
person.roles.destroy_all | ||
expect(dom).to have_css '.qr-code-wrapper' | ||
end | ||
|
||
it 'renders membership info for future membership' do | ||
person.roles.destroy_all | ||
person.roles.create!( | ||
type: FutureRole.sti_name, | ||
group: groups(:bluemlisalp_mitglieder), | ||
convert_on: 1.month.from_now, | ||
convert_to: Group::SektionsMitglieder::Mitglied.sti_name | ||
) | ||
expect(dom).to have_css '.qr-code-wrapper' | ||
end | ||
end | ||
|
||
context 'other' do | ||
let(:person) { people(:admin) } | ||
|
||
it 'hides membership info' do | ||
expect(dom).not_to have_css '.qr-code-wrapper' | ||
end | ||
|
||
end | ||
end |