Beta 2.4.1 - fixes for #68, #69, #70, #72, #75

beta b2.4.1
Ro 3 years ago
commit 1b66f5daf9

@ -104,14 +104,20 @@ class DashControl
$uuid = $args["fourth"];
switch ($mode) {
case "edit":
$customPages = (new Themes())->getCustomViews();
$page = (new Book("../content/pages"))->findPageById($uuid);
$views = [];
if (str_contains($page["layout"], "index")) {
$views = (new Themes())->getCustomIndex();
} else {
$views = (new Themes())->getCustomViews();
}
$pageOptions = [
"title" => "Fipamo | Edit Page",
"page" => (new Book("../content/pages"))->findPageById($uuid),
"page" => $page,
"mode" => $mode,
"token" => Session::get("form_token"),
"status" => Session::active(),
"views" => $customPages,
"views" => $views,
];
break;
case "preview":

@ -20,6 +20,25 @@ class Themes
return $this->themes;
}
public function getCustomIndex()
{
$settings = (new Settings())->getSettings();
$currentTheme = $settings["global"]["theme"];
$folder = "../content/themes/" . $currentTheme;
$files = array_filter(glob("$folder/*twig"), "is_file");
$views = [];
foreach ($files as $file) {
$path = explode("/", $file);
$fileName = $path[4];
if (str_contains($fileName, "index")) {
$page = explode(".", $fileName);
$views[] = $page[0];
}
}
return $views;
}
public function getCustomViews()
{
$settings = (new Settings())->getSettings();

@ -41,6 +41,7 @@ class Sorting
"title" => $page["title"],
"slug" => $page["slug"],
"path" => $page["path"],
"feature" => $page["feature"],
]);
}
}

@ -13,6 +13,7 @@
{% set tags = page['tags'] %}
{% set content = page['content'] %}
{% set date = page['created'] %}
{% set updated = page['updated'] %}
{% else %}
{% set id = '' %}
{% set uuid = '' %}
@ -23,6 +24,7 @@
{% set tags = '' %}
{% set content = '' %}
{% set date = '' %}
{% set updated = '' %}
{% endif %}
{% block title %}
@ -30,7 +32,7 @@
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfdfdf">
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfvbn">
{% endblock %}
{% block mainContent %}
@ -61,11 +63,7 @@
<textarea id="post_title" type="text" name="post_title" class="post-edit" placeholder="TITLE">
{{- _title -}}
</textarea>
<label>CREATED</label>
<br/>
<span id="post-date" type="text">
{{ date }}
</span>
<div id="layouts">
<label>LAYOUTS</label>
<select id="page-templates">
@ -79,6 +77,10 @@
{% endfor %}
</select>
</div>
<label>CREATED</label>
<span id="post-date" type="text">
{{ date }}
</span>
</div>
<div id="post-meta" class="column">
<label>TAGS</label>
@ -89,6 +91,10 @@
{% apply spaceless %}
{{ include("dash/partials/options.twig") }}
{% endapply %}
<label>UPDATED</label>
<span id="post-date" type="text">
{{ updated }}
</span>
<input id="featured-image-upload" type="file" name="featured-image-upload"/>
<input id="post-image-upload" type="file" name="post-image-upload"/>
<input id="form_token" name="token" type="hidden" value="{{ token }}">

@ -5,7 +5,7 @@
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=cvvvb">
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=cvnbm">
{% endblock %}
{% block mainContent %}
@ -68,15 +68,17 @@
<svg id="api-access-toggle" class="icons">
<use id="api-access-toggle" xlink:href="/assets/images/global/sprite.svg#entypo-landline"/>
</svg>
</button>
<span id="api-status">EXTERNAL API ACCESS ENABLED</span>
</button>
{% else %}
<button id="api-access-toggle" title="allow external api" data-enabled="false">
<svg id="api-access-toggle" class="icons">
<use id="api-access-toggle" xlink:href="/assets/images/global/sprite.svg#entypo-landline"/>
</svg>
</button>
<span id="api-status">EXTERNAL API ACCESS NOT ENABLED</span>
</button>
{% endif %}
</div>
@ -88,18 +90,22 @@
<svg id="dynamic-render-toggle" class="icons">
<use id="dynamic-render-toggle" xlink:href="/assets/images/global/sprite.svg#entypo-text-document-inverted"/>
</svg>
</button>
<span id="dynamic-render-status">DYNAMIC PAGE RENDERING</span>
</button>
{% else %}
<button id="dynamic-render-toggle" title="allow external api" data-enabled="false">
<svg id="dynamic-render-toggle" class="icons">
<use id="dynamic-render-toggle" xlink:href="/assets/images/global/sprite.svg#entypo-text-document-inverted"/>
</svg>
</button>
<span id="dynamic-render-status">STATIC PAGE RENDERING</span>
</button>
{% endif %}
</div>
</div>
<div class="column"></div>
<div class="column"></div>
</div>
</div>
<div id="option-settings" class="columns">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save