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"]; $uuid = $args["fourth"];
switch ($mode) { switch ($mode) {
case "edit": 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 = [ $pageOptions = [
"title" => "Fipamo | Edit Page", "title" => "Fipamo | Edit Page",
"page" => (new Book("../content/pages"))->findPageById($uuid), "page" => $page,
"mode" => $mode, "mode" => $mode,
"token" => Session::get("form_token"), "token" => Session::get("form_token"),
"status" => Session::active(), "status" => Session::active(),
"views" => $customPages, "views" => $views,
]; ];
break; break;
case "preview": case "preview":

@ -20,6 +20,25 @@ class Themes
return $this->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() public function getCustomViews()
{ {
$settings = (new Settings())->getSettings(); $settings = (new Settings())->getSettings();

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

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

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