Fix header on artists/albums pages
I'm realizing what I have is extremely fragile, so not ideal, but not a bad starting place I would say
This commit is contained in:
parent
a55f4e7bc0
commit
8a70239170
4 changed files with 6 additions and 7 deletions
|
|
@ -16,8 +16,9 @@ pub fn index(request: *jetzig.Request) !jetzig.View {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
|
pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
|
||||||
|
const album = try jetzig.database.Query(.Album).find(id).execute(request.repo);
|
||||||
var root = try request.data(.object);
|
var root = try request.data(.object);
|
||||||
try root.put("album_id", id);
|
try root.put("album", album.?.name);
|
||||||
var songs_view = try root.put("songs", .array);
|
var songs_view = try root.put("songs", .array);
|
||||||
const query = jetzig.database.Query(.Albumsong).include(.song, .{ .select = .{ .name, .id } }).join(.inner, .album).where(.{ .album = .{ .id = id } });
|
const query = jetzig.database.Query(.Albumsong).include(.song, .{ .select = .{ .name, .id } }).join(.inner, .album).where(.{ .album = .{ .id = id } });
|
||||||
const songs = try request.repo.all(query);
|
const songs = try request.repo.all(query);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@partial partials/header
|
@partial partials/header
|
||||||
<h1>no one lol</h1>
|
<h1>{{.album}}</h1>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,9 @@ pub fn index(request: *jetzig.Request) !jetzig.View {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
|
pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
|
||||||
//const artist_name = jetzig.database.Query(.Artist).find().select(.{.name}).execute(request.repo);
|
const artist = try jetzig.database.Query(.Artist).find(id).execute(request.repo);
|
||||||
std.log.debug("page: {s}", .{id});
|
|
||||||
var root = try request.data(.object);
|
var root = try request.data(.object);
|
||||||
//try root.put("artist", artist_name);
|
try root.put("artist", artist.?.name);
|
||||||
try root.put("artist_id", id);
|
|
||||||
var albums_view = try root.put("albums", .array);
|
var albums_view = try root.put("albums", .array);
|
||||||
const query = jetzig.database.Query(.Albumartist).include(.album, .{ .select = .{ .name, .id } }).join(.inner, .artist).where(.{ .artist = .{ .id = id } });
|
const query = jetzig.database.Query(.Albumartist).include(.album, .{ .select = .{ .name, .id } }).join(.inner, .artist).where(.{ .artist = .{ .id = id } });
|
||||||
const albums = try request.repo.all(query);
|
const albums = try request.repo.all(query);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@partial partials/header
|
@partial partials/header
|
||||||
<h1>no one lol</h1>
|
<h1>{{.artist}}</h1>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue