decided in favor of dedicated COMPONENT() macro, updates to documentation

This commit is contained in:
udo
2026-04-19 11:34:03 +00:00
parent be514d63d6
commit 2b5586d7df
56 changed files with 926 additions and 401 deletions
@@ -4,10 +4,11 @@ RENDER(Request& context)
{
starter_boot(context);
context.var["starter"]["page_title"] = "Login";
StarterUser users(context);
DTree result;
if(context.params["REQUEST_METHOD"] == "POST")
{
result = starter_user_sign_in(context.post["email"], context.post["password"], context);
result = users.sign_in(context.post["email"], context.post["password"]);
if(result["result"].to_string() != "")
{
starter_redirect("account/profile", context);
@@ -3,6 +3,6 @@
RENDER(Request& context)
{
starter_boot(context);
starter_user_logout(context);
StarterUser(context).logout();
starter_redirect("account/login", context);
}
@@ -3,13 +3,14 @@
RENDER(Request& context)
{
starter_boot(context);
if(!starter_is_signed_in(context))
StarterUser users(context);
if(!users.is_signed_in())
{
starter_redirect("account/login", context);
return;
}
context.var["starter"]["page_title"] = "Profile";
DTree user = starter_current_user(context);
DTree user = users.current();
String roles = "";
user["roles"].each([&](DTree role, String key) {
if(roles != "")
@@ -4,9 +4,10 @@ RENDER(Request& context)
{
starter_boot(context);
context.var["starter"]["page_title"] = "Register";
StarterUser users(context);
DTree result;
if(context.params["REQUEST_METHOD"] == "POST")
result = starter_user_create(context.post["email"], context.post["password"], context);
result = users.create(context.post["email"], context.post["password"]);
<>
<h1>Register</h1>
@@ -24,10 +24,10 @@ RENDER(Request& context)
</div>
<div class="card">
<h2>Current Session Status</h2>
<? if(context.session["starter_user_id"] != "") { ?>
<? if(context.session[StarterUser::session_key()] != "") { ?>
<div class="success-card">
<h3>Logged In</h3>
<p>User ID: <?= context.session["starter_user_id"] ?></p>
<p>User ID: <?= context.session[StarterUser::session_key()] ?></p>
</div>
<? } else { ?>
<div class="component-card">
@@ -14,7 +14,7 @@ RENDER(Request& context)
}
else
{
starter_set_status(context, 400, "Bad Request");
context.set_status(400, "Bad Request");
context.var["starter"]["json"]["status"] = "error";
context.var["starter"]["json"]["message"] = "Invalid input";
}
+1 -1
View File
@@ -71,7 +71,7 @@ RENDER(Request& context)
<h2>Theme Families</h2>
<p>Compare the starters built-in theme families and jump to the live gallery.</p>
<div class="theme-grid">
<? starter_cfg("theme/options", context).each([&](DTree theme, String key) {
<? context.cfg.get_by_path("theme/options").each([&](DTree theme, String key) {
if(key != "portal-light" && key != "portal-dark" && key != "localfirst")
return;
StringMap theme_params;
+1 -1
View File
@@ -18,7 +18,7 @@ RENDER(Request& context)
<div class="window-dot green"></div>
<span class="mono-text">marketing_blocks.uce</span>
</div>
<pre class="code-block"><code>RENDER:HERO_SECTION(Request&amp; context)
<pre class="code-block"><code>COMPONENT:HERO_SECTION(Request&amp; context)
{
String title = first(context.call["title"].to_string(), "Welcome");
&lt;&gt;
+10 -1
View File
@@ -10,7 +10,16 @@ RENDER(Request& context)
<p>This is the content of Page 2. You can add more information here.</p>
<p>Sed at dolor leo. Morbi a tellus sed nisl dictum ultricies sit amet at purus. Nam mattis metus sed nunc egestas convallis.</p>
<br/>
<button onclick="$('#page2-section1').load('<?= starter_link("page2-section1", context) ?>')">Load new text</button>
<button id="page2-load-button" data-load-url="<?= starter_link("page2-section1", context) ?>" type="button">Load new text</button>
</div>
<script>
(function () {
const button = document.getElementById('page2-load-button');
if (!button) return;
button.addEventListener('click', function () {
$('#page2-section1').load(button.dataset.loadUrl);
});
}());
</script>
</>
}
@@ -5,9 +5,9 @@ RENDER(Request& context)
starter_boot(context);
context.var["starter"]["page_title"] = "Theme Preview";
starter_register_css("views/themes.css", context);
String current_theme_key = starter_theme_value("key", context);
String theme_label = first(starter_theme_value("label", context), current_theme_key);
String theme_mode = starter_theme_value("mode", context);
String current_theme_key = context.cfg.get_by_path("theme/key").to_string();
String theme_label = first(context.cfg.get_by_path("theme/label").to_string(), current_theme_key);
String theme_mode = context.cfg.get_by_path("theme/mode").to_string();
StringMap theme_params;
theme_params["theme"] = current_theme_key;
+2 -2
View File
@@ -5,7 +5,7 @@ RENDER(Request& context)
starter_boot(context);
context.var["starter"]["page_title"] = "Themes";
starter_register_css("views/themes.css", context);
String current_theme = starter_theme_value("key", context);
String current_theme = context.cfg.get_by_path("theme/key").to_string();
<>
<div class="theme-gallery-shell">
@@ -15,7 +15,7 @@ RENDER(Request& context)
<p>The gallery renders the same preview content in each theme family. This makes it easier to judge shell fit, typography, token balance, and embed behavior.</p>
</section>
<div class="theme-gallery-grid">
<? starter_cfg("theme/options", context).each([&](DTree theme_info, String theme_key) {
<? context.cfg.get_by_path("theme/options").each([&](DTree theme_info, String theme_key) {
StringMap params;
params["theme"] = theme_key;
String preview_href = starter_link("theme-preview", params, context);