text editor adjustments, fix for page delete, ignore update

beta
Ro 3 years ago
commit 257d2a0623

4
.gitignore vendored

@ -44,5 +44,5 @@ config/tags.json
config.codekit3 config.codekit3
/config/backups /config/backups
/src/com src/com
/src/styles src/styles

@ -105,6 +105,7 @@ class PagesAPI
case "create": case "create":
case "write": case "write":
$body = $request->getParsedBody(); $body = $request->getParsedBody();
var_dump($body);
$passed = true; $passed = true;
if (!isset($body["form_token"])) { if (!isset($body["form_token"])) {
$result = [ $result = [
@ -138,10 +139,7 @@ class PagesAPI
} }
} }
if ($passed) { if ($passed) {
$result = (new Book("../content/pages"))->editPage( $result = (new Book())->editPage($task, $request);
$task,
$request
);
} else { } else {
$result = [ $result = [
"message" => "message" =>

@ -32,8 +32,9 @@ class Book
{ {
$content = $this->getContents(); $content = $this->getContents();
if ($task == "delete") { if ($task == "delete") {
$parsed = json_decode(file_get_contents("php://input"), true); //$parsed = json_decode(file_get_contents("php://input"), true);
$body = find($content, ["uuid" => $parsed["id"]]); //$body = find($content, ["uuid" => $parsed["id"]]);
$body = $request->getParsedBody();
} else { } else {
$body = $request->getParsedBody(); $body = $request->getParsedBody();
} }
@ -93,13 +94,9 @@ class Book
if ($task == "delete") { if ($task == "delete") {
$deleted = "true"; $deleted = "true";
$body["menu"] ? ($body["menu"] = "true") : ($body["menu"] = "false"); $body["menu"] = "false";
$body["published"] $body["published"] = "false";
? ($body["published"] = "true") $body["featured"] = "false";
: ($body["published"] = "false");
$body["featured"]
? ($body["featured"] = "true")
: ($body["featured"] = "false");
} else { } else {
$deleted = isset($page["deleted"]) ? $page["deleted"] : "false"; $deleted = isset($page["deleted"]) ? $page["deleted"] : "false";
} }
@ -195,7 +192,10 @@ class Book
return $item["deleted"] == true; return $item["deleted"] == true;
}); });
$all = $content; //$all = $content;
$all = filter($content, function ($item) {
return $item["deleted"] == false;
});
$filter = isset($sort) ? $sort : "all"; $filter = isset($sort) ? $sort : "all";
switch ($filter) { switch ($filter) {
case "published": case "published":
@ -205,7 +205,7 @@ class Book
$filtered = $deleted; $filtered = $deleted;
break; break;
default: default:
$filtered = $content; $filtered = $all;
break; break;
} }
$numOfPages = ceil(count($filtered) / ($limit + 1)); $numOfPages = ceil(count($filtered) / ($limit + 1));

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

File diff suppressed because one or more lines are too long

@ -248,7 +248,7 @@ class FipamoAdminAPI {
case TASK_PAGE_DELETE: case TASK_PAGE_DELETE:
url = API_DELETE_PAGE; url = API_DELETE_PAGE;
event = TASK_PAGE_DELETE; event = TASK_PAGE_DELETE;
content = CONTENT_TYPE_JSON; content = CONTENT_TYPE_FORM;
break; break;
default: default:

Loading…
Cancel
Save