mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-07-01 05:26:07 +00:00
Merge pull request #213 from uzyn/init-layout
Initialized project uses layout
This commit is contained in:
commit
848c91af2c
@ -153,6 +153,14 @@ pub fn run(
|
|||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
try copySourceFile(
|
||||||
|
allocator,
|
||||||
|
install_dir,
|
||||||
|
"demo/src/app/views/layouts/default.zmpl",
|
||||||
|
"src/app/views/layouts/default.zmpl",
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
|
||||||
try copySourceFile(
|
try copySourceFile(
|
||||||
allocator,
|
allocator,
|
||||||
install_dir,
|
install_dir,
|
||||||
|
@ -26,6 +26,7 @@ pub fn initDataModule(build: *std.Build) !*std.Build.Module {
|
|||||||
"demo/src/app/views/init.zig",
|
"demo/src/app/views/init.zig",
|
||||||
"demo/src/app/views/init/index.zmpl",
|
"demo/src/app/views/init/index.zmpl",
|
||||||
"demo/src/app/views/init/_content.zmpl",
|
"demo/src/app/views/init/_content.zmpl",
|
||||||
|
"demo/src/app/views/layouts/default.zmpl",
|
||||||
"demo/public/jetzig.png",
|
"demo/public/jetzig.png",
|
||||||
"demo/public/zmpl.png",
|
"demo/public/zmpl.png",
|
||||||
"demo/public/favicon.ico",
|
"demo/public/favicon.ico",
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const jetzig = @import("jetzig");
|
const jetzig = @import("jetzig");
|
||||||
|
|
||||||
|
pub const layout = "default";
|
||||||
|
|
||||||
/// `src/app/views/root.zig` represents the root URL `/`
|
/// `src/app/views/root.zig` represents the root URL `/`
|
||||||
/// The `index` view function is invoked when when the HTTP verb is `GET`.
|
/// The `index` view function is invoked when when the HTTP verb is `GET`.
|
||||||
/// Other view types are invoked either by passing a resource ID value (e.g. `/1234`) or by using
|
/// Other view types are invoked either by passing a resource ID value (e.g. `/1234`) or by using
|
||||||
|
@ -1,22 +1,10 @@
|
|||||||
<html>
|
<div class="text-center pt-10 m-auto">
|
||||||
<head>
|
<!-- If present, renders the `message_param` response data value, add `?message=hello` to the
|
||||||
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
URL to see the output: -->
|
||||||
|
<h2 class="param text-3xl text-[#f7931e]">{{$.message_param}}</h2>
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<!-- Renders `src/app/views/init/_content.zmpl`, passing in the `welcome_message` field from template data. -->
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<div>
|
||||||
<link rel="stylesheet" href="/styles.css" />
|
@partial init/content(message: $.welcome_message)
|
||||||
</head>
|
</div>
|
||||||
|
</div>
|
||||||
<body>
|
|
||||||
<div class="text-center pt-10 m-auto">
|
|
||||||
<!-- If present, renders the `message_param` response data value, add `?message=hello` to the
|
|
||||||
URL to see the output: -->
|
|
||||||
<h2 class="param text-3xl text-[#f7931e]">{{$.message_param}}</h2>
|
|
||||||
|
|
||||||
<!-- Renders `src/app/views/init/_content.zmpl`, passing in the `welcome_message` field from template data. -->
|
|
||||||
<div>
|
|
||||||
@partial init/content(message: $.welcome_message)
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
14
demo/src/app/views/layouts/default.zmpl
Normal file
14
demo/src/app/views/layouts/default.zmpl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
<link rel="stylesheet" href="/styles.css" />
|
||||||
|
<title>Jetzig App</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
{{zmpl.content}}
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user