forked from projects/fipamo
#59 - added toggle to render pages when page is edited
This commit is contained in:
parent
4796431076
commit
e6cda301cf
8 changed files with 43 additions and 21 deletions
|
@ -29,7 +29,7 @@ class DashControl
|
||||||
$pageOptions = [
|
$pageOptions = [
|
||||||
"title" => "Dash Settings",
|
"title" => "Dash Settings",
|
||||||
"private" => $settings["global"]["private"],
|
"private" => $settings["global"]["private"],
|
||||||
"render" => $settings["global"]["renderOnSave"],
|
"renderOnSave" => $settings["global"]["renderOnSave"],
|
||||||
"background" => $settings["global"]["background"],
|
"background" => $settings["global"]["background"],
|
||||||
"member" => $member,
|
"member" => $member,
|
||||||
"ftoken" => $form_token,
|
"ftoken" => $form_token,
|
||||||
|
|
|
@ -154,8 +154,25 @@ class Book
|
||||||
$status = DocTools::writePages($task, $path, $writePath, $write);
|
$status = DocTools::writePages($task, $path, $writePath, $write);
|
||||||
|
|
||||||
if ($status) {
|
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 = [
|
$response = [
|
||||||
"message" => "File edited. Nice work",
|
"message" => $message,
|
||||||
"type" => $task == "write" ? "postUpdated" : "postAdded",
|
"type" => $task == "write" ? "postUpdated" : "postAdded",
|
||||||
"id" => $uuid,
|
"id" => $uuid,
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
{% extends "dash/_frame.twig" %}
|
{% extends "dash/_frame.twig" %}
|
||||||
|
|
||||||
{% if render %}
|
|
||||||
{% set renderOnSave = 'true' %}
|
|
||||||
{% else %}
|
|
||||||
{% set renderOnSave = 'false' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ title }}
|
{{ title }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% 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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block mainContent %}
|
{% block mainContent %}
|
||||||
|
@ -26,7 +20,12 @@
|
||||||
<svg id="submit-update" class="icons">
|
<svg id="submit-update" class="icons">
|
||||||
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-publish"/>
|
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-publish"/>
|
||||||
</svg>
|
</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>
|
</div>
|
||||||
<div id="settings-index">
|
<div id="settings-index">
|
||||||
|
|
File diff suppressed because one or more lines are too long
8
public/assets/scripts/dash.min.js
vendored
8
public/assets/scripts/dash.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -13,7 +13,9 @@ export default class SettingsActions {
|
||||||
let title = document.getElementById("settings-title").value;
|
let title = document.getElementById("settings-title").value;
|
||||||
let desc = document.getElementById("settings-desc").value;
|
let desc = document.getElementById("settings-desc").value;
|
||||||
//let privacy = document.getElementById('privacy-toggle').getAttribute('data-private');
|
//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 background = document.getElementById("background").src;
|
||||||
let selected = "";
|
let selected = "";
|
||||||
let selects = document.querySelectorAll(".theme-select");
|
let selects = document.querySelectorAll(".theme-select");
|
||||||
|
|
|
@ -97,6 +97,10 @@ export default class SettingsIndex {
|
||||||
document
|
document
|
||||||
.getElementById("publish-pages")
|
.getElementById("publish-pages")
|
||||||
.addEventListener("click", (e) => this.handlePublished(e));
|
.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
|
//handle theme toggle
|
||||||
let themeBtns = document.querySelectorAll(".theme-select");
|
let themeBtns = document.querySelectorAll(".theme-select");
|
||||||
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
for (var i = 0, length = themeBtns.length; i < length; i++) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
left: 50%
|
left: 50%
|
||||||
margin-left: -20%
|
margin-left: -20%
|
||||||
#buttons
|
#buttons
|
||||||
width: 155px
|
width: 185px
|
||||||
margin: 28px auto
|
margin: 28px auto
|
||||||
text-align: center
|
text-align: center
|
||||||
background: $white
|
background: $white
|
||||||
|
@ -21,14 +21,14 @@
|
||||||
height: 20px
|
height: 20px
|
||||||
fill: $white
|
fill: $white
|
||||||
button[data-render='false']
|
button[data-render='false']
|
||||||
background: color.adjust($primary, $lightness: -60%)
|
background: $secondary
|
||||||
svg
|
svg
|
||||||
fill: $white
|
fill: $primary
|
||||||
|
|
||||||
button[data-render='true']
|
button[data-render='true']
|
||||||
background: color.adjust($tertiary, $lightness: 60%)
|
background: $highlight
|
||||||
svg
|
svg
|
||||||
fill: color.adjust($primary, $lightness: -60%)
|
fill: $white
|
||||||
|
|
||||||
#settings-index
|
#settings-index
|
||||||
width: 94%
|
width: 94%
|
||||||
|
|
Loading…
Reference in a new issue