aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/categories/_form.html.erb
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-14 17:16:43 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-14 17:16:43 +0000
commit2022831d4960054aef904e27fd2934beb4e3c65e (patch)
tree77f11b9c629d66b9782d7dc6c77105bb178116d8 /app/views/categories/_form.html.erb
parent9292aae8fe1876fe98c90ae0216fb4ea8917b38a (diff)
Adds category model but not wired up to resource yet
Diffstat (limited to 'app/views/categories/_form.html.erb')
-rw-r--r--app/views/categories/_form.html.erb32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/views/categories/_form.html.erb b/app/views/categories/_form.html.erb
new file mode 100644
index 0000000..fec6c3b
--- /dev/null
+++ b/app/views/categories/_form.html.erb
@@ -0,0 +1,32 @@
+<%= form_with(model: category, class: "contents") do |form| %>
+ <% if category.errors.any? %>
+ <div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
+ <h2><%= pluralize(category.errors.count, "error") %> prohibited this category from being saved:</h2>
+
+ <ul>
+ <% category.errors.each do |error| %>
+ <li><%= error.full_message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="my-5">
+ <%= required_label_tag(form, :name) %>
+ <%= form.text_field :name, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :colour, class: "font-bold" %>
+ <%= form.text_field :colour, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :badge_foreground_colour, class: "font-bold" %>
+ <%= form.text_field :badge_foreground_colour, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="inline">
+ <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ </div>
+<% end %>