Added Search function for items and fixed javascript controller
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2026-05-25 04:23:08 +02:00
parent 650b83bdf4
commit 204a6c05dc
9 changed files with 178 additions and 121 deletions

View File

@@ -9,7 +9,17 @@ class CategoriesController < ApplicationController
# GET /categories/1 or /categories/1.json
def show
@category = Category.find(params[:id])
@items = @category.items.includes(:user, :room).order(:name)
# Basis-Abfrage: Alle Items dieser Kategorie laden
@items = @category.items.includes(:user, :room).order(created_at: :desc)
if params[:query].present?
query_str = "%#{params[:query]}%"
@items = @items.where(
"items.name LIKE :q OR items.sku LIKE :q OR items.serial_number LIKE :q OR items.sticker_id LIKE :q",
q: query_str
)
end
end
# GET /categories/new