Skip to content

Commit

Permalink
use file_url if name not set for old files
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Oct 17, 2024
1 parent 2c9f1df commit 9370e7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/views/documents/_document.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="col-12 col-md-6 p-3">
<i class="fa fa-file fa-2x me-2 text-warning"></i>
<span class="name text-wrap text-break <%= "supplemental" if document.supplemental? %>">
<%= document.name %>
<%= document.name ? document.name : File.basename(document.file_url) %>
</span>
<span class="weak small">[<%=number_to_human_size document.file.file.size rescue nil %>]</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/documents/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<% end %>
</div>

<% if @document.name %>
<% if @document.name || @document.file_url %>
<div class="alert alert-warning" role="alert">
Replacing: <%= @document.name %>
Replacing: <%= @document.name ? @document.name : File.basename(@document.file_url) %>
</div>
<% end %>
Expand Down

0 comments on commit 9370e7b

Please sign in to comment.