diff --git a/app/views/categories/_form.html.erb b/app/views/categories/_form.html.erb index 16866be..0839105 100644 --- a/app/views/categories/_form.html.erb +++ b/app/views/categories/_form.html.erb @@ -1,41 +1,24 @@ -<%= form_with(model: category, class: "space-y-6 max-w-2xl mx-auto bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8") do |form| %> + +<%= form_with(model: category, class: "space-y-6") do |form| %> + + <%= render "layouts/form_errors", model: category %> - <% if category.errors.any? %> - - <% end %> - -
-

Kategorie-Details

-

Definiere eine übergeordnete Gruppe für dein Inventar (z.B. Laptops oder Bürostühle).

-
- -
- - -
- <%= form.label :name, "Name der Kategorie", class: "block text-sm font-medium mb-2 text-gray-700" %> - <%= form.text_field :name, required: true, class: "py-2.5 px-4 block w-full border border-gray-300 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 bg-gray-50/50", placeholder: "z.B. IT-Infrastruktur" %> + +
+ <%= form.label :name, "Kategoriebezeichnung", class: "block text-sm font-semibold text-gray-700" %> + <%= form.text_field :name, placeholder: "z.B. Laptops, Monitore, Server...", class: "py-2.5 px-3 block w-full border border-gray-300 rounded-lg text-sm bg-gray-50/50 focus:border-blue-500 focus:ring-blue-500" %>
-
- <%= form.label :description, "Beschreibung / Notizen", class: "block text-sm font-medium mb-2 text-gray-700" %> +
+ <%= form.label :description, "Beschreibung / Notizen", class: "block text-sm font-semibold text-gray-700" %> <%= form.text_area :description, rows: 4, class: "py-2.5 px-4 block w-full border border-gray-300 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 bg-gray-50/50", placeholder: "Welche Art von Gegenständen fällt in diese Kategorie?..." %>
-
- - -
- <%= link_to "Abbrechen", categories_path, class: "py-2.5 px-4 inline-flex items-center text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition shadow-sm" %> - <%= form.submit "Kategorie speichern", class: "py-2.5 px-4 inline-flex items-center text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 shadow-sm transition cursor-pointer" %> + +
+ <%= link_to "Abbrechen", categories_path, class: "py-2 px-4 text-sm font-semibold rounded-lg border border-gray-200 bg-white text-gray-700 hover:bg-gray-50 transition" %> + <%= form.submit "Kategorie speichern", class: "py-2 px-4 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 shadow-sm transition cursor-pointer" %>
<% end %> diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb index 19532ea..8fa4c55 100644 --- a/app/views/categories/index.html.erb +++ b/app/views/categories/index.html.erb @@ -1,4 +1,16 @@ -<% content_for :title, "Kategorien & Typen" %> +<% content_for :title, "Kategorien" %> + + +<% content_for :top_bar_actions do %> + <%= link_to new_category_path, class: "py-2 px-4 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 flex items-center gap-1.5 shadow-sm transition" do %> + + + + + <% end %> +<% end %>
diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb index b434e06..ee1ad8c 100644 --- a/app/views/categories/new.html.erb +++ b/app/views/categories/new.html.erb @@ -1,5 +1,30 @@ -<% content_for :title, "Neue Kategorie erstellen" %> +<% content_for :title, "Kategorien anlegen" %> -
- <%= render "form", category: @category %> +<% content_for :top_bar_actions do %> + <%= link_to rooms_path, class: "py-2 px-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center gap-1.5 shadow-sm transition" do %> + + + <% end %> +<% end %> + +
+
+ +
+
+ + + +
+
+

Kategorie erstellen

+

Definiere einen neuen Hardware-Typ für deine Bestandsliste.

+
+
+ + <%= render "form", category: @category %> + +
diff --git a/app/views/items/_form.html.erb b/app/views/items/_form.html.erb index 8b90316..5691da2 100644 --- a/app/views/items/_form.html.erb +++ b/app/views/items/_form.html.erb @@ -1,15 +1,6 @@ <%= form_with(model: item, class: "space-y-6 max-w-2xl mx-auto bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8") do |form| %> - <% if item.errors.any? %> - - <% end %> + <%= render "layouts/form_errors", model: item %>

diff --git a/app/views/items/index.html.erb b/app/views/items/index.html.erb index dd7ca99..6c74c5d 100644 --- a/app/views/items/index.html.erb +++ b/app/views/items/index.html.erb @@ -4,7 +4,9 @@ <% content_for :top_bar_actions do %> <%= link_to new_item_path, class: "py-2 px-4 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 flex items-center gap-1.5 shadow-sm transition" do %> - Artikel hinzufügen + <% end %> <% end %> diff --git a/app/views/items/show.html.erb b/app/views/items/show.html.erb index e594c06..cc0675d 100644 --- a/app/views/items/show.html.erb +++ b/app/views/items/show.html.erb @@ -1,20 +1,3 @@ - - <% content_for :title, "Artikel-Details" %> diff --git a/app/views/layouts/_form_errors.html.erb b/app/views/layouts/_form_errors.html.erb new file mode 100644 index 0000000..a75d9c0 --- /dev/null +++ b/app/views/layouts/_form_errors.html.erb @@ -0,0 +1,18 @@ +<% if model.errors.any? %> +
+ + + + +
+

+ <%= model.class.model_name.human %> konnte nicht gespeichert werden +

+
    + <% model.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
+
+
+<% end %> \ No newline at end of file diff --git a/app/views/rooms/_form.html.erb b/app/views/rooms/_form.html.erb index 6d15a09..69f636c 100644 --- a/app/views/rooms/_form.html.erb +++ b/app/views/rooms/_form.html.erb @@ -1,15 +1,6 @@ <%= form_with(model: room, class: "space-y-6 max-w-xl mx-auto bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8") do |form| %> - <% if room.errors.any? %> - - <% end %> + <%= render "layouts/form_errors", model: room %>

diff --git a/app/views/rooms/index.html.erb b/app/views/rooms/index.html.erb index 44d60a5..b729f7b 100644 --- a/app/views/rooms/index.html.erb +++ b/app/views/rooms/index.html.erb @@ -8,7 +8,9 @@ - Raum anlegen + <% end %> <% end %> diff --git a/app/views/rooms/new.html.erb b/app/views/rooms/new.html.erb index 0cc5c8b..e1eff05 100644 --- a/app/views/rooms/new.html.erb +++ b/app/views/rooms/new.html.erb @@ -1,9 +1,11 @@ -<% content_for :title, "Neuen Raum hinzufügen" %> +<% content_for :title, "Raum anlegen" %> <% content_for :top_bar_actions do %> <%= link_to rooms_path, class: "py-2 px-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center gap-1.5 shadow-sm transition" do %> - Zurück zur Übersicht + <% end %> <% end %>