diff --git a/src/app/views/groups/index.zmpl b/src/app/views/groups/index.zmpl index 76457d0..1522924 100644 --- a/src/app/views/groups/index.zmpl +++ b/src/app/views/groups/index.zmpl @@ -1,3 +1,11 @@ -
- Content goes here -
+ + + + +@partial partials/header + +

Merge Songs

+
+ +
+
\ No newline at end of file diff --git a/src/app/views/songs.zig b/src/app/views/songs.zig index b24dbf5..2ed2e06 100644 --- a/src/app/views/songs.zig +++ b/src/app/views/songs.zig @@ -5,7 +5,15 @@ const queries = @import("../../queries.zig"); pub fn index(request: *jetzig.Request) !jetzig.View { var root = try request.data(.object); - const songs = try queries.entityQueryResult(request, queries.loadQuery(.song, .entities), .{}); + const htmx_query = (try request.queryParams()).getT(.string, "s"); + + try root.put("htmx", htmx_query != null); + + const songs = if (htmx_query) |name| + try queries.entityQueryResult(request, queries.loadQuery(.song, .entities_by_name), .{name}) + else + try queries.entityQueryResult(request, queries.loadQuery(.song, .entities), .{}); + try root.put("songs", songs); return request.render(.ok); diff --git a/src/app/views/songs/index.zmpl b/src/app/views/songs/index.zmpl index 6964630..862b753 100644 --- a/src/app/views/songs/index.zmpl +++ b/src/app/views/songs/index.zmpl @@ -1,6 +1,6 @@ @zig { const ColumnChoices = []const enum{song, album, artist, artistlist, scrobbles, date}; - const columns: ColumnChoices = &.{.song, .artistlist, .scrobbles}; + const columns: ColumnChoices = &.{.song, .album, .artistlist, .scrobbles}; } @@ -8,8 +8,10 @@ + @if (! $.htmx) @partial partials/header

Songs

+ @end @partial partials/newtable(T: ColumnChoices, table_data: .songs, columns: columns) \ No newline at end of file