provide render_label_sum

This commit is contained in:
Alexander Meindl 2022-10-07 13:35:31 +02:00
parent f0f440b8d4
commit 54023e3e95
3 changed files with 7 additions and 4 deletions

View File

@ -45,6 +45,7 @@ end
if File.file? File.expand_path './.enable_test', __dir__
group :development, :test do
gem 'active_record_doctor', require: false
gem 'rails_best_practices', require: false
gem 'bullet'
end
group :test do

View File

@ -10,8 +10,5 @@ h1 = link_to h(title), entity_url
fieldset.attachments
legend = l :label_attachment_plural
- entity.attachments.each do |attachment|
= link_to_attachment attachment, download: true, only_path: false
| (
= number_to_human_size attachment.filesize
| )
= render_label_sum link_to_attachment(attachment, download: true, only_path: false), number_to_human_size(attachment.filesize)
br

View File

@ -231,6 +231,11 @@ module Additionals
end
end
def render_label_sum(label, sum)
name = label.is_a?(Symbol) ? l(label) : label
"#{name} (#{sum})"
end
private
def additionals_already_loaded(scope, js_name)