adde page preview feature, updated page edit ui with preview option button
This commit is contained in:
parent
49e53a9638
commit
c867b6c508
7 changed files with 60 additions and 23 deletions
|
@ -101,8 +101,9 @@ class DashControl
|
||||||
if (Session::active()) {
|
if (Session::active()) {
|
||||||
$template = "dash/page-edit.twig";
|
$template = "dash/page-edit.twig";
|
||||||
$mode = $args["third"];
|
$mode = $args["third"];
|
||||||
if ($mode == "edit") {
|
|
||||||
$uuid = $args["fourth"];
|
$uuid = $args["fourth"];
|
||||||
|
switch ($mode) {
|
||||||
|
case "edit":
|
||||||
$customPages = (new Themes())->getCustomViews();
|
$customPages = (new Themes())->getCustomViews();
|
||||||
$pageOptions = [
|
$pageOptions = [
|
||||||
"title" => "Fipamo | Edit Page",
|
"title" => "Fipamo | Edit Page",
|
||||||
|
@ -112,13 +113,35 @@ class DashControl
|
||||||
"status" => Session::active(),
|
"status" => Session::active(),
|
||||||
"views" => $customPages,
|
"views" => $customPages,
|
||||||
];
|
];
|
||||||
} else {
|
break;
|
||||||
|
case "preview":
|
||||||
|
$config = new Settings();
|
||||||
|
$settings = $config->getSettings();
|
||||||
|
$loader = new \Twig\Loader\FilesystemLoader(
|
||||||
|
"../content/themes"
|
||||||
|
);
|
||||||
|
$display = new \Twig\Environment($loader, []);
|
||||||
|
|
||||||
|
$book = new Book("../content/pages");
|
||||||
|
$page = $book->findPageById($uuid);
|
||||||
|
$pageOptions = Sorting::page($page);
|
||||||
|
$preview =
|
||||||
|
$settings["global"]["theme"] .
|
||||||
|
"/" .
|
||||||
|
$page["layout"] .
|
||||||
|
".twig";
|
||||||
|
$html = $display->render($preview, $pageOptions);
|
||||||
|
$response->getBody()->write($html);
|
||||||
|
return $response;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
$pageOptions = [
|
$pageOptions = [
|
||||||
"title" => "Fipamo | Create Page",
|
"title" => "Fipamo | Create Page",
|
||||||
"token" => Session::get("form_token"),
|
"token" => Session::get("form_token"),
|
||||||
"mode" => $mode,
|
"mode" => $mode,
|
||||||
"status" => Session::active(),
|
"status" => Session::active(),
|
||||||
];
|
];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: /dashboard");
|
header("Location: /dashboard");
|
||||||
|
|
|
@ -63,6 +63,7 @@ class IndexControl
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
//check layout to see what page should be rendered
|
||||||
$template = $settings["global"]["theme"] . "/page.twig";
|
$template = $settings["global"]["theme"] . "/page.twig";
|
||||||
$book = new Book("../content/pages");
|
$book = new Book("../content/pages");
|
||||||
$page = $book->findPageBySlug($args["third"]);
|
$page = $book->findPageBySlug($args["third"]);
|
||||||
|
|
|
@ -155,6 +155,7 @@ class Sorting
|
||||||
"ul",
|
"ul",
|
||||||
"li",
|
"li",
|
||||||
"i",
|
"i",
|
||||||
|
"em",
|
||||||
"h1",
|
"h1",
|
||||||
"h2",
|
"h2",
|
||||||
"h3",
|
"h3",
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfdfd">
|
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfdfdf">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block mainContent %}
|
{% block mainContent %}
|
||||||
|
|
|
@ -29,9 +29,16 @@
|
||||||
</button>
|
</button>
|
||||||
<button id="option-published" class="option-inactive post-option-btn" data-active="{{ published }}" title='Published'>
|
<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">
|
<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"/>
|
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
<a href="/dashboard/page/preview/{{ uuid }}" target="_blank">
|
||||||
|
<button id="option-preview" class="option-inactive post-option-btn" data-active="false" title='preview page'>
|
||||||
|
<svg id="option-preview-icon" viewbox="0 0 20 20" class="icons">
|
||||||
|
<use id="option-preview-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
<div id="layouts">
|
<div id="layouts">
|
||||||
<label>Page Layouts</label>
|
<label>Page Layouts</label>
|
||||||
<select id="page-templates">
|
<select id="page-templates">
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -214,11 +214,16 @@
|
||||||
button:nth-child(1)
|
button:nth-child(1)
|
||||||
border-radius: 3px 0 0 3px
|
border-radius: 3px 0 0 3px
|
||||||
|
|
||||||
button:nth-child(3)
|
button:nth-child(4)
|
||||||
border-radius: 0 3px 3px 0
|
border-radius: 0 3px 3px 0
|
||||||
|
|
||||||
|
a
|
||||||
button
|
button
|
||||||
width: 33.3%
|
border-radius: 0 3px 3px 0 !important
|
||||||
|
|
||||||
|
|
||||||
|
button
|
||||||
|
width: 25%
|
||||||
height: 45px
|
height: 45px
|
||||||
@include object-transitions(0.3s)
|
@include object-transitions(0.3s)
|
||||||
margin: 0
|
margin: 0
|
||||||
|
|
Loading…
Reference in a new issue