something to play with
This commit is contained in:
17
test/dummy/app/views/images/_form.html.erb
Normal file
17
test/dummy/app/views/images/_form.html.erb
Normal 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 %>
|
2
test/dummy/app/views/images/_image.html.erb
Normal file
2
test/dummy/app/views/images/_image.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<div id="<%= dom_id image %>">
|
||||
</div>
|
10
test/dummy/app/views/images/edit.html.erb
Normal file
10
test/dummy/app/views/images/edit.html.erb
Normal 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>
|
14
test/dummy/app/views/images/index.html.erb
Normal file
14
test/dummy/app/views/images/index.html.erb
Normal 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 %>
|
9
test/dummy/app/views/images/new.html.erb
Normal file
9
test/dummy/app/views/images/new.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<h1>New image</h1>
|
||||
|
||||
<%= render "form", image: @image %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to images", images_path %>
|
||||
</div>
|
10
test/dummy/app/views/images/show.html.erb
Normal file
10
test/dummy/app/views/images/show.html.erb
Normal 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>
|
Reference in New Issue
Block a user