something to play with

This commit is contained in:
2023-02-08 11:30:19 +02:00
parent 208b3b44cb
commit c9031f9dd2
9 changed files with 123 additions and 1 deletions

View File

@ -0,0 +1,17 @@
<%= form_with(model: image) do |form| %>
<% if image.errors.any? %>
<div style="color: red">
<h2><%= pluralize(image.errors.count, "error") %> prohibited this image from being saved:</h2>
<ul>
<% image.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= form.submit %>
</div>
<% end %>

View File

@ -0,0 +1,2 @@
<div id="<%= dom_id image %>">
</div>

View File

@ -0,0 +1,10 @@
<h1>Editing image</h1>
<%= render "form", image: @image %>
<br>
<div>
<%= link_to "Show this image", @image %> |
<%= link_to "Back to images", images_path %>
</div>

View File

@ -0,0 +1,14 @@
<p style="color: green"><%= notice %></p>
<h1>Images</h1>
<div id="images">
<% @images.each do |image| %>
<%= render image %>
<p>
<%= link_to "Show this image", image %>
</p>
<% end %>
</div>
<%= link_to "New image", new_image_path %>

View File

@ -0,0 +1,9 @@
<h1>New image</h1>
<%= render "form", image: @image %>
<br>
<div>
<%= link_to "Back to images", images_path %>
</div>

View File

@ -0,0 +1,10 @@
<p style="color: green"><%= notice %></p>
<%= render @image %>
<div>
<%= link_to "Edit this image", edit_image_path(@image) %> |
<%= link_to "Back to images", images_path %>
<%= button_to "Destroy this image", @image, method: :delete %>
</div>