diff --git a/Gemfile.lock b/Gemfile.lock index 34a49d68..2d02e3b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -224,7 +224,7 @@ GEM iso-639 nokogiri (>= 1.6.6) nom-xml (~> 1.0) - mods_display (1.1.0) + mods_display (1.2.0) i18n stanford-mods (>= 3.0.0.alpha1, < 4) view_component @@ -327,7 +327,7 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.11.0) - rubocop (1.31.1) + rubocop (1.31.2) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.0.0) @@ -342,7 +342,7 @@ GEM rubocop-performance (1.14.2) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.15.1) + rubocop-rails (2.15.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f32c133f..cdcaa657 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,10 +42,4 @@ def embeddable_url(druid) def with_copyright_symbol(str) str.gsub(/\(c\) Copyright/i, '© Copyright') end - - def format_mods_content(values) - text = link_urls_and_email(values.join("\n\n").gsub(' ', "\n")) - - simple_format text, {}, sanitize: false - end end diff --git a/app/views/purl/_mods_abstract_contents.html.erb b/app/views/purl/_mods_abstract_contents.html.erb index 3e917792..34c9768c 100644 --- a/app/views/purl/_mods_abstract_contents.html.erb +++ b/app/views/purl/_mods_abstract_contents.html.erb @@ -1,18 +1,8 @@ <% document ||= @document %> -<% document.mods.abstract.each do |abstracts| %> - <% if abstracts.respond_to?(:values) %> - <%= mods_display_label(abstracts.label) %> -
- <%= format_mods_content(abstracts.values) %> -
- <% end %> +<% document.mods.abstract.each do |abstract| %> + <%= mods_record_field(abstract) %> <% end %> <% document.mods.contents.each do |contents| %> - <% if contents.respond_to?(:values) %> - <%= mods_display_label(contents.label) %> -
- <%= format_mods_content(contents.values) %> -
- <% end %> + <%= mods_record_field(contents) %> <% end %> diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb deleted file mode 100644 index dc2ec4ab..00000000 --- a/spec/helpers/application_helper_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'rails_helper' - -describe ApplicationHelper do - describe '#format_mods_content' do - it 'makes the string html safe' do - expect(helper.format_mods_content(['blah'])).to be_html_safe - end - - it 'separates duplicate values into paragraphs' do - expect(helper.format_mods_content(%w[a b])).to eq "

a

\n\n

b

" - end - - it 'separates encoded new lines into paragraphs' do - expect(helper.format_mods_content(['a b'])).to eq "

a

\n\n

b

" - end - - it 'escapes data' do - value = '1. sér. (1787 à 1799) t. 1-; --2. sér. (1880-1860) t. 1-127, 1862-1913.' - expected = '1. sér. (1787 à 1799) t. 1-<t. 82>; --2. sér. (1880-1860) t. 1-127, 1862-1913.' - expect(helper.format_mods_content([value])).to eq "

#{expected}

" - end - end -end