-
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.
Render J+S-related fields on participation
Fixes #98
- Loading branch information
1 parent
4631cbe
commit 76240f1
Showing
5 changed files
with
67 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_cevi 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_cevi. | ||
|
||
module Cevi::Event::ParticipationDecorator | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
delegate :ahv_number, :j_s_number, :nationality_j_s, to: :person | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
app/views/event/participations/_application_details.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- # frozen_string_literal: true | ||
- # Copyright (c) 2023, CEVI Schweiz. This file is part of | ||
- # hitobito_cevi 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_cevi. | ||
|
||
= render_attrs(entry, :created_at) | ||
- if @event.is_a?(Event::Course) && entry.state == 'canceled' | ||
= render_attrs(entry, :canceled_at) | ||
- if entry.states? | ||
= render_attrs(entry, :state) | ||
|
||
- if can?(:application_market, entry.event) | ||
= render_attrs(entry, :ahv_number, :j_s_number, :nationality_j_s) |
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
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,35 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023, CEVI Schweiz. This file is part of | ||
# hitobito_cevi 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_cevi. | ||
|
||
require 'spec_helper' | ||
|
||
describe Event::ParticipationDecorator, :draper_with_helpers do | ||
|
||
let(:person) { Fabricate(:person, first_name: 'John', last_name: 'Doe', nickname: nil, ahv_number: '756.1234.5678.97', j_s_number: '1234123', nationality_j_s: 'CH') } | ||
let(:state) { 'applied' } | ||
let(:participation) { Event::Participation.new(state: state, person: person, event: events(:top_course)) } | ||
let(:decorator) { Event::ParticipationDecorator.new(participation) } | ||
|
||
describe '#ahv_number' do | ||
it 'delegates to person' do | ||
expect(decorator.ahv_number).to eq(person.ahv_number) | ||
end | ||
end | ||
|
||
describe '#j_s_number' do | ||
it 'delegates to person' do | ||
expect(decorator.j_s_number).to eq(person.j_s_number) | ||
end | ||
end | ||
|
||
describe '#nationality_j_s' do | ||
it 'delegates to person' do | ||
expect(decorator.nationality_j_s).to eq(person.nationality_j_s) | ||
end | ||
end | ||
|
||
end |