-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from hitobito/feature/11-anpassungen
Anpassungen
- Loading branch information
Showing
22 changed files
with
325 additions
and
6 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 |
---|---|---|
|
@@ -21,3 +21,4 @@ spec/coverage | |
spec/reports | ||
brakeman-output.tabs | ||
rubocop-results.xml | ||
config/environment.rb |
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,22 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
|
||
module Jemk::GroupAbility | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
on(Group) do | ||
permission(:any).may(:'index_event/camps').all | ||
|
||
permission(:group_full).may(:'export_event/camps').in_same_group | ||
permission(:group_and_below_full).may(:'export_event/camps').in_same_group_or_below | ||
permission(:layer_read).may(:'export_event/camps').in_same_layer | ||
permission(:layer_and_below_read).may(:'export_event/camps').in_same_layer_or_below | ||
end | ||
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
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,41 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
module Jemk::Event::ListsController | ||
|
||
def camps | ||
authorize!(:list_available, Event::Camp) | ||
|
||
@grouped_events = grouped(upcoming_user_events_of_type(Event::Camp)) | ||
render :events | ||
end | ||
|
||
def events | ||
authorize!(:list_available, Event) | ||
|
||
@grouped_events = grouped(upcoming_user_events_of_type(Event, allow_null: true)) | ||
end | ||
|
||
private | ||
|
||
def upcoming_user_events | ||
Event | ||
.upcoming | ||
.in_hierarchy(current_user) | ||
.includes(:dates, :groups, :events_groups) | ||
.order('event_dates.start_at ASC') | ||
end | ||
|
||
def upcoming_user_events_of_type(type, allow_null: false) | ||
condition = OrCondition.new | ||
condition.or('events.type = ?', type) | ||
condition.or('events.type IS NULL') if allow_null | ||
|
||
upcoming_user_events.where(condition.to_a) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
module Jemk::Sheet::Event::List | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
alias_method_chain :render_left_nav, :camps | ||
end | ||
|
||
def render_left_nav_with_camps | ||
if view.nav_left == 'camps' | ||
view.render 'nav_left_events' | ||
else | ||
render_left_nav_without_camps | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
|
||
module Jemk::Sheet::Group | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
tabs.insert(4, | ||
Sheet::Tab.new('activerecord.models.event/camp.other', | ||
:camp_group_events_path, | ||
params: { returning: true }, | ||
if: lambda do |view, group| | ||
group.event_types.include?(::Event::Camp) && | ||
view.can?(:'index_event/camps', group) | ||
end)) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
class Event::Camp < Event | ||
self.used_attributes += [:waiting_list] | ||
|
||
self.supports_applications = true | ||
|
||
def tentative_application_possible? | ||
false | ||
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
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
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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
module Jemk::Event::ParticipationContactData | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
self.contact_attrs -= [:company_name, :company] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
module Jemk::Person | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
used_attributes.delete(:company) | ||
used_attributes.delete(:company_name) | ||
|
||
Person::FILTER_ATTRS.delete(:company_name) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
cd ../hitobito | ||
bin/wagon $@ |
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
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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
require 'spec_helper' | ||
|
||
describe Group::Dachverband do | ||
it 'supports events' do | ||
expect(described_class.event_types).to include(Event) | ||
end | ||
|
||
it 'supports courses' do | ||
expect(described_class.event_types).to include(Event::Course) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2023-2023, Jungschar EMK. This file is part of | ||
# hitobito_jemk 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_jemk. | ||
|
||
require 'spec_helper' | ||
|
||
describe Group::Lagerverein do | ||
it 'supports events' do | ||
expect(described_class.event_types).to include(Event) | ||
end | ||
|
||
it 'supports camps' do | ||
expect(described_class.event_types).to include(Event::Camp) | ||
end | ||
end |
Oops, something went wrong.