app/views/pages/show.html.erb
<% title @page.url %>
<h1>Dontfile</h1>
<div id="container" data-path="<%= @page.url %>">
<div id="text-area">
<h2>Text</h2>
<textarea id="text"><%= @page.content %></textarea>
</div>
<h2>File</h2>
<div id="file-area">
<div>
<h4>(Max size: 100mb)</h4>
<input type="file" id="file" onchange="saveFile()">
</div>
<div id="attachment">
<% if @page.file.attached? %>
<%= attachment_icon(@page.file_blob.content_type) %>
<p><%= @page.file_blob.filename %></p>
<div id="buttons">
<a class="button" title='Download File' href="<%= rails_blob_url(@page.file) %>" download>
<%= icon('far', 'arrow-alt-circle-down') %>
</a>
<%= button_to delete_file_path,
method: :delete,
params: { url: @page.url },
title: 'Delete File',
data: { confirm: "Are you sure?" },
class: 'button' do %>
<%= icon('far', 'trash-alt') %>
<% end %>
</div>
<% end %>
</div>
</div>
<progress id="file-upload-progress" value="0"></progress>
</div>