summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/helpers/content_helper.rb4
-rw-r--r--app/models/concerns/file_attachment.rb7
-rw-r--r--app/views/content/_headline_image.html.erb9
3 files changed, 14 insertions, 6 deletions
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index 7a52d9cd..6bb9c4e0 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -75,6 +75,10 @@ module ContentHelper
75 end 75 end
76 end 76 end
77 77
78 def humanized_asset_name asset
79 asset.name.to_s.tr("_", " ")
80 end
81
78 # This method is an output filter for templates. It accepts any kind of text 82 # This method is an output filter for templates. It accepts any kind of text
79 # and checks for an [aggregate short code within it. If such a code is found, 83 # and checks for an [aggregate short code within it. If such a code is found,
80 # its # attributes are parsed and converted into parameters for the 84 # its # attributes are parsed and converted into parameters for the
diff --git a/app/models/concerns/file_attachment.rb b/app/models/concerns/file_attachment.rb
index 62213123..e577c7fa 100644
--- a/app/models/concerns/file_attachment.rb
+++ b/app/models/concerns/file_attachment.rb
@@ -98,11 +98,11 @@ module FileAttachment
98 generate_all_variants(original_path) 98 generate_all_variants(original_path)
99 end 99 end
100 100
101 def generate_variants(original_path) 101 def generate_variants(original_path, extra_args = [])
102 STYLES.each do |style, options| 102 STYLES.each do |style, options|
103 dest_path = file_path(style) 103 dest_path = file_path(style)
104 FileUtils.mkdir_p(File.dirname(dest_path)) 104 FileUtils.mkdir_p(File.dirname(dest_path))
105 system("magick", original_path, *options[:args], dest_path) 105 system("magick", original_path, *extra_args, *options[:args], dest_path)
106 end 106 end
107 end 107 end
108 108
@@ -120,7 +120,8 @@ module FileAttachment
120 elsif VECTOR_CONTENT_TYPES.include?(upload_content_type) 120 elsif VECTOR_CONTENT_TYPES.include?(upload_content_type)
121 generate_svg_variants(original_path) 121 generate_svg_variants(original_path)
122 elsif RASTERIZED_CONTENT_TYPES.include?(upload_content_type) 122 elsif RASTERIZED_CONTENT_TYPES.include?(upload_content_type)
123 generate_variants("#{original_path}[0]") 123 generate_variants("#{original_path}[0]",
124 ["-background", "white", "-alpha", "remove", "-alpha", "off"])
124 end 125 end
125 end 126 end
126 127
diff --git a/app/views/content/_headline_image.html.erb b/app/views/content/_headline_image.html.erb
index 4a3dfdc0..c05b17ef 100644
--- a/app/views/content/_headline_image.html.erb
+++ b/app/views/content/_headline_image.html.erb
@@ -6,8 +6,11 @@
6 <%= link_to @headline_asset.upload.url, :class => "headline_document_card", :target => "_blank", :rel => "noopener" do %> 6 <%= link_to @headline_asset.upload.url, :class => "headline_document_card", :target => "_blank", :rel => "noopener" do %>
7 <%= image_tag @headline_asset.upload.url(:medium), :alt => "", :class => "headline_document_card_thumb" %> 7 <%= image_tag @headline_asset.upload.url(:medium), :alt => "", :class => "headline_document_card_thumb" %>
8 <div class="headline_document_card_info"> 8 <div class="headline_document_card_info">
9 <%= icon("file-text", library: "tabler", "aria-hidden": true) %> 9 <div class="headline_document_card_titlerow">
10 <span class="headline_document_card_title"><%= @headline_asset.name %></span> 10 <%= icon("file-text", library: "tabler", "aria-hidden": true) %>
11 <span class="headline_document_card_title"><%= humanized_asset_name(@headline_asset) %></span>
12 </div>
13 <span class="headline_document_card_meta">PDF ยท <%= number_to_human_size(@headline_asset.upload.size) %></span>
11 </div> 14 </div>
12 <% end %> 15 <% end %>
13<% end %> 16<% end %>
@@ -50,7 +53,7 @@
50 <li> 53 <li>
51 <%= link_to pdf.upload.url, :class => "related_document_link", :target => "_blank", :rel => "noopener" do %> 54 <%= link_to pdf.upload.url, :class => "related_document_link", :target => "_blank", :rel => "noopener" do %>
52 <%= icon("file-text", library: "tabler", "aria-hidden": true) %> 55 <%= icon("file-text", library: "tabler", "aria-hidden": true) %>
53 <span><%= pdf.name %></span> 56 <span><%= humanized_asset_name(pdf) %></span>
54 <% end %> 57 <% end %>
55 </li> 58 </li>
56 <% end %> 59 <% end %>