From 52b044d6a4278c229992404ad5801769c2d13363 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 24 Aug 2025 20:29:54 +0200 Subject: First commit. Vive le Castel Peter ! --- app/views/crops/_crop.html.erb | 92 +++++++++++++++++++++++++++++++++++ app/views/crops/_form.html.erb | 107 +++++++++++++++++++++++++++++++++++++++++ app/views/crops/edit.html.erb | 12 +++++ app/views/crops/index.html.erb | 16 ++++++ app/views/crops/new.html.erb | 11 +++++ app/views/crops/show.html.erb | 10 ++++ 6 files changed, 248 insertions(+) create mode 100644 app/views/crops/_crop.html.erb create mode 100644 app/views/crops/_form.html.erb create mode 100644 app/views/crops/edit.html.erb create mode 100644 app/views/crops/index.html.erb create mode 100644 app/views/crops/new.html.erb create mode 100644 app/views/crops/show.html.erb (limited to 'app/views/crops') 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 @@ +
+

+ Name: + <%= crop.name %> +

+ +

+ Crop type: + <%= crop.crop_type %> +

+ +

+ Nno3: + <%= crop.nno3 %> +

+ +

+ P: + <%= crop.p %> +

+ +

+ K: + <%= crop.k %> +

+ +

+ Ca: + <%= crop.ca %> +

+ +

+ Mg: + <%= crop.mg %> +

+ +

+ S: + <%= crop.s %> +

+ +

+ Na: + <%= crop.na %> +

+ +

+ Cl: + <%= crop.cl %> +

+ +

+ Si: + <%= crop.si %> +

+ +

+ Fe: + <%= crop.fe %> +

+ +

+ Zn: + <%= crop.zn %> +

+ +

+ B: + <%= crop.b %> +

+ +

+ Mn: + <%= crop.mn %> +

+ +

+ Cu: + <%= crop.cu %> +

+ +

+ Mo: + <%= crop.mo %> +

+ +

+ Nnh4: + <%= crop.nnh4 %> +

+ +
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? %> +
+

<%= pluralize(crop.errors.count, "error") %> prohibited this crop from being saved:

+ + +
+ <% end %> + +
+ <%= form.label :name, style: "display: block" %> + <%= form.text_field :name %> +
+ +
+ <%= form.label :crop_type, style: "display: block" %> + <%= form.number_field :crop_type %> +
+ +
+ <%= form.label :nno3, style: "display: block" %> + <%= form.text_field :nno3 %> +
+ +
+ <%= form.label :p, style: "display: block" %> + <%= form.text_field :p %> +
+ +
+ <%= form.label :k, style: "display: block" %> + <%= form.text_field :k %> +
+ +
+ <%= form.label :ca, style: "display: block" %> + <%= form.text_field :ca %> +
+ +
+ <%= form.label :mg, style: "display: block" %> + <%= form.text_field :mg %> +
+ +
+ <%= form.label :s, style: "display: block" %> + <%= form.text_field :s %> +
+ +
+ <%= form.label :na, style: "display: block" %> + <%= form.text_field :na %> +
+ +
+ <%= form.label :cl, style: "display: block" %> + <%= form.text_field :cl %> +
+ +
+ <%= form.label :si, style: "display: block" %> + <%= form.text_field :si %> +
+ +
+ <%= form.label :fe, style: "display: block" %> + <%= form.text_field :fe %> +
+ +
+ <%= form.label :zn, style: "display: block" %> + <%= form.text_field :zn %> +
+ +
+ <%= form.label :b, style: "display: block" %> + <%= form.text_field :b %> +
+ +
+ <%= form.label :mn, style: "display: block" %> + <%= form.text_field :mn %> +
+ +
+ <%= form.label :cu, style: "display: block" %> + <%= form.text_field :cu %> +
+ +
+ <%= form.label :mo, style: "display: block" %> + <%= form.text_field :mo %> +
+ +
+ <%= form.label :nnh4, style: "display: block" %> + <%= form.text_field :nnh4 %> +
+ +
+ <%= form.submit %> +
+<% 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" %> + +

Editing crop

+ +<%= render "form", crop: @crop %> + +
+ +
+ <%= link_to "Show this crop", @crop %> | + <%= link_to "Back to crops", crops_path %> +
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 @@ +

<%= notice %>

+ +<% content_for :title, "Crops" %> + +

Crops

+ +
+ <% @crops.each do |crop| %> + <%= render crop %> +

+ <%= link_to "Show this crop", crop %> +

+ <% end %> +
+ +<%= 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" %> + +

New crop

+ +<%= render "form", crop: @crop %> + +
+ +
+ <%= link_to "Back to crops", crops_path %> +
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 @@ +

<%= notice %>

+ +<%= render @crop %> + +
+ <%= link_to "Edit this crop", edit_crop_path(@crop) %> | + <%= link_to "Back to crops", crops_path %> + + <%= button_to "Destroy this crop", @crop, method: :delete %> +
-- cgit v1.2.3