diff --git a/src/main/controllers.zig b/src/main/controllers.zig index 98cbcf5..ae62126 100644 --- a/src/main/controllers.zig +++ b/src/main/controllers.zig @@ -90,6 +90,8 @@ pub fn EndpointRequest(comptime Endpoint: type) type { body: Body, query: Query, + mount_path: []const u8, + const args_middleware = //if (Args == void) //mdw.injectContext(.{ .args = {} }) //else @@ -120,6 +122,8 @@ fn CallApiEndpoint(comptime Endpoint: type) type { .args = ctx.args, .body = ctx.body, .query = ctx.query_params, + + .mount_path = if (@hasField(@TypeOf(ctx), "mounted_at")) ctx.mounted_at else "", }; var response = Response{ .headers = http.Fields.init(ctx.allocator), .res = res }; diff --git a/src/main/controllers/web.zig b/src/main/controllers/web.zig index eed3e5f..cde66a8 100644 --- a/src/main/controllers/web.zig +++ b/src/main/controllers/web.zig @@ -245,8 +245,22 @@ const drive = struct { const info = try srv.driveGet(req.args.path); defer util.deepFree(srv.allocator, info); + var breadcrumbs = std.ArrayList([]const u8).init(srv.allocator); + defer breadcrumbs.deinit(); + + var iter = util.PathIter.from(req.args.path); + while (iter.next()) |p| { + std.log.debug("breadcrumb: {s}", .{p}); + try breadcrumbs.append(if (p.len != 0) p else continue); + } + switch (info) { - .dir => |dir| try res.template(.ok, srv, dir_tmpl, .{ .dir = dir }), + .dir => |dir| try res.template(.ok, srv, dir_tmpl, .{ + .dir = dir, + .breadcrumbs = breadcrumbs.items, + .mount_path = req.mount_path, + .base_drive_path = "drive", + }), else => unreachable, } } diff --git a/src/main/controllers/web/drive/directory.tmpl.html b/src/main/controllers/web/drive/directory.tmpl.html index 54f2136..aaafe36 100644 --- a/src/main/controllers/web/drive/directory.tmpl.html +++ b/src/main/controllers/web/drive/directory.tmpl.html @@ -1,29 +1,42 @@
- | - | {$dir.name.?} | ++ | + + {$dir.name.?} + + | {#case file |$file|} -- {= #if %user |$u|} + | + {#if %user |$u|} {#if $u.avatar_file_id == $file.meta.id =} - + {= #elif $u.header_file_id == $file.meta.id =} - + {= /if =} - {= /if =} - | -- {= #if $file.meta.sensitive =} - + {= /if} + {#if $file.meta.sensitive =} + {= #else =} - - {= /if =} + + {= /if} + | ++ + {$file.name.?} + | -{$file.name.?} | {#if $file.meta.content_type |$t|}{$t}{/if} | {$file.meta.size} | {$file.meta.created_at} | diff --git a/static/site.css b/static/site.css index e6820a1..5106b6b 100644 --- a/static/site.css +++ b/static/site.css @@ -218,3 +218,8 @@ button:hover, a.button:hover { } } +.drive .icons { + display: flex; + justify-content: flex-end; + vertical-align: bottom; +}