summaryrefslogtreecommitdiff
path: root/app/views/crops
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/crops')
-rw-r--r--app/views/crops/_crop.html.erb92
-rw-r--r--app/views/crops/_form.html.erb107
-rw-r--r--app/views/crops/edit.html.erb12
-rw-r--r--app/views/crops/index.html.erb16
-rw-r--r--app/views/crops/new.html.erb11
-rw-r--r--app/views/crops/show.html.erb10
6 files changed, 248 insertions, 0 deletions
diff --git a/app/views/crops/_crop.html.erb b/app/views/crops/_crop.html.erb
new file mode 100644
index 0000000..e9b9b4d
--- /dev/null
+++ b/app/views/crops/_crop.html.erb
@@ -0,0 +1,92 @@
+<div id="<%= dom_id crop %>">
+ <p>
+ <strong>Name:</strong>
+ <%= crop.name %>
+ </p>
+
+ <p>
+ <strong>Crop type:</strong>
+ <%= crop.crop_type %>
+ </p>
+
+ <p>
+ <strong>Nno3:</strong>
+ <%= crop.nno3 %>
+ </p>
+
+ <p>
+ <strong>P:</strong>
+ <%= crop.p %>
+ </p>
+
+ <p>
+ <strong>K:</strong>
+ <%= crop.k %>
+ </p>
+
+ <p>
+ <strong>Ca:</strong>
+ <%= crop.ca %>
+ </p>
+
+ <p>
+ <strong>Mg:</strong>
+ <%= crop.mg %>
+ </p>
+
+ <p>
+ <strong>S:</strong>
+ <%= crop.s %>
+ </p>
+
+ <p>
+ <strong>Na:</strong>
+ <%= crop.na %>
+ </p>
+
+ <p>
+ <strong>Cl:</strong>
+ <%= crop.cl %>
+ </p>
+
+ <p>
+ <strong>Si:</strong>
+ <%= crop.si %>
+ </p>
+
+ <p>
+ <strong>Fe:</strong>
+ <%= crop.fe %>
+ </p>
+
+ <p>
+ <strong>Zn:</strong>
+ <%= crop.zn %>
+ </p>
+
+ <p>
+ <strong>B:</strong>
+ <%= crop.b %>
+ </p>
+
+ <p>
+ <strong>Mn:</strong>
+ <%= crop.mn %>
+ </p>
+
+ <p>
+ <strong>Cu:</strong>
+ <%= crop.cu %>
+ </p>
+
+ <p>
+ <strong>Mo:</strong>
+ <%= crop.mo %>
+ </p>
+
+ <p>
+ <strong>Nnh4:</strong>
+ <%= crop.nnh4 %>
+ </p>
+
+</div>
diff --git a/app/views/crops/_form.html.erb b/app/views/crops/_form.html.erb
new file mode 100644
index 0000000..90226b6
--- /dev/null
+++ b/app/views/crops/_form.html.erb
@@ -0,0 +1,107 @@
+<%= form_with(model: crop) do |form| %>
+ <% if crop.errors.any? %>
+ <div style="color: red">
+ <h2><%= pluralize(crop.errors.count, "error") %> prohibited this crop from being saved:</h2>
+
+ <ul>
+ <% crop.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 :crop_type, style: "display: block" %>
+ <%= form.number_field :crop_type %>
+ </div>
+
+ <div>
+ <%= form.label :nno3, style: "display: block" %>
+ <%= form.text_field :nno3 %>
+ </div>
+
+ <div>
+ <%= form.label :p, style: "display: block" %>
+ <%= form.text_field :p %>
+ </div>
+
+ <div>
+ <%= form.label :k, style: "display: block" %>
+ <%= form.text_field :k %>
+ </div>
+
+ <div>
+ <%= form.label :ca, style: "display: block" %>
+ <%= form.text_field :ca %>
+ </div>
+
+ <div>
+ <%= form.label :mg, style: "display: block" %>
+ <%= form.text_field :mg %>
+ </div>
+
+ <div>
+ <%= form.label :s, style: "display: block" %>
+ <%= form.text_field :s %>
+ </div>
+
+ <div>
+ <%= form.label :na, style: "display: block" %>
+ <%= form.text_field :na %>
+ </div>
+
+ <div>
+ <%= form.label :cl, style: "display: block" %>
+ <%= form.text_field :cl %>
+ </div>
+
+ <div>
+ <%= form.label :si, style: "display: block" %>
+ <%= form.text_field :si %>
+ </div>
+
+ <div>
+ <%= form.label :fe, style: "display: block" %>
+ <%= form.text_field :fe %>
+ </div>
+
+ <div>
+ <%= form.label :zn, style: "display: block" %>
+ <%= form.text_field :zn %>
+ </div>
+
+ <div>
+ <%= form.label :b, style: "display: block" %>
+ <%= form.text_field :b %>
+ </div>
+
+ <div>
+ <%= form.label :mn, style: "display: block" %>
+ <%= form.text_field :mn %>
+ </div>
+
+ <div>
+ <%= form.label :cu, style: "display: block" %>
+ <%= form.text_field :cu %>
+ </div>
+
+ <div>
+ <%= form.label :mo, style: "display: block" %>
+ <%= form.text_field :mo %>
+ </div>
+
+ <div>
+ <%= form.label :nnh4, style: "display: block" %>
+ <%= form.text_field :nnh4 %>
+ </div>
+
+ <div>
+ <%= form.submit %>
+ </div>
+<% end %>
diff --git a/app/views/crops/edit.html.erb b/app/views/crops/edit.html.erb
new file mode 100644
index 0000000..54c616c
--- /dev/null
+++ b/app/views/crops/edit.html.erb
@@ -0,0 +1,12 @@
+<% content_for :title, "Editing crop" %>
+
+<h1>Editing crop</h1>
+
+<%= render "form", crop: @crop %>
+
+<br>
+
+<div>
+ <%= link_to "Show this crop", @crop %> |
+ <%= link_to "Back to crops", crops_path %>
+</div>
diff --git a/app/views/crops/index.html.erb b/app/views/crops/index.html.erb
new file mode 100644
index 0000000..bae09fa
--- /dev/null
+++ b/app/views/crops/index.html.erb
@@ -0,0 +1,16 @@
+<p style="color: green"><%= notice %></p>
+
+<% content_for :title, "Crops" %>
+
+<h1>Crops</h1>
+
+<div id="crops">
+ <% @crops.each do |crop| %>
+ <%= render crop %>
+ <p>
+ <%= link_to "Show this crop", crop %>
+ </p>
+ <% end %>
+</div>
+
+<%= link_to "New crop", new_crop_path %>
diff --git a/app/views/crops/new.html.erb b/app/views/crops/new.html.erb
new file mode 100644
index 0000000..4ef4da5
--- /dev/null
+++ b/app/views/crops/new.html.erb
@@ -0,0 +1,11 @@
+<% content_for :title, "New crop" %>
+
+<h1>New crop</h1>
+
+<%= render "form", crop: @crop %>
+
+<br>
+
+<div>
+ <%= link_to "Back to crops", crops_path %>
+</div>
diff --git a/app/views/crops/show.html.erb b/app/views/crops/show.html.erb
new file mode 100644
index 0000000..971f097
--- /dev/null
+++ b/app/views/crops/show.html.erb
@@ -0,0 +1,10 @@
+<p style="color: green"><%= notice %></p>
+
+<%= render @crop %>
+
+<div>
+ <%= link_to "Edit this crop", edit_crop_path(@crop) %> |
+ <%= link_to "Back to crops", crops_path %>
+
+ <%= button_to "Destroy this crop", @crop, method: :delete %>
+</div>
Copyright 2019--2025 Marius PETER