#59 - added toggle to render pages when page is edited

This commit is contained in:
Ro 2021-11-08 13:52:33 -08:00
parent 4796431076
commit e6cda301cf
8 changed files with 43 additions and 21 deletions

View file

@ -29,7 +29,7 @@ class DashControl
$pageOptions = [
"title" => "Dash Settings",
"private" => $settings["global"]["private"],
"render" => $settings["global"]["renderOnSave"],
"renderOnSave" => $settings["global"]["renderOnSave"],
"background" => $settings["global"]["background"],
"member" => $member,
"ftoken" => $form_token,

View file

@ -154,8 +154,25 @@ class Book
$status = DocTools::writePages($task, $path, $writePath, $write);
if ($status) {
$config = new Settings();
$settings = $config->getSettings();
$message = "";
if (
$settings["global"]["renderOnSave"] == "true" &&
$settings["global"]["dynamicRender"] == "false"
) {
$render = new Render();
$render->renderTags();
$render->renderArchive();
$render->renderPages();
$message = "Filed edited and rendered. NOICE.";
} else {
$message = "File edited. Nice work";
}
$response = [
"message" => "File edited. Nice work",
"message" => $message,
"type" => $task == "write" ? "postUpdated" : "postAdded",
"id" => $uuid,
];

View file

@ -1,17 +1,11 @@
{% extends "dash/_frame.twig" %}
{% if render %}
{% set renderOnSave = 'true' %}
{% else %}
{% set renderOnSave = 'false' %}
{% endif %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=werer">
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=cvvvb">
{% endblock %}
{% block mainContent %}
@ -26,7 +20,12 @@
<svg id="submit-update" class="icons">
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-publish"/>
</svg>
</button>
</button>
<button id="render-toggle" title="render on save toggle" data-render="{{ renderOnSave }}">
<svg id="render-toggle" class="icons">
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-circular-graph"/>
</svg>
</button>
</div>
</div>
<div id="settings-index">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -13,7 +13,9 @@ export default class SettingsActions {
let title = document.getElementById("settings-title").value;
let desc = document.getElementById("settings-desc").value;
//let privacy = document.getElementById('privacy-toggle').getAttribute('data-private');
let render = false; //document.getElementById("render-toggle").getAttribute("data-render");
let render = document
.getElementById("render-toggle")
.getAttribute("data-render");
let background = document.getElementById("background").src;
let selected = "";
let selects = document.querySelectorAll(".theme-select");

View file

@ -97,6 +97,10 @@ export default class SettingsIndex {
document
.getElementById("publish-pages")
.addEventListener("click", (e) => this.handlePublished(e));
//handle page render on save toggle
document
.getElementById("render-toggle")
.addEventListener("click", (e) => this.toggleRender(e));
//handle theme toggle
let themeBtns = document.querySelectorAll(".theme-select");
for (var i = 0, length = themeBtns.length; i < length; i++) {

View file

@ -5,7 +5,7 @@
left: 50%
margin-left: -20%
#buttons
width: 155px
width: 185px
margin: 28px auto
text-align: center
background: $white
@ -21,14 +21,14 @@
height: 20px
fill: $white
button[data-render='false']
background: color.adjust($primary, $lightness: -60%)
background: $secondary
svg
fill: $white
fill: $primary
button[data-render='true']
background: color.adjust($tertiary, $lightness: 60%)
background: $highlight
svg
fill: color.adjust($primary, $lightness: -60%)
fill: $white
#settings-index
width: 94%