mirror of
https://github.com/danbee/my-images
synced 2025-03-04 08:49:05 +00:00
43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
<% content_for :title do %>
|
|
<h1><%= link_to "My Albums", albums_path %></h1>
|
|
<% end %>
|
|
|
|
<% if @album.present? %>
|
|
<h2><%= @album.title %></h2>
|
|
<% end %>
|
|
|
|
<ul class="images">
|
|
<% @images.each do |image| %>
|
|
<li>
|
|
<%= link_to image_tag(image.image.thumb('200x200#').url),
|
|
image_path(image), class: :image %><br>
|
|
<%= link_to 'Delete', image_path(image),
|
|
method: :delete, data: { confirm: 'Are you sure?' } %>
|
|
</li>
|
|
<% end %>
|
|
|
|
<li class="images__upload" data-controller="uploads">
|
|
<%= form_for(
|
|
@images.new,
|
|
html: {
|
|
class: "images__upload-form",
|
|
data: {"uploads-target": "form"}
|
|
}
|
|
) do |f| %>
|
|
<%= f.hidden_field :user_id %>
|
|
<%= f.hidden_field :album_id %>
|
|
<%= f.file_field(
|
|
:images,
|
|
class: "images__upload-input",
|
|
multiple: true,
|
|
accept: "image/*",
|
|
data: {"uploads-target": "fileField"}
|
|
) %>
|
|
<label for="image_images" class="images__upload-label">
|
|
<span>↑</span>
|
|
Upload
|
|
</label>
|
|
<% end %>
|
|
</li>
|
|
</ul>
|