1
0
mirror of https://github.com/danbee/my-images synced 2025-03-04 08:49:05 +00:00
my-images/app/views/images/index.html.erb
2024-03-25 20:26:50 -05:00

28 lines
684 B
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 %>
</ul>
<h2>Upload New Image</h2>
<%= simple_form_for @images.new do |f| %>
<%= f.input :user_id, as: :hidden %>
<%= f.input :album_id, as: :hidden %>
<%= f.input :image, as: :file %>
<%= f.submit %>
<% end %>