diff options
author | Marius Peter <marius.peter@tutanota.com> | 2025-08-24 20:29:54 +0200 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2025-08-24 20:29:54 +0200 |
commit | 52b044d6a4278c229992404ad5801769c2d13363 (patch) | |
tree | b30b34da58f26117c035391d09366b190350b1e3 /app/views/fertilizer_products |
First commit.
Vive le Castel Peter !
Diffstat (limited to 'app/views/fertilizer_products')
-rw-r--r-- | app/views/fertilizer_products/_fertilizer_product.html.erb | 12 | ||||
-rw-r--r-- | app/views/fertilizer_products/_form.html.erb | 27 | ||||
-rw-r--r-- | app/views/fertilizer_products/edit.html.erb | 12 | ||||
-rw-r--r-- | app/views/fertilizer_products/index.html.erb | 16 | ||||
-rw-r--r-- | app/views/fertilizer_products/new.html.erb | 11 | ||||
-rw-r--r-- | app/views/fertilizer_products/show.html.erb | 10 |
6 files changed, 88 insertions, 0 deletions
diff --git a/app/views/fertilizer_products/_fertilizer_product.html.erb b/app/views/fertilizer_products/_fertilizer_product.html.erb new file mode 100644 index 0000000..d84a03d --- /dev/null +++ b/app/views/fertilizer_products/_fertilizer_product.html.erb @@ -0,0 +1,12 @@ +<div id="<%= dom_id fertilizer_product %>"> + <p> + <strong>Name:</strong> + <%= fertilizer_product.name %> + </p> + + <p> + <strong>Purity:</strong> + <%= fertilizer_product.purity %> + </p> + +</div> diff --git a/app/views/fertilizer_products/_form.html.erb b/app/views/fertilizer_products/_form.html.erb new file mode 100644 index 0000000..517fe09 --- /dev/null +++ b/app/views/fertilizer_products/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_with(model: fertilizer_product) do |form| %> + <% if fertilizer_product.errors.any? %> + <div style="color: red"> + <h2><%= pluralize(fertilizer_product.errors.count, "error") %> prohibited this fertilizer_product from being saved:</h2> + + <ul> + <% fertilizer_product.errors.each do |error| %> + <li><%= error.full_message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div> + <%= form.label :name, style: "display: block" %> + <%= form.text_field :name %> + </div> + + <div> + <%= form.label :purity, style: "display: block" %> + <%= form.text_field :purity %> + </div> + + <div> + <%= form.submit %> + </div> +<% end %> diff --git a/app/views/fertilizer_products/edit.html.erb b/app/views/fertilizer_products/edit.html.erb new file mode 100644 index 0000000..aa88dad --- /dev/null +++ b/app/views/fertilizer_products/edit.html.erb @@ -0,0 +1,12 @@ +<% content_for :title, "Editing fertilizer product" %> + +<h1>Editing fertilizer product</h1> + +<%= render "form", fertilizer_product: @fertilizer_product %> + +<br> + +<div> + <%= link_to "Show this fertilizer product", @fertilizer_product %> | + <%= link_to "Back to fertilizer products", fertilizer_products_path %> +</div> diff --git a/app/views/fertilizer_products/index.html.erb b/app/views/fertilizer_products/index.html.erb new file mode 100644 index 0000000..f624ffc --- /dev/null +++ b/app/views/fertilizer_products/index.html.erb @@ -0,0 +1,16 @@ +<p style="color: green"><%= notice %></p> + +<% content_for :title, "Fertilizer products" %> + +<h1>Fertilizer products</h1> + +<div id="fertilizer_products"> + <% @fertilizer_products.each do |fertilizer_product| %> + <%= render fertilizer_product %> + <p> + <%= link_to "Show this fertilizer product", fertilizer_product %> + </p> + <% end %> +</div> + +<%= link_to "New fertilizer product", new_fertilizer_product_path %> diff --git a/app/views/fertilizer_products/new.html.erb b/app/views/fertilizer_products/new.html.erb new file mode 100644 index 0000000..81aad79 --- /dev/null +++ b/app/views/fertilizer_products/new.html.erb @@ -0,0 +1,11 @@ +<% content_for :title, "New fertilizer product" %> + +<h1>New fertilizer product</h1> + +<%= render "form", fertilizer_product: @fertilizer_product %> + +<br> + +<div> + <%= link_to "Back to fertilizer products", fertilizer_products_path %> +</div> diff --git a/app/views/fertilizer_products/show.html.erb b/app/views/fertilizer_products/show.html.erb new file mode 100644 index 0000000..ea97041 --- /dev/null +++ b/app/views/fertilizer_products/show.html.erb @@ -0,0 +1,10 @@ +<p style="color: green"><%= notice %></p> + +<%= render @fertilizer_product %> + +<div> + <%= link_to "Edit this fertilizer product", edit_fertilizer_product_path(@fertilizer_product) %> | + <%= link_to "Back to fertilizer products", fertilizer_products_path %> + + <%= button_to "Destroy this fertilizer product", @fertilizer_product, method: :delete %> +</div> |