added styled page layout selector, page renders selected layout

This commit is contained in:
Ro 2021-11-18 14:59:59 -08:00
parent a8355b2da4
commit 49e53a9638
8 changed files with 53 additions and 33 deletions

View file

@ -173,7 +173,7 @@ class Render
"menu" => $this->menu,
];
} else {
$template = $this->theme . "/page.twig";
$template = $this->theme . "/" . $page["layout"] . ".twig";
$location =
"../public/" . $page["path"] . "/" . $page["slug"] . ".html";
$dir = "../public/" . $page["path"];

View file

@ -30,7 +30,7 @@
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=adfdf">
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfdfd">
{% endblock %}
{% block mainContent %}

View file

@ -17,30 +17,33 @@
{% endif %}
<div id="post-options">
<button id="option-menu-pin" class="option-inactive post-option-btn" data-active="{{ menu }}" title='Pin to Menu'>
<svg id="option-page-icon" viewbox="0 0 20 20" class="icons">
<use id="option-page-icon" xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/>
</svg>
</button>
<button id="option-feature" class="option-inactive post-option-btn" data-active="{{ featured }}" title='Feature'>
<svg id="option-feature-icon" viewbox="0 0 20 20" class="icons">
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
</svg>
</button>
<button id="option-published" class="option-inactive post-option-btn" data-active="{{ published }}" title='Published'>
<svg id="option-published-icon" viewbox="0 0 20 20" class="icons">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye"/>
</svg>
</button>
<label>View Template</label>
<select>
{% for view in views %}
{% if view == page['layout'] %}
<option value={{ view }} selected>{{ view }}</option>
{% else %}
<option value={{ view }}>{{ view }}</option>
{% endif %}
<button id="option-menu-pin" class="option-inactive post-option-btn" data-active="{{ menu }}" title='Pin to Menu'>
<svg id="option-page-icon" viewbox="0 0 20 20" class="icons">
<use id="option-page-icon" xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/>
</svg>
</button>
<button id="option-feature" class="option-inactive post-option-btn" data-active="{{ featured }}" title='Feature'>
<svg id="option-feature-icon" viewbox="0 0 20 20" class="icons">
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
</svg>
</button>
<button id="option-published" class="option-inactive post-option-btn" data-active="{{ published }}" title='Published'>
<svg id="option-published-icon" viewbox="0 0 20 20" class="icons">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye"/>
</svg>
</button>
<div id="layouts">
<label>Page Layouts</label>
<select id="page-templates">
{% for view in views %}
{% if view == page['layout'] %}
<option value={{ view }} selected>{{ view }}</option>
{% else %}
<option value={{ view }}>{{ view }}</option>
{% endif %}
{% endfor %}
</select>
</div>
{% endfor %}
</select>
</div>

View file

@ -12,6 +12,7 @@
</section>
<article>
<div class="page">
THIS IS A CUSTOM TEMPLATE <br />
<p>{{content | raw}}</p>
<div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -56,6 +56,7 @@ export default class PostActions {
"published",
document.getElementById("option-published").getAttribute("data-active")
);
pageInfo.append("layout", document.getElementById('page-templates').value);
pageInfo.append(
"form_token",
document.getElementById("form_token").value

View file

@ -237,6 +237,21 @@
svg
fill: $primary
#layouts
padding: 7px 0 0 0
label
color: $primary
font-size: 1em
select
background: $primary
color: $secondary
border-radius: 3px
border-color: $primary
margin: 5px 0 0 0
width: 100%
padding: 5px
font-size: 1em
#featured-image-upload, #post-image-upload
display: none