Skip to content

Commit

Permalink
Merge pull request #225 from hitobito/feature/2401-repair-overrides
Browse files Browse the repository at this point in the history
Repair Overrides
  • Loading branch information
TheWalkingLeek authored Mar 4, 2024
2 parents cf255bb + 9868229 commit 1f03c2a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 46 deletions.
6 changes: 5 additions & 1 deletion app/controllers/die_mitte/people_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Copyright (c) 2021, Die Mitte. This file is part of
# Copyright (c) 2021-2024, Die Mitte. This file is part of
# hitobito_die_mitte 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_die_mitte.
Expand All @@ -22,4 +22,8 @@ def list_filter_args
def no_filter_active?
%w(filters filter_id).none? { |k| params[k].present? }
end

def model_scope
super.includes(roles: [:translations])
end
end
6 changes: 0 additions & 6 deletions app/helpers/people_die_mitte_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ def format_person_correspondence_language(person)
def format_person_civil_status(person)
t("#{PERSON_I18N_KEY_PREFIX}.civil_statuses.#{person.civil_status}")
end

def format_person_salutation(person)
if person.salutation.present?
t("activerecord.models.salutation.available.#{person.salutation}.label")
end
end
end
7 changes: 4 additions & 3 deletions app/models/die_mitte/role.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Copyright (c) 2021, Die Mitte. This file is part of
# Copyright (c) 2021-2024, Die Mitte. This file is part of
# hitobito_die_mitte 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_die_mitte.
Expand All @@ -22,14 +22,15 @@ module DieMitte::Role
alias_method_chain :to_s, :merkmal
end

def to_s_with_merkmal(format = :default)
def to_s_with_merkmal(format = :default) # rubocop:disable Metrics/MethodLength
model_name = self.class.label
model_name = 'Merkmal' if self.class.sti_name.ends_with?('Merkmal')

unless format == :short
model_name = label? ? "#{model_name} (#{label})" : model_name
model_name += " (#{label})" if label?
model_name += " (#{formatted_delete_date})" if delete_on
end

if format == :long
I18n.t('activerecord.attributes.role.string_long', role: model_name, group: group.to_s)
else
Expand Down
35 changes: 0 additions & 35 deletions app/views/roles/_fields.html.haml

This file was deleted.

8 changes: 8 additions & 0 deletions app/views/roles/_label.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
= field_set_tag Role.human_attribute_name(:label) do
- Settings.application.languages.each do |code, name|
= f.labeled_input_field(:"label_#{code}",
data: { provide: :typeahead, source: entry.klass.available_labels(code) },
label: name)

%small.muted
= t('roles.fields.help_optional_label')
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ root_email: hitobito-die-mitte@puzzle.ch
messages:
personal_salutation: true
enable_writing: true
body_font_size: 10.5

assignments:
enabled: true
Expand Down
1 change: 0 additions & 1 deletion lib/hitobito_die_mitte/wagon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Wagon < Rails::Engine
Export::Tabular::People::PersonRow.include DieMitte::Export::Tabular::People::PersonRow
Export::Pdf::Messages::Letter.include DieMitte::Export::Pdf::Messages::Letter
Export::Pdf::Messages::LetterWithInvoice.include DieMitte::Export::Pdf::Messages::LetterWithInvoice
Export::Pdf::Messages::Letter::BODY_FONT_SIZE = 10.5

MailingLists::Subscribers.prepend DieMitte::MailingLists::Subscribers

Expand Down

0 comments on commit 1f03c2a

Please sign in to comment.