Update Search view
This commit is contained in:
parent
75a63a19fc
commit
8f34815904
4 changed files with 24 additions and 25 deletions
|
|
@ -13,5 +13,5 @@ pub const getTrack = \\SELECT artist, track, album, plays FROM tracks WHERE trac
|
|||
pub const getTrackSearch = \\SELECT url FROM artists WHERE artist == ?
|
||||
;
|
||||
|
||||
pub const getArtistSearch = \\SELECT artist, plays FROM artists WHERE artist LIKE '%' || ? || '%'
|
||||
pub const getArtistSearch = \\SELECT artist, url FROM artists WHERE artist LIKE '%' || ? || '%'
|
||||
;
|
||||
|
|
@ -27,7 +27,7 @@ pub fn index(request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
|||
const artistResults = try artistSearch.all(
|
||||
struct {
|
||||
artist: []u8,
|
||||
url: usize,
|
||||
url: []u8,
|
||||
},
|
||||
arena.allocator(),
|
||||
.{},
|
||||
|
|
@ -36,8 +36,8 @@ pub fn index(request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
|||
|
||||
for (artistResults) |r| {
|
||||
std.log.debug("artist: {s}, url: {s}", .{ r.artist, r.url });
|
||||
root.append(data.string(r.artist));
|
||||
root.append(data.string(r.url));
|
||||
try root.append(data.string(r.artist));
|
||||
try root.append(data.string(r.url));
|
||||
//std.log.debug("{s}", .{r});
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4,12 +4,15 @@
|
|||
<th>Album</th>
|
||||
<th>Track</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@zig {
|
||||
for (0..)
|
||||
<td id="artistUpdate"></td>
|
||||
<td id="albumUpdate"></td>
|
||||
<td id="trackUpdate"></td>
|
||||
@zig ZIG
|
||||
for (zmpl.items(.array), 0..) |u,i| {
|
||||
if(@mod(i,2)==0){
|
||||
<tr>
|
||||
<td id="artistUpdate"><a href={{zmpl.items(.array)[i+1].string.value}}>{{u}}</a></td>
|
||||
<td id="albumUpdate">{{i}}</td>
|
||||
<td id="trackUpdate"></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tr>
|
||||
ZIG
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue