dash index displaying recents, css tweaks, added bulma

beta
Ro 4 years ago
parent 5ad1118244
commit c4232a0a01

@ -21,11 +21,19 @@ class DashControl
default: default:
//$_SESSION["TEST"] = "TESTERZ"; //$_SESSION["TEST"] = "TESTERZ";
//session_unset(); //session_unset();
$pageOptions = [ if (Session::active()) {
"title" => "Fipamo Dashboard", $pageOptions = [
"status" => Session::active(), "title" => "Welcome to Fipamo",
"pages" => (new Book("content/pages"))->getContents(), "status" => Session::active(),
]; "data" => (new Book("../content/pages"))->getPages(1, 4),
];
} else {
$pageOptions = [
"title" => "Welcome to Fipamo",
"status" => Session::active(),
];
}
break; break;
} }
return $view->render($response, "dash/start.twig", $pageOptions); return $view->render($response, "dash/start.twig", $pageOptions);

@ -1,6 +1,7 @@
<?php <?php
use Mni\FrontYAML\Parser; use Mni\FrontYAML\Parser;
use function _\orderBy;
class Book class Book
{ {
@ -22,13 +23,37 @@ class Book
$this->files[] = $file; $this->files[] = $file;
} }
} }
public function getPages(int $page, int $limit)
{
$content = $this->getContents();
$count = ceil(count($content) / $limit);
$folder = [];
$range = $page * $limit - $limit;
for ($i = 0; $i <= $limit; $i++) {
try {
array_push($folder, $content[$i + $range]);
} catch (Exception $error) {
//echo $error;
}
}
return [
"pages" => $folder,
"total" => $count,
];
}
public function getContents() public function getContents()
{ {
$parser = new Parser(); $parser = new Parser();
$contents = []; $contents = [];
foreach ($this->files as $file) { foreach ($this->files as $file) {
$doc = $parser->parse(file_get_contents($file), false); $doc = $parser->parse(file_get_contents($file), false);
$meta = $doc->getYAML(); $meta = $doc->getYAML();
//$date = getdate($meta["created"]);
$newDate = date("Y M D d", $meta["created"]);
$page = [ $page = [
"id" => $meta["id"], "id" => $meta["id"],
"uuid" => $meta["uuid"], "uuid" => $meta["uuid"],
@ -38,6 +63,7 @@ class Book
"layout" => $meta["layout"], "layout" => $meta["layout"],
"tags" => $meta["tags"], "tags" => $meta["tags"],
"author" => $meta["author"], "author" => $meta["author"],
"prettyDate" => $newDate,
"created" => $meta["created"], "created" => $meta["created"],
"deleted" => $meta["deleted"], "deleted" => $meta["deleted"],
"menu" => $meta["menu"], "menu" => $meta["menu"],
@ -61,7 +87,7 @@ class Book
array_push($contents, $page); array_push($contents, $page);
} }
} }
$contents = orderBy($contents, ["id"], ["desc"]);
return $contents; return $contents;
} }
} }

@ -0,0 +1,53 @@
<div id="dash-recent">
<div id="recent-list">
<div class="recent-header">
<h3>Recent</h3>
<div class="index-menu">
<a href='/dashboard/page/list'>View Pages</a>
.
<a href='/dashboard/page/add/new'>Create Page</a>
</div>
</div>
<br/>
{% if data["total"] != 0 %}
{% for page in data['pages'] %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-link" style="background: url({{ page.feature }}) no-repeat center center / cover">
<div>
<label>
{{ page.title }}
</label>
{% if page.menu == 'true' %}
{% set menu = "true" %}
{% else %}
{% set menu = "false" %}
{% endif %}
{% if page.published == 'true' %}
{% set published = "true" %}
{% else %}
{% set published = "false" %}
{% endif %}
{% if page.featured == 'true' %}
{% set featured = "true" %}
{% else %}
{% set featured = "false" %}
{% endif %}
<div id="options">
<span class="item-options" data-active="{{ menu }}">
Menu Item</span>
<span class="item-options" data-active="{{ published }}">
Published</span>
<span class="item-options" data-active="{{ featured }}">
Featured</span>
</div>
<span>{{ page.prettyDate }}</span>
</div>
</a>
{% endfor %}
{% else %}
There are no pages
{% endif %}
</div>
</div>

@ -5,14 +5,14 @@
{% endblock %} {% endblock %}
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css"> <link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=wrqrqrewq">
{% endblock %} {% endblock %}
{% block mainContent %} {% block mainContent %}
<div id="dash-index"> <div id="dash-index">
<div id="dash-index-wrapper"> <div id="dash-index-wrapper">
{% if status %} {% if status %}
DASH INDEX {{ include("dash/partials/index.twig") }}
{% else %} {% else %}
{{ include("dash/forms/login.twig") }} {{ include("dash/forms/login.twig") }}
{% endif %} {% endif %}

@ -1,6 +1,6 @@
{ {
"name": "codekit-project", "name": "fipamo-dash",
"version": "1.0.0", "version": "1.2.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -9,6 +9,11 @@
"resolved": "https://registry.npmjs.org/animejs/-/animejs-3.2.1.tgz", "resolved": "https://registry.npmjs.org/animejs/-/animejs-3.2.1.tgz",
"integrity": "sha512-sWno3ugFryK5nhiDm/2BKeFCpZv7vzerWUcUPyAZLDhMek3+S/p418ldZJbJXo5ZUOpfm2kP2XRO4NJcULMy9A==" "integrity": "sha512-sWno3ugFryK5nhiDm/2BKeFCpZv7vzerWUcUPyAZLDhMek3+S/p418ldZJbJXo5ZUOpfm2kP2XRO4NJcULMy9A=="
}, },
"bulma": {
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.2.tgz",
"integrity": "sha512-e14EF+3VSZ488yL/lJH0tR8mFWiEQVCMi/BQUMi2TGMBOk+zrDg4wryuwm/+dRSHJw0gMawp2tsW7X1JYUCE3A=="
},
"caret-pos": { "caret-pos": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/caret-pos/-/caret-pos-2.0.0.tgz", "resolved": "https://registry.npmjs.org/caret-pos/-/caret-pos-2.0.0.tgz",

@ -9,6 +9,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"animejs": "^3.2.1", "animejs": "^3.2.1",
"bulma": "^0.9.2",
"caret-pos": "^2.0.0", "caret-pos": "^2.0.0",
"sortablejs": "^1.13.0" "sortablejs": "^1.13.0"
} }

@ -1,8 +1,8 @@
@use "sass:color" @use "sass:color"
//Bulma //Bulma
@import '../../node_modules/bulma/sass/utilities/_all' @import '../node_modules/bulma/sass/utilities/_all'
@import '../../node_modules/bulma/sass/grid/columns' @import '../node_modules/bulma/sass/grid/columns'
//Colors //Colors
@import 'main/_colors' @import 'main/_colors'

@ -111,7 +111,7 @@
h3 h3
vertical-align: top vertical-align: top
display: inline-block display: inline-block
width: 50% width: 49%
.index-menu .index-menu
width: 50% width: 50%
@ -195,16 +195,16 @@
height: 500px height: 500px
a:nth-child(4) a:nth-child(4)
width: 49% width: 48.7%
height: 275px height: 275px
margin: 0 15px 15px 0 margin: 0 15px 15px 0
a:nth-child(5) a:nth-child(5)
width: 49% width: 48.7%
height: 550px height: 550px
a:nth-child(6) a:nth-child(6)
width: 49% width: 48.7%
height: 550px height: 550px
margin :-260px 15px 0 0 margin :-260px 15px 0 0

Loading…
Cancel
Save