Skip to content

Commit

Permalink
Merge pull request #109 from lukaseisenring/master
Browse files Browse the repository at this point in the history
Extend Events JSON API
  • Loading branch information
kronn committed Nov 14, 2019
2 parents 2bdf59d + ae31777 commit a9dd08c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions app/serializers/pbs/event_serializer.rb
@@ -0,0 +1,37 @@
# encoding: utf-8

# Copyright (c) 2019, Pfadibewegung Schweiz. This file is part of
# hitobito 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.

module Pbs::EventSerializer
extend ActiveSupport::Concern

included do
extension(:public) do |_|
map_properties(*item.used_attributes(:applicant_count,
:expected_participants_wolf_f,
:expected_participants_wolf_m,
:expected_participants_pfadi_f,
:expected_participants_pfadi_m,
:expected_participants_pio_f,
:expected_participants_pio_m,
:expected_participants_rover_f,
:expected_participants_rover_m,
:expected_participants_leitung_f,
:expected_participants_leitung_m,
:canton,
:coordinates,
:altitude,
:emergency_phone,
:j_s_kind,
:j_s_security_snow,
:j_s_security_mountain,
:j_s_security_water,
:required_contact_attrs,
:hidden_contact_attrs))
end
end
end

1 change: 1 addition & 0 deletions lib/hitobito_pbs/wagon.rb
Expand Up @@ -90,6 +90,7 @@ class Wagon < Rails::Engine
### serializers
PersonSerializer.send :include, Pbs::PersonSerializer
GroupSerializer.send :include, Pbs::GroupSerializer
EventSerializer.send :include, Pbs::EventSerializer

### controllers
PeopleController.permitted_attrs += [:salutation, :title, :grade_of_school, :entry_date,
Expand Down

0 comments on commit a9dd08c

Please sign in to comment.