CSS Overhaul Part 1

This one is a doozy, so let's breakt it down into what areas where
touched.

-   updated package json to remove unneeded dependencies.
-   rebuilt file uploading to simply a very convuluted process
-   began proces to replace icons with https://tabler-icons.io
-   began process of removing the need for css preprocessor and using
    pure css
        - login completed
        - dashboard index completed
        - page edit ui completed
- page edit ui text editor tweaked so syntax highlighting is cleaner and
  more accurate

The settings and navigation UIs still remain and then polishing the
responsive for the new css structure
toggle-buttons-#109
Ro 2 years ago
parent ec1dc49ba1
commit 07b422a9c3
Signed by: are0h
GPG Key ID: 29B551CDBD4D3B50

2
.gitignore vendored

@ -12,7 +12,7 @@ public/*
public/assets/* public/assets/*
!public/assets/css !public/assets/css
public/assets/css/* public/assets/css/*
!public/assets/css/dash.css !public/assets/css/dash
!public/assets/scripts !public/assets/scripts
public/assets/scripts/* public/assets/scripts/*
!public/assets/scripts/Start.js !public/assets/scripts/Start.js

@ -1,6 +1,3 @@
{ {
"extends": [ "extends": ["stylelint-config-standard"]
"stylelint-config-standard-scss",
"stylelint-config-prettier-scss"
]
} }

@ -0,0 +1,53 @@
<?php
namespace brain\api\v1;
use brain\utility\FileUploader;
class FilesAPI
{
public function __construct()
{
}
public static function uploadFiles($request, $type = null)
{
$upload = $request->getUploadedFiles(); //grab uploaded files
$file = $upload['upload_files'][0]; //front end sends one by one for progress tracking, so grab first
$type = $file->getClientMediaType();
$filesPath = '';
$path = date('Y') . '/' . date('m');
$response = [];
switch ($type) {
case 'image/jpeg':
case 'image/png':
case 'image/gif':
case 'image/svg':
$filesPath = '/assets/images/blog/' . $path . '/';
break;
case 'video/mp4':
$filesPath = '/assets/video/blog/' . $path . '/';
break;
case 'audio/mpeg':
$filesPath = '/assets/sound/blog/' . $path . '/';
break;
case 'application/pdf':
case 'text/plain':
case 'text/rtf':
$filesPath = '/assets/docs/blog/' . $path . '/';
break;
}
FileUploader::uploadFile('../public' . $filesPath, $file);
$response = [
'message' => "File Uploaded. Great!",
"filePath" => $filesPath . urlencode($file->getClientFileName()),
"fileName" => urlencode($file->getClientFileName()),
'type' => $type,
];
return $response;
}
}

@ -111,7 +111,7 @@ class PagesAPI
case 'delete': case 'delete':
case 'create': case 'create':
case 'write': case 'write':
$body = $request->getParsedBody(); $body = json_decode(file_get_contents("php://input"), true);
$passed = true; $passed = true;
if (!isset($body['form_token'])) { if (!isset($body['form_token'])) {
$result = [ $result = [
@ -134,12 +134,15 @@ class PagesAPI
'featured', 'featured',
'published', 'published',
'form_token', 'form_token',
'feature_image', 'imageList',
"fileList",
"remote"
]; ];
foreach ($body as $key => $item) { foreach ($body as $key => $item) {
if (!in_array($key, $keys)) { if (!in_array($key, $keys)) {
//found unnecessary key, so reject submission //found unnecessary key, so reject submission
var_dump($key);
$passed = false; $passed = false;
} }
} }

@ -6,6 +6,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use brain\api\v1\AuthAPI; use brain\api\v1\AuthAPI;
use brain\api\v1\PagesAPI; use brain\api\v1\PagesAPI;
use brain\api\v1\FilesAPI;
use brain\api\v1\SettingsAPI; use brain\api\v1\SettingsAPI;
use brain\api\v1\InitAPI; use brain\api\v1\InitAPI;
use brain\api\v1\MailerAPI; use brain\api\v1\MailerAPI;
@ -22,7 +23,7 @@ class APIControl
$filename = ''; $filename = '';
switch (isset($args['third']) ? $args['third'] : 'none') { switch (isset($args['third']) ? $args['third'] : 'none') {
case 'status': case 'status':
$result = AuthAPI::status(); $result = AuthAPI::status();
break; break;
case 'page': case 'page':
@ -188,6 +189,24 @@ class APIControl
]; ];
} }
break;
case "files":
$token = $request->getHeader('fipamo-access-token');
if (isset($token[0])) {
if (Session::verifyToken($token[0])) {
$result = FilesAPI::uploadFiles($request, $args);
} else {
$result = [
'message' => 'Invalid token, API access denied, homie',
'type' => 'API_ERROR',
];
}
} else {
$result = [
'message' => 'No token, API access denied, homie',
'type' => 'API_ERROR',
];
}
break; break;
case 'settings': case 'settings':
if (isset($body)) { if (isset($body)) {

@ -7,6 +7,7 @@ use brain\data\Session;
use brain\data\Settings; use brain\data\Settings;
use brain\data\Themes; use brain\data\Themes;
use brain\utility\Setup; use brain\utility\Setup;
use brain\utility\Sorting;
use Carbon\Carbon; use Carbon\Carbon;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
@ -151,16 +152,15 @@ class DashControl
$config = new Settings(); $config = new Settings();
$settings = $config->getSettings(); $settings = $config->getSettings();
$loader = new \Twig\Loader\FilesystemLoader( $loader = new \Twig\Loader\FilesystemLoader(
'../content/themes' '../content/themes/' . $settings['global']['theme'] .
'/'
); );
$display = new \Twig\Environment($loader, []); $display = new \Twig\Environment($loader, []);
$book = new Book(); $book = new Book();
$page = $book->findPageById($uuid); $page = $book->findPageById($uuid);
$pageOptions = Sorting::page($page); $pageOptions = Sorting::page($page);
$preview = $settings['global']['theme'] . $preview = $page['layout'] .
'/' .
$page['layout'] .
'.twig'; '.twig';
$html = $display->render($preview, $pageOptions); $html = $display->render($preview, $pageOptions);
$response->getBody()->write($html); $response->getBody()->write($html);

@ -33,13 +33,15 @@ class RouteControl
): ResponseInterface { ): ResponseInterface {
switch (isset($args['first']) ? $args['first'] : 'index') { switch (isset($args['first']) ? $args['first'] : 'index') {
case 'api': case 'api':
//$result = APIControl::post($request, $response, $args);
return APIControl::post($request, $response, $args); return APIControl::post($request, $response, $args);
break; break;
default: default:
//echo "YES"; $result = [
//return IndexControl::start($request, $response, $args); 'message' => "Nothing matches this route. That's unfortunate",
break; 'type' => 'TASK_NONE',
];
$response->getBody()->write(json_encode($result));
return $response->withHeader('Content-Type', 'application/json');
} }
} }
} }

@ -5,7 +5,6 @@ namespace brain\data;
use Carbon\Carbon; use Carbon\Carbon;
use brain\utility\DocTools; use brain\utility\DocTools;
use brain\utility\StringTools; use brain\utility\StringTools;
use brain\utility\FileUploader;
use function _\find; use function _\find;
use function _\filter; use function _\filter;
@ -39,13 +38,8 @@ class Book
public function editPage($task, $request) public function editPage($task, $request)
{ {
$content = $this->getContents(); $content = $this->getContents();
if ($task == 'delete') { $body = 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 {
$body = $request->getParsedBody();
}
$page = find($content, ['uuid' => $body['uuid']]); $page = find($content, ['uuid' => $body['uuid']]);
$files = $request->getUploadedFiles(); $files = $request->getUploadedFiles();
@ -63,65 +57,6 @@ class Book
$page_feature = ''; $page_feature = '';
$page_files = ''; $page_files = '';
if (isset($files['page_files'])) {
$imageList = '';
$fileList = '';
//var_dump($files['page_files']);
foreach ($files['page_files'] as $file) {
$type = $file->getClientMediaType();
//var_dump($type);
switch ($type) {
case 'image/jpeg':
case 'image/png':
case 'image/gif':
case 'image/svg':
$imagesPath = '/assets/images/blog/' . $path . '/';
$imageList = $imageList . $imagesPath . urlencode($file->getClientFileName()) . ', ';
FileUploader::uploadFile(
'../public/assets/images/blog/' . $path . '/',
$file
);
break;
case 'video/mp4':
$videosPath = '/assets/video/blog/' . $path . '/';
$imageList = $imageList . $videosPath . urlencode($file->getClientFileName()) . ', ';
FileUploader::uploadFile(
'../public/assets/video/blog/' . $path . '/',
$file
);
break;
case 'audio/mpeg':
$soundPath = '/assets/sound/blog/' . $path . '/';
$fileList = $fileList . $soundPath . urlencode($file->getClientFileName()) . ', ';
FileUploader::uploadFile(
'../public/assets/sound/blog/' . $path . '/',
$file
);
break;
case 'application/pdf':
case 'text/plain':
case 'text/rtf':
$docPath = '/assets/docs/blog/' . $path . '/';
$fileList = $fileList . $docPath . urlencode($file->getClientFileName()) . ', ';
FileUploader::uploadFile(
'../public/assets/docs/blog/' . $path . '/',
$file
);
break;
}
}
$page_feature = $imageList;
$page_files = $fileList;
} else {
// if no files, just reset string from page object
$page_feature = $page['feature'];
$page_files = $page['files'];
}
if ($task == 'delete') { if ($task == 'delete') {
$deleted = 'true'; $deleted = 'true';
$body['menu'] = 'false'; $body['menu'] = 'false';
@ -139,10 +74,10 @@ class Book
$uuid = $task != 'create' ? $body['uuid'] : StringTools::createUUID(); $uuid = $task != 'create' ? $body['uuid'] : StringTools::createUUID();
// now that variables are done, set to body object and then convert to markdown to save // now that variables are done, set to body object and then convert to markdown to save
$body['id'] = $id; $body['id'] = $id;
$body['uuid'] = $uuid; $body['uuid'] = $uuid;
$body['feature'] = $page_feature; //$body['feature'] = $page_feature;
$body['files'] = $page_files; //$body['files'] = $page_files;
$body['path'] = $path; $body['path'] = $path;
$body['author'] = $member['handle']; $body['author'] = $member['handle'];
$body['created'] = $created->format("Y-m-d\TH:i:sP"); $body['created'] = $created->format("Y-m-d\TH:i:sP");

@ -99,10 +99,10 @@ class DocTools
"'" . "'" .
"\n" . "\n" .
'feature: ' . 'feature: ' .
$object['feature'] . $object['imageList'] .
"\n" . "\n" .
'files: ' . 'files: ' .
$object['files'] . $object['fileList'] .
"\n" . "\n" .
'path: ' . 'path: ' .
$object['path'] . $object['path'] .

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="theme-color" content="#FFFFFF"/>
<title>
{% block title %}
{{ title }}
{% endblock %}
</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
<div id="notifications" class="notifications">
<div id="notify-message" class="notify-message">
<div id="notify-good" class="notify-icon">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-flirt"/></svg>
</div>
<div id="notify-lame" class="notify-icon">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-sad"/></svg>
</div>
<div id="notify-working" class="notify-icon">
<svg id="notify-working-icon" viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-cog"/></svg>
</div>
<div id="notify-text">
<div id="notify-progress"></div>
<p id="message-text">MESSAGE TEXT</p>
</div>
</div>
</div>
<div id="main-content" class="main-container">
<section id="dash-index-content">
{% if status %}
<header id="header">
<div id="wrapper">
{% apply spaceless %}
<div id="left">
<a href="/dashboard"><img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/></a>
</div>
<div id="right">
{% if status %}
{% apply spaceless %}
{{ include("dash/partials/navigation.twig") }}
{% endapply %}
{% endif %}
</div>
{% endapply %}
</div>
</header>
{% endif %}
{% apply spaceless %}
{% block mainContent %}{% endblock %}
{% endapply %}
</section>
</div>
<footer></footer>
{% block javascripts %}{% endblock %}
</body>
</html>

@ -11,25 +11,6 @@
{% block stylesheets %}{% endblock %} {% block stylesheets %}{% endblock %}
</head> </head>
<body> <body>
<div id="notifications" class="notifications">
<div id="notify-message" class="notify-message">
<div id="notify-good" class="notify-icon">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-flirt"/></svg>
</div>
<div id="notify-lame" class="notify-icon">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-sad"/></svg>
</div>
<div id="notify-working" class="notify-icon">
<svg id="notify-working-icon" viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-cog"/></svg>
</div>
<div id="notify-text">
<div id="notify-progress"></div>
<p id="message-text">MESSAGE TEXT</p>
</div>
</div>
</div>
{% if status %} {% if status %}
<header> <header>
{% apply spaceless %} {% apply spaceless %}
@ -37,8 +18,10 @@
<div role="nav-left"> <div role="nav-left">
<a href="/dashboard"><img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/></a> <a href="/dashboard"><img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/></a>
</div> </div>
<div> <div role="notifications">
NOTIFICATIONS {% apply spaceless %}
{{ include("dash/partials/notifications.twig") }}
{% endapply %}
</div> </div>
<div role="nav-right"> <div role="nav-right">
{% if status %} {% if status %}
@ -57,6 +40,6 @@
{% endapply %} {% endapply %}
</main> </main>
<footer></footer> <footer></footer>
{% block javascripts %}{% endblock %} <script src="/assets/scripts/start.js?=dfdfdfse" type="text/javascript"></script>
</body> </body>
</html> </html>

@ -1,102 +1,99 @@
{% extends "dash/_frame.twig" %} {% extends "dash/_frame.twig" %}
{% block title %} {% block title %}
{{ title }} {{ title }}
{% endblock %} {% endblock %}
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfvgy"> <link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfvgy">
{% endblock %} {% endblock %}
{% block mainContent %} {% block mainContent %}
<div id="post-index"> <div id="post-index">
<div id="post-index-wrapper"> <div id="post-index-wrapper">
<div id="post-index-header"> <div id="post-index-header">
<div id="post-index-header-left"> <div id="post-index-header-left">
{{ filter }} Pages {{ filter }}
</div> Pages
<div id="post-index-header-right"> </div>
<a href="/dashboard/pages/all" title="view all pages"> <div id="post-index-header-right">
<button> <a href="/dashboard/pages/all" title="view all pages">
<svg > <button>
<use xlink:href="/assets/images/global/sprite.svg#entypo-archive"/> <svg>
</svg> <use xlink:href="/assets/images/global/sprite.svg#entypo-archive"/>
{{ stats['all'] }} </svg>
</button> {{ stats['all'] }}
</a> </button>
<a href="/dashboard/pages/published" title="view publised pages"> </a>
<button> <a href="/dashboard/pages/published" title="view publised pages">
<svg > <button>
<use xlink:href="/assets/images/global/sprite.svg#entypo-globe"/> <svg>
</svg> <use xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
{{ stats['published'] }} </svg>
</button> {{ stats['published'] }}
</a> </button>
<a href="/dashboard/pages/deleted" title="view deleted pages"> </a>
<button> <a href="/dashboard/pages/deleted" title="view deleted pages">
<svg > <button>
<use xlink:href="/assets/images/global/sprite.svg#entypo-circle-with-cross"/> <svg>
</svg> <use xlink:href="/assets/images/global/sprite.svg#entypo-circle-with-cross"/>
{{ stats['deleted'] }} </svg>
</button> {{ stats['deleted'] }}
</a> </button>
</div> </a>
</div>
</div>
<div id="posts-list">
{% for page in pages %}
{% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link">
<div class="page-video">
<video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4">
Sorry, your browser doesn't support embedded videos. </div>
</video> <div id="posts-list">
<label> {% for page in pages %}
{{ page.title }} {% if page.media[0].type == 'mp4' %}
</label> <a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link">
<div id="meta"> <div class="page-video">
{{ include("dash/partials/recent-options.twig") }} <video class="post-video" loop muted autoplay>
</div> <source src="{{ page.media[0].file }}" type="video/mp4">
</div>
</a>
{% else %}
<a class="page-link" href="/dashboard/page/edit/{{ page.uuid }}">
<div class="page-bg" style="background: url({{ page.media[0].file }}) no-repeat center center / cover">
<label>
{{ page.title }}
</label>
<div id="meta">
{{ include("dash/partials/recent-options.twig") }}
</div>
</div>
</a>
{% endif %}
{% endfor %}
{% if numOfPages > 1 %}
<div class="paginate">
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['prevPage'] }}">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-chevron-left"/></svg>
</a>
<span class="count">
{{ currentPage }}
of
{{ numOfPages }}
</span>
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['nextPage'] }}">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-chevron-right"/></svg>
</a>
</div>
{% endif %}
</div> Sorry, your browser doesn't support embedded videos.
</div> </video>
</div> <label>
{% endblock %} {{ page.title }}
</label>
<div id="meta">
{{ include("dash/partials/recent-options.twig") }}
</div>
</div>
{% block javascripts %} </a>
<script src="/assets/scripts/Start.js" type="text/javascript"></script> {% else %}
{% endblock %} <a class="page-link" href="/dashboard/page/edit/{{ page.uuid }}">
<div class="page-bg" style="background: url({{ page.media[0].file }}) no-repeat center center / cover">
<label>
{{ page.title }}
</label>
<div id="meta">
{{ include("dash/partials/recent-options.twig") }}
</div>
</div>
</a>
{% endif %}
{% endfor %}
{% if numOfPages > 1 %}
<div class="paginate">
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['prevPage'] }}">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-chevron-left"/></svg>
</a>
<span class="count">
{{ currentPage }}
of
{{ numOfPages }}
</span>
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['nextPage'] }}">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-chevron-right"/></svg>
</a>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}

@ -20,10 +20,10 @@
<input type="text" name="new_member_pass2" id="new_member_pass2" placeholder="password confirm"/> <input type="text" name="new_member_pass2" id="new_member_pass2" placeholder="password confirm"/>
<input type="text" name="new_member_title" id="new_member_title" placeholder="title"/> <input type="text" name="new_member_title" id="new_member_title" placeholder="title"/>
<button id="init-blog" data-action='blog-init' type='submit'>SET UP YOUR SITE</button> <button id="init-blog" data-action='blog-init' type='submit'>SET UP YOUR SITE</button>
<br /><br /> <br/><br/>
<button class="init-option" id="init-switch-restore">RESTORE FROM BACKUP</button> <button class="init-option" id="init-switch-restore">RESTORE FROM BACKUP</button>
</form> </form>
</div> </div>
<div id="dash-restore" class="dash-restore"> <div id="dash-restore" class="dash-restore">
<form id="init-restore" method="POST"> <form id="init-restore" method="POST">
@ -33,16 +33,16 @@
<label>Grab your backup zip</label> <label>Grab your backup zip</label>
<input id="backup-upload" type="file" name="backup-upload" placeholder="Backup Zip"/> <input id="backup-upload" type="file" name="backup-upload" placeholder="Backup Zip"/>
</div> </div>
<br /><br /> <br/><br/>
<button id="blog-restore" data-action='blog-restore' type='submit'>RESTORE</button> <button id="blog-restore" data-action='blog-restore' type='submit'>RESTORE</button>
<br /><br /> <br/><br/>
<button class="init-option" id="init-switch-fresh">OR INSTALL FROM SCRATCH</button> <button class="init-option" id="init-switch-fresh">OR INSTALL FROM SCRATCH</button>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
<script src="/assets/scripts/Start.js?=sdfsdf" type="text/javascript"></script> <script src="/assets/scripts/start.js?=sdfsdf" type="text/javascript"></script>
{% endblock %} {% endblock %}

@ -6,38 +6,34 @@
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=sdsdsds"> <link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=sdsdsds">
{% endblock %} {% endblock %}
{% block mainContent %} {% block mainContent %}
<div id="nav-index"> <div id="nav-index">
<div id="nav-index-wrapper"> <div id="nav-index-wrapper">
<div id="nav-pages"> <div id="nav-pages">
{% for item in menu %} {% for item in menu %}
<div id="{{item.id}}" class="nav-item" data-slug="{{item.slug}}" data-uuid="{{item.uuid}}" data-path="{{item.path}}"> <div id="{{ item.id }}" class="nav-item" data-slug="{{ item.slug }}" data-uuid="{{ item.uuid }}" data-path="{{ item.path }}">
<svg id="item-arrows"> <svg id="item-arrows">
<use xlink:href="/assets/images/global/sprite.svg#entypo-select-arrows"/> <use xlink:href="/assets/images/global/sprite.svg#entypo-select-arrows"/>
</svg> </svg>
<label>{{item.title}}</label> <label>{{ item.title }}</label>
<div id="nav-btns"> <div id="nav-btns">
<button id="edit-item" class="nav-btn" data-id="{{item.uuid}}" title="edit page"> <button id="edit-item" class="nav-btn" data-id="{{ item.uuid }}" title="edit page">
<svg> <svg>
<use xlink:href="/assets/images/global/sprite.svg#entypo-edit"/> <use xlink:href="/assets/images/global/sprite.svg#entypo-edit"/>
</svg> </svg>
</button> </button>
<button id="remove-item" class="nav-btn" data-uuid="{{item.uuid}}" data-id="{{item.id}}" title="delete from menu"> <button id="remove-item" class="nav-btn" data-uuid="{{ item.uuid }}" data-id="{{ item.id }}" title="delete from menu">
<svg> <svg>
<use xlink:href="/assets/images/global/sprite.svg#entypo-cross"/> <use xlink:href="/assets/images/global/sprite.svg#entypo-cross"/>
</svg> </svg>
</button> </button>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div>
</div> </div>
</div> </div>
</div> {% endblock %}
{% endblock %}
{% block javascripts %}
<script src="/assets/scripts/Start.js?=cvfggt" type="text/javascript"></script>
{% endblock %}

@ -36,163 +36,172 @@
{% endblock %} {% endblock %}
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfdf"> <link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=vdthg">
{% endblock %} {% endblock %}
{% block mainContent %} {% block mainContent %}
<div id="post-edit-index" data-index="{{ id }}" data-uuid="{{ uuid }}" data-slug="{{ slug }}" data-layout="{{ layout }}"> <section data-index="{{ id }}" data-uuid="{{ uuid }}" data-slug="{{ slug }}" data-layout="{{ layout }}" role="file-manager">
<div id="post-edit-index-wrapper"> {% if page['feature'] == null %}
<div id="post-feature"> <div role="file-drop">
{% if page['feature'] == null %} <label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
<div id="page-file-manager"> </div>
<div id="page-file-wrapper"> <label role="list-title">IMAGES AND VIDEO</label>
<div id="page-file-drop"> <div role="page-images-list"></div>
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label> <label role="list-title">FILES</label>
</div> <div role="page-files-list"></div>
IMAGES AND VIDEO {% else %}
<div id="page-images-list"></div> <div role="file-drop">
FILES <label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
<div id="page-files-list"></div> </div>
</div> <label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list">
{% if media|length > 1 %}
{% for item in media %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp4" %}
</div> <div id="{{ loop.index0 }}" class="video-item" data-source="{{ item.file }}">
<video>
<source src="{{ item.file }}"/>
</video>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="{{ loop.index0 }}" class="img-item" data-source="{{ item.file }}" style="background: url({{ item.file }}) no-repeat center center / cover">
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% endfor %}
{% else %} {% else %}
<div id="page-file-manager"> {% if media[0] != '' %}
<div id="page-file-wrapper"> {% set fileName = media[0].file|split('/') %}
<div id="page-file-drop"> {% if media[0].type == "mp4" %}
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label> <div id="0" class="video-item" data-source="{{ media[0].file }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div> </div>
IMAGES AND VIDEO
<div id="page-images-list">
{% if media|length > 1 %}
{% for item in media %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp4" %}
<div id="{{ loop.index0 }}" class="video-item" data-source="{{ item.file }}" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %}
<div id="{{ loop.index0 }}" class="img-item" style="background: url({{ item.file }}) no-repeat center center / cover" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% endif %}
{% endfor %}
{% else %}
{% if media[0] != '' %}
{% set fileName = media[0].file|split('/') %}
{% if media[0].type == "mp4" %}
<div id="0" class="video-item" data-source="{{ media[0].file }}" date-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %}
<div id="0" class="img-item" style="background: url({{ media[0].file }}) no-repeat center center / cover" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% endif %}
{% else %}
{% endif %}
{% endif %}
{% else %}
<div id="0" class="img-item" data-source="{{ media[0].file }}" style="background: url({{ media[0].file }}) no-repeat center center / cover">
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div> </div>
FILES {% endif %}
<div id="page-files-list"> {% else %}
{% if files|length > 1 %} {% endif %}
{% for item in files %} {% endif %}
{% set fileName = item.file|split('/') %} </div>
{% if item.type == "mp3" %} <label role="list-title">FILES</label>
<div id="{{ loop.index0 }}" class="audio-item" data-source="{{ item.file }}" data-file-name="{{ fileName[6] }}"> <div role="page-files-list">
<button id="{{ loop.index0 }}" class="media-remove">X</button> {% if files|length > 1 %}
</div> {% for item in files %}
{% else %} {% set fileName = item.file|split('/') %}
<div id="{{ loop.index0 }}" class="file-item" data-source="{{ item.file }}" data-file-name="{{ fileName[6] }}"> {% if item.type == "mp3" %}
<button id="{{ loop.index0 }}" class="media-remove">X</button> <div id="{{ loop.index0 }}" class="audio-item" data-source="{{ item.file }}">
</div> <audio controls>
{% endif %} <source src="{{ item.file }}"/>
{% endfor %} </audio>
{% else %} <button id="{{ loop.index0 }}" class="media-remove">
{% if files[0] != '' %} <i class="ti ti-x"></i>
{% set fileName = files[0].file|split('/') %} </button>
{% if files[0].type == "mp3" %} </div>
<div id="0" class="audio-item" data-source="{{ files[0].file }}" data-file-name="{{ fileName[6] }}"> {% else %}
<button id="{{ loop.index0 }}" class="media-remove">X</button> <div id="{{ loop.index0 }}" class="file-item" data-source="{{ item.file }}">
</div> <a href="{{ item.file }}" target="_blank">{{ fileName[6] }}"</a>
{% else %} <button id="{{ loop.index0 }}" class="media-remove">
<div id="0" class="file-item" data-source="{{ files[0].file }}" data-file-name="{{ fileName[6] }}"> <i class="ti ti-x"></i>
<button id="{{ loop.index0 }}" class="media-remove">X</button> </button>
</div>
{% endif %}
{% else %}
{% endif %}
{% endif %}
</div> </div>
</div> {% endif %}
{% endfor %}
{% else %}
{% if files[0] != '' %}
{% set fileName = files[0].file|split('/') %}
{% if files[0].type == "mp3" %}
<div id="0" class="audio-item" data-source="{{ files[0].file }}">
<audio controls>
<source src="{{ files[0].file }}"/>
</audio>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="0" class="file-item" data-source="{{ files[0].file }}">
<a href="{{ item.file }}" target="_blank">{{ fileName[6] }}"</a>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% else %}
</div> {% endif %}
{% endif %} {% endif %}
</div> </div>
<div id="post-header"> {% endif %}
<div id="post-header-wrapper" class="columns"> </section>
<div id="post-edit-title" class="column"> <section role="page-meta">
<label>TITLE</label> <div role="page-meta-wrapper">
<textarea id="post-title-text" type="text" name="post-title-text" class="post-edit" placeholder="TITLE">{{ title }}</textarea> <div role="page-title">
<strong>TITLE</strong>
<div id="layouts"> <textarea id="post-title-text" type="text" name="post-title-text" class="post-edit" placeholder="TITLE">{{ title }}</textarea>
<label>LAYOUTS</label> </div>
<select id="page-templates"> <div role="page-tags">
{% for view in views %} <strong>TAGS</strong>
{% if view == page['layout'] %} <textarea id="post-tags" type="text" name="post-tags" class="form-control" placeholder="tags [comma seperated]">{{ tags }}</textarea>
<option value={{ view }} selected>{{ view }}</option> </div>
{% else %} <div role="page-layouts">
<option value={{ view }}>{{ view }}</option> <strong>LAYOUTS</strong>
{% endif %} <select id="page-templates">
{% for view in views %}
{% if view == page['layout'] %}
<option value={{ view }} selected>{{ view }}</option>
{% else %}
<option value={{ view }}>{{ view }}</option>
{% endif %}
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<label>CREATED</label> <div role="page-options">
<span id="post-date" type="text"> <strong>OPTIONS</strong>
{{ date }} {% apply spaceless %}
</span> {{ include("dash/partials/options.twig") }}
</div> {% endapply %}
<div id="post-meta" class="column"> </div>
<label>TAGS</label> <div role="page-updated">
<textarea id="post-tags" type="text" name="post-tags" class="form-control" placeholder="tags [comma seperated]">{{ tags }}</textarea> <strong>UPDATED</strong>
<label>OPTIONS</label> <span id="post-date" type="text">
{% apply spaceless %} {{ updated }}
{{ include("dash/partials/options.twig") }} </span>
{% endapply %} </div>
<label>UPDATED</label> <div role="page-created">
<span id="post-date" type="text"> <strong>CREATED</strong>
{{ updated }} <span id="post-date" type="text">
</span> {{ date }}
<input id="page-files-upload" type="file" name="page-files-upload" multiple/> </span>
<input id="post-image-upload" type="file" name="post-image-upload"/> <input id="page-files-upload" type="file" name="page-files-upload" multiple/>
<input id="form_token" name="token" type="hidden" value="{{ token }}"></div> <input id="post-image-upload" type="file" name="post-image-upload"/>
</div> <input id="form_token" name="token" type="hidden" value="{{ token }}"></div>
</div>
<div id="edit-post">
{% apply spaceless %}
{{ include("dash/partials/editor.twig") }}
{% endapply %}
<div id="edit-post-wrapper">
<textarea id="edit" spellcheck="false">{{ content }}</textarea>
<pre id="highlight">
<code id="highlight-content" class="language-md">
</code>
</pre>
</div>
</div>
</div> </div>
</div> </div>
{% endblock %} </section>
<section role="text-editor">
{% block javascripts %} {% apply spaceless %}
<script src="/assets/scripts/Start.js?=dfdvbd" type="text/javascript"></script> {{ include("dash/partials/editor.twig") }}
{% endblock %} {% endapply %}
<div role="edit-post-wrapper">
<textarea id="edit" spellcheck="false">{{ content }}</textarea>
<pre id="highlight">
<code id="highlight-content" class="language-md"></code>
</pre>
</div>
</section>
{% endblock %}

@ -1,9 +1,9 @@
<div id="edit-control"> <div role="text-editor-control">
<button id="edit-bold" class="content-editor-btn-text editor-button" title="bold">B</button> <button id="edit-bold" class="content-editor-btn-text editor-button" title="bold">B</button>
<button id="edit-italic" class="content-editor-btn-text editor-button" title="italic">I</button> <button id="edit-italic" class="content-editor-btn-text editor-button" title="italic">I</button>
<button id="edit-strikethrough" class="content-editor-btn-text editor-button" title="strikethrough">D</button> <button id="edit-strikethrough" class="content-editor-btn-text editor-button" title="strikethrough">D</button>
<button id="edit-link" class="content-editor-btn-icon editor-button" title="insert link"> <button id="edit-link" class="content-editor-btn-icon editor-button" title="insert link">
<svg id="edit-link" viewbox="0 0 20 20" class="icons"> <svg id="edit-link" role="icon">
<use id="edit-link" xlink:href="/assets/images/global/sprite.svg#entypo-link"/> <use id="edit-link" xlink:href="/assets/images/global/sprite.svg#entypo-link"/>
</svg> </svg>
</button> </button>
@ -11,35 +11,32 @@
<button id="edit-header2" class="content-editor-btn-text editor-button" title="header 2">H2</button> <button id="edit-header2" class="content-editor-btn-text editor-button" title="header 2">H2</button>
<button id="edit-header3" class="content-editor-btn-text editor-button" title="header 3">H3</button> <button id="edit-header3" class="content-editor-btn-text editor-button" title="header 3">H3</button>
<button id="edit-image" class="content-editor-btn-icon editor-button" title="insert image"> <button id="edit-image" class="content-editor-btn-icon editor-button" title="insert image">
<svg id="edit-image" viewbox="0 0 20 20" class="icons"> <svg id="edit-image" role="icon">
<use id="edit-image" xlink:href="/assets/images/global/sprite.svg#entypo-image"/> <use id="edit-image" xlink:href="/assets/images/global/sprite.svg#entypo-image"/>
</svg> </svg>
</button> </button>
{% if mode == "edit" %} {% if mode == "edit" %}
<button id="edit-update" class="post-sumbit-btn submit-start editor-button" data-action='blog-update' data-id="{{ page['uuid'] }} type='submit' title=" bold"> <button id="edit-update" class="post-sumbit-btn submit-start editor-button" data-action='blog-update' data-id="{{ page['uuid'] }} type='submit' title=" bold">
<svg id="submit-update" viewbox="0 0 20 20" class="icons"> <svg id="submit-update" role="icon">
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-save" data-action='blog-update' data-id="{{ page['uuid'] }}"/> <use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-save" data-action='blog-update' data-id="{{ page['uuid'] }}"/>
</svg> </svg>
<svg id="submit-good" class="icon-hide" viewbox="0 0 20 20" class="icons"> <svg id="submit-good" class="icon-hide" role="icon">
<use xlink:href="/assets/images/global/sprite.svg#entypo-thumbs-up"/> <use xlink:href="/assets/images/global/sprite.svg#entypo-thumbs-up"/>
</svg> </svg>
<svg id="submit-error" class="icon-hide" viewbox="0 0 20 20" class="icons"> <svg id="submit-error" class="icon-hide" role="icon">
<use xlink:href="/assets/images/global/sprite.svg#entypo-thumbs-down"/> <use xlink:href="/assets/images/global/sprite.svg#entypo-thumbs-down"/>
</svg> </svg>
</button> </button>
<button id="edit-delete" class="content-editor-btn-icon editor-button submit-delete" for="post-delete" title='delete post'> <button id="edit-delete" class="content-editor-btn-icon editor-button submit-delete" for="post-delete" title='delete post'>
<svg id="edit-delete" viewbox="0 0 20 20" class="icons"> <svg id="edit-delete" role="icon">
<use id="edit-delete" xlink:href="/assets/images/global/sprite.svg#entypo-cross"/> <use id="edit-delete" xlink:href="/assets/images/global/sprite.svg#entypo-cross"/>
</svg> </svg>
</button> </button>
{% else %} {% else %}
<button id="edit-save" class="post-sumbit-btn submit-start editor-button" data-action='blog-add' type='submit'> <button id="edit-save" class="post-sumbit-btn submit-start editor-button" data-action='blog-add' type='submit'>
<svg id="submit-save" viewbox="0 0 20 20" class="icons"> <svg id="submit-save" role="icon">
<use id="submit-save" xlink:href="/assets/images/global/sprite.svg#entypo-plus"/> <use id="submit-save" xlink:href="/assets/images/global/sprite.svg#entypo-plus"/>
</svg> </svg>
</button> </button>
{% endif %} {% endif %}
</div> </div>

@ -1,8 +1,8 @@
<section role="index-header"> <section role="index-header">
<div> <div role="index-header-left">
<h1>Recent</h1> <h1>Recent</h1>
</div> </div>
<div> <div role="index-header-right">
<a href='/dashboard/pages' title="view pages"> <a href='/dashboard/pages' title="view pages">
<button> <button>
<svg role="icon"> <svg role="icon">

@ -6,7 +6,6 @@
</svg> </svg>
</button> </button>
</a> </a>
.
<a id="navigation" href="/dashboard/navigation" title="edit navigation"> <a id="navigation" href="/dashboard/navigation" title="edit navigation">
<button> <button>
<svg role="icon"> <svg role="icon">
@ -14,7 +13,6 @@
</svg> </svg>
</button> </button>
</a> </a>
.
<a id="navigation" href="/dashboard/logout" title="log out"> <a id="navigation" href="/dashboard/logout" title="log out">
<button> <button>
<svg role="icon"> <svg role="icon">

@ -0,0 +1,10 @@
<div role="notify-message">
<div role="notify-icons">
<i class="ti ti-mood-smile" role="notify-good"></i>
<i class="ti ti-mood-sad" role="notify-notgood"></i>
<i class="ti ti-settings" role="notify-working"></i>
</div>
<div role="notify-text">
<span role="response-text">Hey Hey</span>
</div>
</div>

@ -1,42 +1,40 @@
{% if page['menu'] %} {% if page['menu'] %}
{% set menu = 'true' %} {% set menu = 'true' %}
{% else %} {% else %}
{% set menu = 'false' %} {% set menu = 'false' %}
{% endif %} {% endif %}
{% if page['featured'] %} {% if page['featured'] %}
{% set featured = 'true' %} {% set featured = 'true' %}
{% else %} {% else %}
{% set featured = 'false' %} {% set featured = 'false' %}
{% endif %} {% endif %}
{% if page['published'] %} {% if page['published'] %}
{% set published = 'true' %} {% set published = 'true' %}
{% else %} {% else %}
{% set published = 'false' %} {% set published = 'false' %}
{% endif %} {% endif %}
<br>
<div id="post-options">
<button id="option-menu-pin" class="option-inactive post-option-btn" data-active="{{ menu }}" title='Pin to Menu'> <button id="option-menu-pin" class="option-inactive post-option-btn" data-active="{{ menu }}" title='Pin to Menu'>
<svg id="option-page-icon" viewbox="0 0 20 20" class="icons"> <svg id="option-page-icon" role="icon">
<use id="option-page-icon" xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/> <use id="option-page-icon" xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/>
</svg>
</button>
<button id="option-feature" class="option-inactive post-option-btn" data-active="{{ featured }}" title='Feature'>
<svg id="option-feature-icon" role="icon">
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
</svg>
</button>
<button id="option-published" class="option-inactive post-option-btn" data-active="{{ published }}" title='Published'>
<svg id="option-published-icon" role="icon">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
</svg> </svg>
</button> </button>
<button id="option-feature" class="option-inactive post-option-btn" data-active="{{ featured }}" title='Feature'> <a href="/dashboard/page/preview/{{ uuid }}" target="_blank">
<svg id="option-feature-icon" viewbox="0 0 20 20" class="icons"> <button id="option-preview" class="option-inactive post-option-btn" data-active="false" title='preview page'>
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/> <svg id="option-preview-icon" role="icon">
</svg> <use id="option-preview-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye"/>
</button>
<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">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
</svg>
</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> </svg>
</button> </button>
</a> </a>
</div>

@ -15,27 +15,23 @@
<div id="dash-reset" class="dash-reset"> <div id="dash-reset" class="dash-reset">
<img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/> <img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/>
<form id="reset" class='login' name="reset" action="/dashboard/login" method="POST"> <form id="reset" class='login' name="reset" action="/dashboard/login" method="POST">
<input type="password" id="new_password"name="new_password" class="form-control" placeholder="New Password" required"> <input type="password" id="new_password" name="new_password" class="form-control" placeholder="New Password" required">
<input type="password" id="new_password2" name="new_password2" class="form-control" placeholder="New Password Confirm" required"> <input type="password" id="new_password2" name="new_password2" class="form-control" placeholder="New Password Confirm" required">
<input type="password" id="secret" name="secret" class="form-control" placeholder="Account Secret" required"> <input type="password" id="secret" name="secret" class="form-control" placeholder="Account Secret" required">
<button id="reset-btn" class='login-btn' type='submit'> <button id="reset-btn" class='login-btn' type='submit'>
RESET PASSWORD RESET PASSWORD
</button><br /> </button><br/>
<p> <p>
Use this to get your secret to verify it's you. If your email is set up, the secret will be sent there. If not, the form will be updated automatically(but please set up your email, once you reset your password). Use this to get your secret to verify it's you. If your email is set up, the secret will be sent there. If not, the form will be updated automatically(but please set up your email, once you reset your password).
</p> </p>
<input type="text"id="email" name="email" class="form-control" placeholder="email to verify" required"> <input type="text" id="email" name="email" class="form-control" placeholder="email to verify" required">
<button id="get-secret-btn" class='login-btn' type='submit'> <button id="get-secret-btn" class='login-btn' type='submit'>
VERIFY EMAIL VERIFY EMAIL
</button><br /><br /> </button><br/><br/>
</form> </form>
</div>
</div>
</div> </div>
</div> </div>
</div> {% endblock %}
</div>
{% endblock %}
{% block javascripts %}
<script src="/assets/scripts/Start.js" type="text/javascript"></script>
{% endblock %}

@ -13,19 +13,19 @@
<div id="buttons"> <div id="buttons">
<button id="save-toggle" title="save settings"> <button id="save-toggle" title="save settings">
<svg id="submit-update" class="icons"> <svg id="submit-update" class="icons">
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-save"/> <use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-save"/>
</svg> </svg>
</button> </button>
<button id="publish-pages" title="publish site"> <button id="publish-pages" title="publish site">
<svg id="submit-update" class="icons"> <svg id="submit-update" class="icons">
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-publish"/> <use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-publish"/>
</svg> </svg>
</button> </button>
<button id="render-toggle" title="render on save toggle" data-render="{{ renderOnSave }}"> <button id="render-toggle" title="render on save toggle" data-render="{{ renderOnSave }}">
<svg id="render-toggle-icon" class="icons"> <svg id="render-toggle-icon" class="icons">
<use xlink:href="/assets/images/global/sprite.svg#entypo-circular-graph"/> <use xlink:href="/assets/images/global/sprite.svg#entypo-circular-graph"/>
</svg> </svg>
</button> </button>
</div> </div>
</div> </div>
<div id="settings-index"> <div id="settings-index">
@ -34,28 +34,28 @@
<div id="member-images" class="columns"> <div id="member-images" class="columns">
<div class="column is-one-third"> <div class="column is-one-third">
<div id="member-avatar-drop"> <div id="member-avatar-drop">
<img id="avatar" src="{{member['avatar']}}" for="avatar-upload"/> <img id="avatar" src="{{ member['avatar'] }}" for="avatar-upload"/>
<input id="avatar-upload" type="file" name="avatar-upload" /> <input id="avatar-upload" type="file" name="avatar-upload"/>
</div> </div>
</div> </div>
<div class="column is-two-thirds"> <div class="column is-two-thirds">
<div id="site-background"> <div id="site-background">
<img id="background" src="{{background}}" alt="image for site background" for="background-upload"/> <img id="background" src="{{ background }}" alt="image for site background" for="background-upload"/>
<input id="background-upload" type="file" name="backgrond-upload" /> <input id="background-upload" type="file" name="backgrond-upload"/>
</div> </div>
</div> </div>
</div> </div>
<div id="member-meta" class="columns"> <div id="member-meta" class="columns">
<div class="column is-one-third"> <div class="column is-one-third">
<input type='text' name='handle' id='settings-handle' placeholder='handle' value="{{member['handle']}}" autofocus /> <input type='text' name='handle' id='settings-handle' placeholder='handle' value="{{ member['handle'] }}" autofocus/>
<input type='text' name='email' id='settings-email' placeholder='email' value="{{member['email']}}" autofocus /> <input type='text' name='email' id='settings-email' placeholder='email' value="{{ member['email'] }}" autofocus/>
</div> </div>
<div class="column is-one-third"> <div class="column is-one-third">
<input type='text' name='base-url' id='settings-url' placeholder='url' value="{{baseUrl}}" autofocus /> <input type='text' name='base-url' id='settings-url' placeholder='url' value="{{ baseUrl }}" autofocus/>
<input type='text' name='base-title' id='settings-title' placeholder='site title' value="{{siteTitle}}" autofocus /> <input type='text' name='base-title' id='settings-title' placeholder='site title' value="{{ siteTitle }}" autofocus/>
</div> </div>
<div class="column is-one-third"> <div class="column is-one-third">
<textarea id="settings-desc" type='text' name='settings_desc' class='settings-dec' placeholder='description stuff', autofocus>{{desc}}</textarea> <textarea id="settings-desc" type='text' name='settings_desc' class='settings-dec' placeholder='description stuff' , autofocus>{{ desc }}</textarea>
</div> </div>
</div> </div>
</div> </div>
@ -66,42 +66,42 @@
{% if apiStatus is defined and apiStatus == "true" %} {% if apiStatus is defined and apiStatus == "true" %}
<button id="api-access-toggle" title="allow external api" data-enabled="true"> <button id="api-access-toggle" title="allow external api" data-enabled="true">
<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> <span id="api-status">EXTERNAL API ACCESS ENABLED</span>
</button> </button>
{% 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> <span id="api-status">EXTERNAL API ACCESS NOT ENABLED</span>
</button> </button>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<div id="dynamic-api"> <div id="dynamic-api">
{% if dynamicRenderStatus is defined and dynamicRenderStatus == "true" %} {% if dynamicRenderStatus is defined and dynamicRenderStatus == "true" %}
<button id="dynamic-render-toggle" title="allow external api" data-enabled="true"> <button id="dynamic-render-toggle" title="allow external api" data-enabled="true">
<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> <span id="dynamic-render-status">DYNAMIC PAGE RENDERING</span>
</button> </button>
{% 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> <span id="dynamic-render-status">STATIC PAGE RENDERING</span>
</button> </button>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="column"></div> <div class="column"></div>
@ -113,11 +113,11 @@
<label>THEMES</label> <label>THEMES</label>
{% for theme in themes %} {% for theme in themes %}
{% if theme.name == currentTheme %} {% if theme.name == currentTheme %}
<a href="#" id="{{theme.name}}" class="theme-select" data-enabled="true">{{theme['display-name']}}</a> <a href="#" id="{{ theme.name }}" class="theme-select" data-enabled="true">{{ theme['display-name'] }}</a>
{% else %} {% else %}
<a href="#" id="{{theme.name}}" class="theme-select" data-enabled="false">{{theme['display-name']}}</a> <a href="#" id="{{ theme.name }}" class="theme-select" data-enabled="false">{{ theme['display-name'] }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
<div id="mail-settings" class="column"> <div id="mail-settings" class="column">
@ -125,25 +125,25 @@
{% if mailOption == "option-none" or mailOption == "" %} {% if mailOption == "option-none" or mailOption == "" %}
<a href="#" class="mail-option" id="option-none" data-enabled="true">NONE</a> <a href="#" class="mail-option" id="option-none" data-enabled="true">NONE</a>
{% else %} {% else %}
<a href="#" class="mail-option" id="option-none" data-enabled="false">NONE</a> <a href="#" class="mail-option" id="option-none" data-enabled="false">NONE</a>
{% endif %} {% endif %}
{% if mailOption == "option-mg" or mailOption == "" %} {% if mailOption == "option-mg" or mailOption == "" %}
<a href="#" class="mail-option" id="option-mg" data-enabled="true">MAILGUN</a> <a href="#" class="mail-option" id="option-mg" data-enabled="true">MAILGUN</a>
{% else %} {% else %}
<a href="#" class="mail-option" id="option-mg" data-enabled="false">MAILGUN</a> <a href="#" class="mail-option" id="option-mg" data-enabled="false">MAILGUN</a>
{% endif %} {% endif %}
{% if mailOption == "option-smtp" or mailOption == "" %} {% if mailOption == "option-smtp" or mailOption == "" %}
<a href="#" class="mail-option" id="option-smtp" data-enabled="true">SMTP</a> <a href="#" class="mail-option" id="option-smtp" data-enabled="true">SMTP</a>
{% else %} {% else %}
<a href="#" class="mail-option" id="option-smtp" data-enabled="false">SMTP</a> <a href="#" class="mail-option" id="option-smtp" data-enabled="false">SMTP</a>
{% endif %} {% endif %}
{% apply spaceless %} {% apply spaceless %}
{{ include("dash/partials/mailforms.twig") }} {{ include("dash/partials/mailforms.twig") }}
{% endapply %} {% endapply %}
<button id="send-mail">TEST MAIL</button> <button id="send-mail">TEST MAIL</button>
<br /><br /> <br/><br/>
</div> </div>
</div> </div>
<div id="token-settings"> <div id="token-settings">
@ -151,42 +151,39 @@
<div class="column"> <div class="column">
<label>API KEY</label> <label>API KEY</label>
<div id="member-api-key"> <div id="member-api-key">
{{member['key']}} {{ member['key'] }}
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<label>FORM TOKEN</label> <label>FORM TOKEN</label>
<div id="form-token"> <div id="form-token">
{{ftoken}} {{ ftoken }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div id="backup-settings"> <div id="backup-settings">
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<button id="create-backup">BACK UP YOUR SITE</button><br /> <button id="create-backup">BACK UP YOUR SITE</button><br/>
</div> </div>
<div class="column"> <div class="column">
{% if lastBackup != '' %} {% if lastBackup != '' %}
<div class="backup-meta"> <div class="backup-meta">
LAST BACK UP <a href="/api/v1/files">{{lastBackup}}</a><br /> LAST BACK UP
<a href="/api/v1/files">{{ lastBackup }}</a><br/>
</div> </div>
{% else %} {% else %}
<span>span No back ups. Frowny face.</span> <span>span No back ups. Frowny face.</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block javascripts %}
<script src="/assets/scripts/Start.js" type="text/javascript"></script>
{% endblock %}

@ -17,7 +17,3 @@
{{ include("dash/forms/login.twig") }} {{ include("dash/forms/login.twig") }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block javascripts %}
<script src="/assets/scripts/Start.js?=dfadsf" type="text/javascript"></script>
{% endblock %}

27055
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,43 +1,35 @@
{ {
"name": "fipamo-dash", "name": "fipamo-dash",
"version": "2.5.1-beta", "version": "2.5.1-beta",
"private": true, "private": true,
"apidoc": { "apidoc": {
"name": "Fipamo API", "name": "Fipamo API",
"version": "1.0.0", "version": "1.0.0",
"description": "The most chill API for the most chill blog framework" "description": "The most chill API for the most chill blog framework"
}, },
"devDependencies": { "source": "src/com/Start.js",
"@babel/preset-env": "^7.16.5", "main": "public/assets/scripts/start.js",
"babel-cli": "^6.26.0", "targets": {
"eslint": "^8.11.0", "main": {
"eslint-plugin-babel": "^5.3.1", "includeNodeModules": true
"parcel": "^2.0.1", }
"prettier": "^2.6.0", },
"stylelint": "^14.8.2", "scripts": {
"stylelint-config-prettier-scss": "^0.0.1", "watch": "parcel watch",
"stylelint-config-standard-scss": "^3.0.0" "build": "parcel build"
}, },
"dependencies": { "devDependencies": {
"@babel/core": "^7.16.5", "@babel/core": "^7.21.3",
"@babel/eslint-parser": "^7.16.5", "babel-plugin-prismjs": "^2.1.0",
"animejs": "^3.2.1", "parcel": "^2.8.3",
"babel-plugin-prismjs": "^2.1.0", "prettier": "^2.8.4",
"babel-preset-env": "^1.7.0", "stylelint": "^15.3.0",
"bulma": "^0.9.3", "stylelint-config-standard": "^31.0.0"
"caret-pos": "^2.0.0", },
"jsdoc": "^3.6.7", "dependencies": {
"minami": "^1.2.3", "animejs": "^3.2.1",
"prismjs": "^1.25.0", "caret-pos": "^2.0.0",
"sass": "^1.45.1", "prismjs": "^1.29.0",
"sortablejs": "^1.14.0" "sortablejs": "^1.15.0"
}, }
"license": "UNLICENSED",
"author": "Are0h",
"scripts": {
"watch": "npx parcel watch src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts",
"build": "npx parcel build src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts"
},
"description": "Front end script for the most chill blog framework ever.",
"repository": "https://code.playvicio.us/Are0h/Fipamo"
} }

@ -1,43 +0,0 @@
{
"name": "fipamo-dash",
"version": "2.5.1-beta",
"private": true,
"apidoc": {
"name": "Fipamo API",
"version": "1.0.0",
"description": "The most chill API for the most chill blog framework"
},
"devDependencies": {
"@babel/preset-env": "^7.16.5",
"babel-cli": "^6.26.0",
"eslint": "^8.11.0",
"eslint-plugin-babel": "^5.3.1",
"parcel": "^2.0.1",
"prettier": "^2.6.0",
"stylelint": "^14.8.2",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard-scss": "^3.0.0"
},
"dependencies": {
"@babel/core": "^7.16.5",
"@babel/eslint-parser": "^7.16.5",
"animejs": "^3.2.1",
"babel-plugin-prismjs": "^2.1.0",
"babel-preset-env": "^1.7.0",
"bulma": "^0.9.3",
"caret-pos": "^2.0.0",
"jsdoc": "^3.6.7",
"minami": "^1.2.3",
"prismjs": "^1.25.0",
"sass": "^1.45.1",
"sortablejs": "^1.14.0"
},
"license": "UNLICENSED",
"author": "Are0h",
"scripts": {
"watch": "sass --watch src/styles:public/assets/css & npx parcel watch src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts",
"build": "sass src/styles:public/assets/css & npx parcel build src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts"
},
"description": "Front end script for the most chill blog framework ever.",
"repository": "https://code.playvicio.us/Are0h/Fipamo"
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,22 @@
:root {
/* BASE COLORS */
--primary: #1d3040;
--secondary: #b2cce5;
--tertiary: #f5ab35;
--highlight: #fc6399;
--white: #efebe3;
--grey: #abb7b7;
--black: #32302f;
/* EDITOR COLORS */
--event-cool: #32cd32;
--event-lame: #f64747;
--editor-primary: #fde3a7;
--editor-secondary: #e7903c;
--editor-tertiary: #6bb9f0;
--editor-string: #dcc6e0;
--editor-tag: #e73c4e;
/* RGB Versions */
--primary-rgb: 29 28 24;
}

@ -0,0 +1,54 @@
a {
color: var(--primary);
}
p {
background: var(--tertiary);
color: var(--primary);
padding: 5px;
display: block;
border-radius: 5px;
text-align: left;
}
input[type="email"],
input[type="password"],
input[type="text"] {
border: 0;
border-radius: 5px;
font: 18px var(--base-type);
display: inline-block;
background: var(--primary);
color: var(--tertiary);
}
textarea {
border: 0;
border-radius: 3px;
color: var(--white);
background: var(--primary);
}
button,
input[type="submit"] {
background: var(--highlight);
color: var(--primary);
font: 20px var(--base-type);
border-radius: 5px;
position: relative;
cursor: pointer;
border: 0;
transition: all 0.3s linear;
}
select {
font: 14px var(--base-type);
border: 1px solid var(--secondary);
appearance: none;
color: var(--primary);
}
::placeholder {
font: 25px var(--base-type);
color: var(--white);
}

@ -0,0 +1,131 @@
html {
width: 100%;
height: 100%;
overflow: hidden;
font: 400 1.2em/1.4em var(--base-type);
}
html body {
background: var(--primary);
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
}
/* GLOBALS */
a {
color: var(--primary);
text-decoration: none;
border-bottom: 1px solid var(--secondary);
transition: all 0.2s linear;
}
a:hover {
border-bottom: 1px solid var(--highlight);
}
sup {
background: var(--black);
color: var(--white);
padding: 3px;
border-radius: 3px;
}
#notifications {
display: none;
visibility: hidden;
}
pre,
code {
background: var(--black);
color: var(--highlight);
border-radius: 3px;
padding: 3px;
}
svg[role="icon"] {
fill: var(--white);
width: 25px;
height: 25px;
padding-top: 5px;
}
/* HEADER
Navigation
Notificiations
*/
header {
width: 100%;
max-width: 900px;
margin: 10px auto;
background: var(--white);
height: 50px;
border-radius: 5px;
left: 50%;
transform: translate(-50%, 0);
position: fixed;
z-index: 500;
box-shadow: 2px 2px 0 rgba(var(--primary-rgb) / 30%);
}
header > nav {
display: grid;
grid-template-columns: 50px 1fr auto;
}
header > nav > div[role="nav-left"] img {
width: 40px;
padding: 5px;
}
header > nav > div[role="nav-right"] {
padding: 5px;
}
header > nav > div[role="nav-right"] button {
width: 40px;
height: 40px;
margin-left: 5px;
}
section[role="login"] {
margin: 15% auto;
padding: 10px;
width: 500px;
border-radius: 5px;
background: var(--white);
display: grid;
grid-template-columns: 28.5% 1fr;
gap: 10px;
}
section[role="login"] form input {
width: 95%;
height: 30px;
padding: 5px;
margin-bottom: 10px;
}
section[role="login"] form button {
padding: 10px 5px;
width: 82%;
}
section[role="login"] form a {
padding: 10px 5px;
border-radius: 5px;
width: 10%;
height: 20px;
display: inline-block;
background: var(--tertiary);
vertical-align: top;
text-align: center;
margin: 0 0 0 10px;
font-weight: 600;
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,85 @@
section[role="index-header"] {
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
max-width: 900px;
margin: 60px auto 0;
}
section[role="index-recent-pages"] a {
width: 100%;
height: 100%;
display: flex;
justify-content: left;
align-items: center;
border-radius: 5px;
border-bottom: none;
}
section[role="index-recent-pages"] a:nth-child(1) {
grid-column: 1/4;
grid-row: 1/3;
}
section[role="index-recent-pages"] a:nth-child(2) {
grid-row: 3/6;
}
section[role="index-recent-pages"] a:nth-child(3) {
grid-column: 2/4;
grid-row: 3/5;
}
section[role="index-header"] div[role="index-header-right"] {
display: flex;
justify-content: right;
align-items: center;
}
section[role="index-header"] div[role="index-header-right"] a {
border-bottom: none;
margin-left: 5px;
}
section[role="index-recent-pages"] {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-auto-rows: minmax(200px, auto);
gap: 10px;
width: 100%;
max-width: 900px;
margin: 10px auto;
}
section[role="index-recent-pages"] a button {
padding: 1px 5px;
}
section[role="index-recent-pages"] button[data-active="true"] {
background: var(--primary);
}
section[role="index-recent-pages"] button[data-active="true"] svg {
fill: var(--tertiary);
}
section[role="index-recent-pages"] button[data-active="false"] {
background: var(--secondary);
}
section[role="index-recent-pages"] button[data-active="false"] svg {
fill: var(--primary);
}
section[role="index-recent-pages"] aside {
font-size: 1.1em;
color: var(--white);
text-shadow: 2px 2px 2px var(--black);
padding: 10px;
}
section[role="index-recent-pages"] hr {
color: var(--white);
border: 0.1px solid;
margin: 7px 0;
}

@ -0,0 +1,66 @@
header > nav > div[role="notifications"] {
width: 100%;
}
header > nav > div[role="notifications"] > div[role="notify-message"] {
display: flex;
height: 86%;
}
header > nav > div[role="notifications"] > div[role="notify-message"] div {
display: inline-block;
transition: all 0.2s linear;
}
header
> nav
> div[role="notifications"]
> div[role="notify-message"]
> div[role="notify-text"] {
color: var(--white);
border-radius: 5px;
height: 79%;
margin-top: 5px;
opacity: 0;
}
header
> nav
> div[role="notifications"]
> div[role="notify-message"]
> div[role="notify-icons"] {
margin: 5px;
width: 0;
opacity: 0;
}
header
> nav
> div[role="notifications"]
> div[role="notify-message"]
> div[role="notify-text"]
span {
display: block;
padding: 5px;
margin-top: 4px;
}
header > nav > div[role="notifications"] > div[role="notify-message"] i {
display: none;
color: var(--primary);
}
i[role="notify-working"] {
animation: 2s infinite linear spin;
height: 40px;
width: 40px;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@ -0,0 +1,111 @@
code[class*="language-"],
pre[class*="language-"] {
color: var(--editor-primary);
background: none;
font-family: var(--mono-type);
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
tab-size: 4;
hyphens: none;
}
pre[class*="language-"] {
margin: 0.1em 0;
overflow: auto;
border-radius: 0.3em;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: var(--primary);
}
:not(pre) {
& > code[class*="language-"] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #8292a2;
}
.token.punctuation {
color: var(--editor-secondary);
}
.token.namespace {
opacity: 0.6;
}
.token.keyword {
color: #66d9ef;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.token.content {
color: var(--editor-tertiary);
}
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
color: var(--editor-tag);
}
.token.boolean,
.token.number {
color: #ae81ff;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #a6e22e;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: var(--editor-string);
}
.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
color: #e6db74;
}
.token.regex,
.token.important {
color: var(--editor-secondary);
}
.token.important,
.token.bold {
font-weight: normal;
}

@ -0,0 +1,345 @@
/* FILE MANAGER */
main > section[role="file-manager"] {
width: 100%;
background: var(--tertiary);
padding: 20px 0;
margin-top: 75px;
}
main > section[role="file-manager"] label[role="list-title"] {
width: 100%;
max-width: 900px;
margin: 0 auto;
display: block;
color: var(--primary);
}
main > section[role="file-manager"] > div[role="file-drop"] {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 100px;
background: var(--white);
color: var(--primary);
vertical-align: middle;
border-radius: 5px;
max-width: 900px;
margin: 10px auto;
}
main > section[role="file-manager"] > div[role="page-images-list"],
main > section[role="file-manager"] > div[role="page-files-list"] {
max-width: 900px;
width: 100%;
margin: 10px auto;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 10px;
}
main > section[role="file-manager"] > div[role="page-images-list"] > div,
main > section[role="file-manager"] > div[role="page-files-list"] > div {
width: 100%;
height: 150px;
border-radius: 3px;
overflow: hidden;
position: relative;
cursor: pointer;
}
main
> section[role="file-manager"]
> div[role="page-images-list"]
> div
> div.item-progress {
width: 100%;
height: 100%;
background: var(--primary);
}
main
> section[role="file-manager"]
> div[role="page-images-list"]
> div
> button.media-remove,
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div
> button.media-remove {
color: var(--white);
margin: 5px;
}
main
> section[role="file-manager"]
> div[role="page-images-list"]
> div.video-item
> video {
object-fit: cover;
height: 100%;
width: 100%;
}
main
> section[role="file-manager"]
> div[role="page-images-list"]
> div.video-item
> button,
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div.audio-item
> button,
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div.file-item
> button {
position: absolute;
top: 0;
left: 0;
}
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div.audio-item {
background: url("/assets/images/global/upload-audio.png") no-repeat center
center / cover;
}
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div.file-item {
background: url("/assets/images/global/upload-doc.png") no-repeat center
center / cover;
}
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div.file-item
> a {
position: absolute;
bottom: 0;
background: var(--secondary);
padding: 2px;
}
main
> section[role="file-manager"]
> div[role="page-files-list"]
> div.audio-item
> audio {
height: 100%;
width: 100%;
}
/* PAGE META */
main > section[role="page-meta"] {
width: 100%;
background: var(--highlight);
}
main > section[role="page-meta"] > div[role="page-meta-wrapper"] {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
width: 100%;
max-width: 900px;
margin: 10px auto;
color: var(--white);
}
main section[role="page-meta"] textarea#post-title-text {
background: var(--white);
font-family: var(--base-type);
width: 100%;
height: 80px;
font-size: 2em;
color: var(--primary);
}
main section[role="page-meta"] textarea#post-tags {
background: var(--white);
font-family: var(--base-type);
width: 100%;
height: 80px;
color: var(--primary);
}
main section[role="page-meta"] select {
background: var(--primary);
color: var(--secondary);
border-radius: 3px;
border-color: var(--primary);
width: 100%;
height: 45px;
padding: 5px;
font-size: 1.5em;
}
main section[role="page-meta"] div[role="page-options"] {
width: 100%;
}
main
section[role="page-meta"]
div[role="page-meta-wrapper"]
div[role="page-options"]
button {
width: 25%;
height: 45px;
transition: all 0.3s linear;
margin: 0;
border-radius: 0;
display: inline-block;
vertical-align: top;
text-align: center;
}
main
> section[role="page-meta"]
> div[role="page-meta-wrapper"]
> div[role="page-options"]
> button.post-option-btn:nth-child(3) {
border-radius: 3px 0 0 3px;
}
main
> section[role="page-meta"]
> div[role="page-meta-wrapper"]
> div[role="page-options"]
> a
> button {
border-radius: 0 3px 3px 0;
}
main
section[role="page-meta"]
div[role="page-meta-wrapper"]
button[data-active="false"] {
background: var(--primary);
}
main
section[role="page-meta"]
div[role="page-meta-wrapper"]
button[data-active="false"]
svg {
fill: var(--secondary);
}
main
section[role="page-meta"]
div[role="page-meta-wrapper"]
div[role="page-options"]
button[data-active="true"] {
background: var(--tertiary);
}
main
section[role="page-meta"]
div[role="page-meta-wrapper"]
div[role="page-options"]
button[data-active="true"]
svg {
fill: var(--primary);
}
main
section[role="page-meta"]
div[role="page-meta-wrapper"]
div[role="page-created"]
input {
display: none;
visibility: hidden;
}
/* TEXT EDITOR */
main > section[role="text-editor"] {
width: 100%;
max-width: 900px;
margin: 0 auto;
}
main section[role="text-editor"] .icon-hide {
display: none;
visibility: hidden;
}
main > section[role="text-editor"] > div[role="text-editor-control"] {
display: grid;
grid-template-columns: repeat(10, 1fr);
gap: 5px;
}
main > section[role="text-editor"] > div[role="edit-post-wrapper"] {
width: 100%;
max-width: 900px;
border-radius: 5px;
position: relative;
margin: 10px 0;
}
main
> section[role="text-editor"]
> div[role="edit-post-wrapper"]
textarea:focus {
outline: none;
border-color: var(--highlight);
}
main section[role="text-editor"] div[role="edit-post-wrapper"] #edit,
main section[role="text-editor"] div[role="edit-post-wrapper"] #highlight {
font-family: var(--mono-type);
border: 0;
width: 100%;
min-height: 300px;
height: auto;
position: absolute;
top: 0;
left: 0;
overflow: auto;
word-wrap: normal;
white-space: pre-wrap;
line-break: normal;
font-size: 1.1em;
line-height: 1.2;
padding: 0;
margin: 0;
}
main
section[role="text-editor"]
div[role="edit-post-wrapper"]
#highlight-content {
word-wrap: normal;
white-space: pre-wrap;
line-break: normal;
}
main > section[role="text-editor"] > div[role="edit-post-wrapper"] > #edit {
z-index: 1;
background: transparent;
color: transparent;
caret-color: var(--highlight);
}
main
> section[role="text-editor"]
> div[role="edit-post-wrapper"]
> #highlight {
z-index: 0;
}
main section[role="text-editor"] div[role="edit-post-wrapper"] pre,
main section[role="text-editor"] div[role="edit-post-wrapper"] pre code {
padding: 0;
margin: 0;
}

@ -0,0 +1,9 @@
@import url("colors.css");
@import url("forms.css");
@import url("typography.css");
@import url("frame.css");
@import url("icons.css");
@import url("notifications.css");
@import url("index.css");
@import url("page-editor.css");
@import url("page-editor-highlights.css");

@ -0,0 +1,29 @@
:root {
--base-type: helvetica, arial, sans-serif;
--mono-type: "Lucida Console", monaco, monospace;
}
h1,
h2,
h3 {
color: var(--white);
}
h1 {
font-size: 2em;
font-weight: 700;
}
h2 {
font-size: 1.8em;
font-weight: 600;
}
h3 {
font-size: 1.5em;
font-weight: 500;
}
main > article > h1 {
color: var(--primary);
}

File diff suppressed because it is too large Load Diff

@ -57,7 +57,7 @@ export default class Base {
let self = this; let self = this;
e.preventDefault(); e.preventDefault();
let authForm = data.formDataToJSON(document.getElementById('login')); let authForm = data.formDataToJSON(document.getElementById('login'));
notify.alert('Looking, hold up', null); //notify.alert('Looking, hold up', null);
let api = new FipamoAdminAPI(); let api = new FipamoAdminAPI();
this.processing = true; this.processing = true;
api.login(authForm) api.login(authForm)
@ -66,7 +66,7 @@ export default class Base {
if (response.type === DataEvent.REQUEST_LAME) { if (response.type === DataEvent.REQUEST_LAME) {
notify.alert(response.message, false); notify.alert(response.message, false);
} else { } else {
notify.alert(response.message, true); //notify.alert(response.message, true);
e.target.innerHTML = response.message; e.target.innerHTML = response.message;
setTimeout(() => { setTimeout(() => {
window.location = '/dashboard'; window.location = '/dashboard';

@ -9,84 +9,41 @@ export default class PostActions {
//-------------------------- //--------------------------
collectInfo(files) { collectInfo(files) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let pageInfo = new FormData(); let pageInfo = [];
pageInfo.enctype = 'multipart/form-data'; let pageRef = document.querySelector('[role="file-manager"]');
//process html content for storage
let txt = document.createElement('textarea'); let txt = document.createElement('textarea');
txt.innerHTML = document.getElementById('highlight-content').innerHTML; txt.innerHTML = document.getElementById('highlight-content').innerHTML;
let html = txt.value; let html = txt.value;
html = html.replace(/<\/?span[^>]*>/g, ''); //removes prism styling html = html.replace(/<\/?span[^>]*>/g, ''); //removes prism styling
html = html.replace(/<\/?br[^>]*>/g, '\n'); //convert back to encoded line break for storage html = html.replace(/<\/?br[^>]*>/g, '\n'); //convert back to encoded line break for storage
pageInfo.append( //build data object
'id', pageInfo = {
document.getElementById('post-edit-index').getAttribute('data-index') id: pageRef.getAttribute('data-index'),
); uuid: pageRef.getAttribute('data-uuid'),
pageInfo.append( layout: document.getElementById('page-templates').value,
'uuid', current_title: pageRef.getAttribute('data-slug'),
document.getElementById('post-edit-index').getAttribute('data-uuid') content: html,
); title: document.getElementById('post-title-text').value,
pageInfo.append( created: document.getElementById('post-date').getAttribute('data-raw'),
'layout', slug: new StringUtils().cleanString(
document.getElementById('post-edit-index').getAttribute('data-layout')
);
pageInfo.append(
'current_title',
document.getElementById('post-edit-index').getAttribute('data-slug')
);
pageInfo.append('content', html);
pageInfo.append('title', document.getElementById('post-title-text').value);
pageInfo.append(
'created',
document.getElementById('post-date').getAttribute('data-raw')
);
pageInfo.append(
'slug',
new StringUtils().cleanString(
document.getElementById('post-title-text').value document.getElementById('post-title-text').value
) ),
); tags: document.getElementById('post-tags').value,
pageInfo.append('tags', document.getElementById('post-tags').value); menu: document
pageInfo.append( .getElementById('option-menu-pin')
'menu', .getAttribute('data-active'),
document.getElementById('option-menu-pin').getAttribute('data-active') featured: document
); .getElementById('option-feature')
pageInfo.append( .getAttribute('data-active'),
'featured', published: document
document.getElementById('option-feature').getAttribute('data-active') .getElementById('option-published')
); .getAttribute('data-active'),
pageInfo.append( form_token: document.getElementById('form_token').value,
'published', imageList: files.images,
document.getElementById('option-published').getAttribute('data-active') fileList: files.files
); };
pageInfo.append('layout', document.getElementById('page-templates').value);
pageInfo.append('form_token', document.getElementById('form_token').value);
if (files.length > 0 && files != null) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
if (
file.type.match('image.*') ||
file.type.match('video.mp4') ||
file.type.match('audio.mpeg') ||
file.type.match('application.pdf') ||
file.type.match('text.plain') ||
file.type.match('text.rtf')
) {
pageInfo.append('page_files[]', file, file.name);
} else {
reject('Not an image file: ' + file.type);
}
}
} else {
//check to see if image exists
if (document.getElementById('featured-image')) {
var imageURL = document.getElementById('featured-image').src;
imageURL != null || imageURL != undefined
? pageInfo.append('feature_image', imageURL)
: pageInfo.append('feature_image', null);
} else {
//pageInfo.append("feature_image", null);
}
}
//console.log("FILES", files);
resolve(pageInfo); resolve(pageInfo);
}); });
} }

@ -18,6 +18,7 @@ export const API_RESTORE_BACKUP = '/api/v1/backup/restore';
export const API_UPLOAD_AVATAR = '/api/v1/settings/add-avatar'; export const API_UPLOAD_AVATAR = '/api/v1/settings/add-avatar';
export const API_UPLOAD_BACKGROUND = '/api/v1/settings/add-feature-background'; export const API_UPLOAD_BACKGROUND = '/api/v1/settings/add-feature-background';
export const API_IMAGE_UPLOAD = '/api/v1/page/add-entry-image'; export const API_IMAGE_UPLOAD = '/api/v1/page/add-entry-image';
export const API_FILES_UPLOAD = '/api/v1/files';
//** API TASKS **// //** API TASKS **//
export const TASK_SITE_INIT = 'blogInit'; export const TASK_SITE_INIT = 'blogInit';
export const TASK_BACKUP_RESTORE = 'restoreBackup'; export const TASK_BACKUP_RESTORE = 'restoreBackup';
@ -38,11 +39,21 @@ class MaintenanceManager {
* @param {string} baseURL - url of site; uses local when empty * @param {string} baseURL - url of site; uses local when empty
* @param {string} key - user api key * @param {string} key - user api key
*/ */
constructor(baseURL = null, key = null, progressBar = null) { constructor(baseURL = null, key = null) {
this.accetableFiles = [
'image/jpeg',
'image/gif',
'image/png',
'image/svg',
'audio/mpeg',
'video/mp4',
'application/pdf',
'text/plain',
'text/rtf'
];
this.percentComplete = 0; //for later this.percentComplete = 0; //for later
this.token = null; this.token = null;
this.baseURL = null; this.baseURL = null;
this.progressBar = progressBar;
this.key = null; this.key = null;
if (key) this.key = key; if (key) this.key = key;
if (baseURL) this.baseURL = baseURL; if (baseURL) this.baseURL = baseURL;
@ -185,53 +196,28 @@ class MaintenanceManager {
} }
/** /**
* Promise method for uploading images [todo: change to uploading files] * Promise method for uploading files [todo: change to uploading files]
* @param {string} type - type of upload * @param {string} type - type of upload
* @param {input} files - form input containing files * @param {input} files - form input containing files
*/ */
imageUpload(type, files) { filesUpload(type, files, progress = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let url = ''; let url = API_FILES_UPLOAD;
switch (type) {
case 'avatar-upload':
url = API_UPLOAD_AVATAR;
break;
case 'background-upload':
url = API_UPLOAD_BACKGROUND;
break;
default:
url = API_IMAGE_UPLOAD;
break;
}
var imageData = new FormData();
if (this.baseURL) { if (this.baseURL) {
imageData.append('key', this.key); files.append('key', this.key);
imageData.append('remote', true); files.append('remote', true);
} else { } else {
imageData.append('remote', false); files.append('remote', false);
} }
for (var i = 0; i < files.length; i++) {
var file = files[i];
// Check the file type.
if (!file.type.match('image.*')) {
continue;
}
if (type === 'avatar-upload') {
imageData.append('avatar_upload', file, file.name);
} else if (type === 'background-upload') {
imageData.append('background_upload', file, file.name);
} else {
imageData.append('post_image', file, file.name);
}
}
this._request( this._request(
url, url,
progress,
TASK_UPLOAD_FILES, TASK_UPLOAD_FILES,
REQUEST_TYPE_POST, REQUEST_TYPE_POST,
CONTENT_TYPE_FORM, CONTENT_TYPE_FORM,
imageData files
) )
.then(r => { .then(r => {
resolve(r); resolve(r);
@ -247,6 +233,7 @@ class MaintenanceManager {
//-------------------------- //--------------------------
_request( _request(
requestURL, requestURL,
progressBar = null,
eventType, eventType,
requestType = REQUEST_TYPE_GET, requestType = REQUEST_TYPE_GET,
contentType = CONTENT_TYPE_JSON, contentType = CONTENT_TYPE_JSON,
@ -255,8 +242,9 @@ class MaintenanceManager {
var self = this; var self = this;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.upload.addEventListener('progress', e => request.upload.addEventListener('progress', e =>
self.handleLoadProgress(e, self.progressBar) self.handleLoadProgress(e, progressBar)
); );
request.open(requestType, requestURL, true); request.open(requestType, requestURL, true);
request.onload = () => { request.onload = () => {

@ -21,30 +21,30 @@ export default class PostEditor {
this.processing = false; this.processing = false;
let self = 'this'; let self = 'this';
this.admin = new FipamoAdminAPI(null, document.getElementById('notify-progress')); this.admin = new FipamoAdminAPI(null, document.getElementById('notify-progress'));
this.mm = new Maintenance(null, null, document.getElementById('notify-progress')); this.mm = new Maintenance(null, null);
this.urlPieces = document.URL.split('/'); this.urlPieces = document.URL.split('/');
this.post = []; this.post = [];
this.postID = null; this.postID = null;
this.postUUID = null; this.postUUID = null;
this.postLayout = null; this.postLayout = null;
this.fm = null; this.fm = null;
if (document.getElementById('post-edit-index').getAttribute('data-index')) { if (document.querySelector('[role="file-manager"]').getAttribute('data-index')) {
this.postID = document this.postID = document
.getElementById('post-edit-index') .querySelector('[role="file-manager"]')
.getAttribute('data-index'); .getAttribute('data-index');
this.postUUID = document this.postUUID = document
.getElementById('post-edit-index') .querySelector('[role="file-manager"]')
.getAttribute('data-uuid'); .getAttribute('data-uuid');
this.postLayout = document this.postLayout = document
.getElementById('post-edit-index') .querySelector('[role="file-manager"]')
.getAttribute('data-layout'); .getAttribute('data-layout');
} }
if (document.getElementById('edit')) { if (document.getElementById('edit')) {
this.editor = new TextEditor( this.editor = new TextEditor(
document.getElementById('edit'), document.getElementById('edit'),
document.getElementById('header').offsetHeight + document.querySelector('[role="file-manager"]').offsetHeight +
document.getElementById('post-header').offsetHeight + document.querySelector('[role="page-meta"]').offsetHeight +
document.getElementById('post-feature').offsetHeight document.querySelector('[role="text-editor"]').offsetHeight
); );
this.editor.addListener( this.editor.addListener(
EditorEvent.EDITOR_DELETE, EditorEvent.EDITOR_DELETE,
@ -89,13 +89,13 @@ export default class PostEditor {
// methods // methods
//-------------------------- //--------------------------
start() { start() {
if (document.getElementById('page-file-drop')) { if (document.querySelector('[role="file-drop"]')) {
//insert fileManager here //insert fileManager here
this.fm = new FileManager( this.fm = new FileManager(
document.getElementById('page-file-drop'), document.querySelector('[role="file-drop"]'),
document.getElementById('page-files-upload'), document.getElementById('page-files-upload'),
document.getElementById('page-images-list'), document.querySelector('[role="page-images-list"]'),
document.getElementById('page-files-list') document.querySelector('[role="page-files-list"]')
); );
var optionButtons = document.querySelectorAll('.post-option-btn'); var optionButtons = document.querySelectorAll('.post-option-btn');
for (var i = 0, length = optionButtons.length; i < length; i++) { for (var i = 0, length = optionButtons.length; i < length; i++) {
@ -143,8 +143,7 @@ export default class PostEditor {
e === EditorEvent.EDITOR_SAVE e === EditorEvent.EDITOR_SAVE
? (task = TASK_PAGE_CREATE) ? (task = TASK_PAGE_CREATE)
: (task = TASK_PAGE_EDIT); : (task = TASK_PAGE_EDIT);
new PageActions().collectInfo(this.fm.getFileOrder()).then(page => {
new PageActions().collectInfo(this.fm.getFiles()).then(page => {
self.processing = true; self.processing = true;
notify.alert('Writing down changes', null); notify.alert('Writing down changes', null);
self.admin self.admin
@ -208,12 +207,18 @@ export default class PostEditor {
handleImageUpload(type, files) { handleImageUpload(type, files) {
let self = this; let self = this;
notify.alert('Uploading Image', null); notify.alert('Uploading Image', null);
let upload = new FormData();
self.mm upload.enctype = 'multipart/form-data';
.imageUpload(type, files) upload.append('upload_files[]', files[0], files[0].name);
.then(r => { this.mm
if (r.type == DataEvent.POST_IMAGE_ADDED) { .filesUpload(files[0].type, upload)
self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url); .then(result => {
console.log('RESULT'.result);
if (result.message == 'File Uploaded. Great!') {
self.editor.notify(
EditorEvent.EDITOR_UPLOAD_POST_IMAGE,
result.filePath
);
notify.alert('Image Added to Entry', true); notify.alert('Image Added to Entry', true);
} else { } else {
notify.alert('Uh oh. Image not added', false); notify.alert('Uh oh. Image not added', false);
@ -221,8 +226,6 @@ export default class PostEditor {
}) })
.catch(() => { .catch(() => {
notify.alert('Uh oh. Image not added', false); notify.alert('Uh oh. Image not added', false);
//console.log('ERROR', err);
}); });
} }
} }
PostEditor.uploadFiles = [];

@ -1,6 +1,8 @@
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import anime from 'animejs/lib/anime.es.js';
import DataUtils from '../utils/DataUtils'; import DataUtils from '../utils/DataUtils';
import Notfications from './Notifications.js'; import Notfications from './Notifications.js';
import Maintenance from '../controllers/MaintenanceManager';
const notify = new Notfications(); const notify = new Notfications();
export default class FileManager { export default class FileManager {
@ -8,6 +10,7 @@ export default class FileManager {
// constructor // constructor
//-------------------------- //--------------------------
constructor(upload, input, imageList, fileList) { constructor(upload, input, imageList, fileList) {
this.mm = new Maintenance(null, null, document.getElementById('notify-progress'));
this.upload = upload; this.upload = upload;
this.input = input; this.input = input;
this.imageList = imageList; this.imageList = imageList;
@ -29,15 +32,15 @@ export default class FileManager {
this.mediaSort = Sortable.create(this.imageList, { this.mediaSort = Sortable.create(this.imageList, {
animation: 150, animation: 150,
onUpdate: () => { onUpdate: () => {
notify.alert('REINDEXING MEDIA', null); //notify.alert('REINDEXING MEDIA', null);
this.updateFiles(); //this.updateFiles();
} }
}); });
this.fileSort = Sortable.create(this.fileList, { this.fileSort = Sortable.create(this.fileList, {
animation: 150, animation: 150,
onUpdate: () => { onUpdate: () => {
notify.alert('REINDEXING FILES', null); //notify.alert('REINDEXING FILES', null);
this.updateFiles(); //this.updateFiles();
} }
}); });
this.start(); this.start();
@ -58,25 +61,19 @@ export default class FileManager {
); );
} }
} }
getFiles() { getFileOrder() {
return this.files; let imgList = '';
} let fileList = '';
for (var i = 0, length = this.imageList.childNodes.length; i < length; i++) {
reindexFiles(sortOrder, step) { let div = this.imageList.childNodes[i];
let count = sortOrder.length; imgList = imgList + div.getAttribute('data-source') + ',';
if (step == 0) this.files = []; }
var utils = new DataUtils(); for (var i = 0, length = this.fileList.childNodes.length; i < length; i++) {
utils.imgLoad(sortOrder[step].earl).then(blob => { let div = this.fileList.childNodes[i];
var fresh = new File([blob], sortOrder[step].fileName, { type: blob.type }); fileList = fileList + div.getAttribute('data-source') + ',';
this.files.push(fresh); }
var limit = count - 1; let media = { images: imgList, files: fileList };
if (this.files.length <= limit) { return media;
step = step + 1;
this.reindexFiles(sortOrder, step);
} else {
notify.alert('FILES READY TO UPLOAD', true);
}
});
} }
sortFiles(files) { sortFiles(files) {
@ -88,16 +85,24 @@ export default class FileManager {
return function (f) { return function (f) {
//create remove button object //create remove button object
var remove = document.createElement('button'); var remove = document.createElement('button');
var removeIcon = document.createElement('i');
removeIcon.classList.add('ti', 'ti-x');
remove.className = 'media-remove'; remove.className = 'media-remove';
remove.innerHTML = 'X'; remove.appendChild(removeIcon);
//remove.setAttribute('id', mediaCount);
remove.addEventListener( remove.addEventListener(
'click', 'click',
e => self.removeFile(e, 'media'), e => self.removeFile(e, 'media'),
false false
); );
//get counts for lists
var mediaCount = self.imageList.childNodes.length; //upload the file
var fileCount = self.fileList.childNodes.length; let upload = new FormData();
upload.enctype = 'multipart/form-data';
upload.append('upload_files[]', theFile, theFile.name);
let item = null;
let progress = null;
// sort files // sort files
switch (theFile.type) { switch (theFile.type) {
case 'image/jpg': case 'image/jpg':
@ -105,66 +110,109 @@ export default class FileManager {
case 'image/gif': case 'image/gif':
case 'image/svg': case 'image/svg':
case 'image/png': case 'image/png':
//create element and add to list item = self.itemFactory('img-item');
//var image = document.createElement('img'); progress = document.getElementById(
//image.src = f.target.result; 'pgs' + item.getAttribute('id')
//image.title = escape(theFile.name); );
var span = document.createElement('div'); self.mm
span.style.background = .filesUpload(theFile.type, upload, progress)
'url(' + .then(result => {
f.target.result + item.setAttribute('data-source', result.filePath);
') no-repeat center center / cover'; item.style.background =
span.className = 'img-item'; 'url(' +
f.target.result +
//image.setAttribute('id', i); ') no-repeat center center / cover';
self.storage.push([ anime({
{ targets: progress,
id: 'page_image' + i, width: 0,
data: f.target.result, easing: 'easeInOutQuint',
type: theFile.type, duration: 1000,
name: escape(theFile.name) complete: () => {
} item.removeChild(progress);
]); item.appendChild(remove);
if (mediaCount < 0) mediaCount = 0; }
span.setAttribute('id', mediaCount); });
remove.setAttribute('id', mediaCount); });
span.setAttribute('data-file-name', theFile.name);
span.appendChild(remove);
self.imageList.appendChild(span);
break; break;
case 'video/mp4': case 'video/mp4':
var video = document.createElement('div'); item = self.itemFactory('video-item');
video.className = 'video-item'; progress = document.getElementById(
video.setAttribute('data-source', f.target.result); 'pgs' + item.getAttribute('id')
if (mediaCount < 0) mediaCount = 0; );
video.setAttribute('id', mediaCount); self.mm
remove.setAttribute('id', mediaCount); .filesUpload(theFile.type, upload, progress)
video.setAttribute('data-file-name', theFile.name); .then(result => {
video.appendChild(remove); item.setAttribute('data-source', result.filePath);
self.imageList.appendChild(video); let video = document.createElement('video');
let source = document.createElement('source');
source.src = f.target.result;
video.appendChild(source);
item.appendChild(video);
anime({
targets: progress,
width: 0,
easing: 'easeInOutQuint',
duration: 1000,
complete: () => {
item.removeChild(progress);
item.appendChild(remove);
}
});
});
break; break;
case 'audio/mpeg': case 'audio/mpeg':
var sound = document.createElement('div'); item = self.itemFactory('audio-item');
sound.className = 'audio-item'; progress = document.getElementById(
sound.setAttribute('data-source', f.target.result); 'pgs' + item.getAttribute('id')
sound.setAttribute('id', fileCount); );
remove.setAttribute('id', fileCount); self.mm
sound.setAttribute('data-file-name', theFile.name); .filesUpload(theFile.type, upload, progress)
sound.appendChild(remove); .then(result => {
self.fileList.appendChild(sound); item.setAttribute('data-source', result.filePath);
let audio = document.createElement('audio');
audio.setAttribute('controls', true);
let source = document.createElement('source');
source.src = f.target.result;
audio.appendChild(source);
item.appendChild(audio);
anime({
targets: progress,
width: 0,
easing: 'easeInOutQuint',
duration: 1000,
complete: () => {
item.removeChild(progress);
item.appendChild(remove);
}
});
});
break; break;
case 'application/pdf': case 'application/pdf':
case 'text/plain': case 'text/plain':
case 'text/rtf': case 'text/rtf':
var file = document.createElement('div'); item = self.itemFactory('file-item');
file.className = 'file-item'; progress = document.getElementById(
file.setAttribute('data-source', f.target.result); 'pgs' + item.getAttribute('id')
file.setAttribute('id', fileCount); );
remove.setAttribute('id', fileCount); self.mm
file.setAttribute('data-file-name', theFile.name); .filesUpload(theFile.type, upload, progress)
file.appendChild(remove); .then(result => {
self.fileList.appendChild(file); item.setAttribute('data-source', result.filePath);
let link = document.createElement('a');
link.href = result.filePath;
link.innerHTML = result.fileName;
item.appendChild(link);
anime({
targets: progress,
width: 0,
easing: 'easeInOutQuint',
duration: 1000,
complete: () => {
item.removeChild(progress);
item.appendChild(remove);
}
});
});
break; break;
} }
}; };
@ -172,43 +220,34 @@ export default class FileManager {
// Read in the image file as a data URL. // Read in the image file as a data URL.
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
//give the script a beat to add the child nodes, then update it all
setTimeout(() => {
self.updateFiles();
}, 50);
} }
itemFactory(type = null) {
//get counts for lists
var mediaCount = this.imageList.childNodes.length;
var fileCount = this.fileList.childNodes.length;
if (mediaCount < 0) mediaCount = 0;
if (fileCount < 0) fileCount = 0;
var item = document.createElement('div');
item.className = type;
var progress = document.createElement('div');
progress.className = 'item-progress';
item.appendChild(progress);
//-------------------------- if (type == 'img-item' || type == 'video-item') {
// event handlers this.imageList.appendChild(item);
//-------------------------- progress.setAttribute('id', 'pgs' + mediaCount);
updateFiles() { item.setAttribute('id', mediaCount);
let currentFiles = []; //store current list } else {
let items = []; this.fileList.appendChild(item);
//get files from media and files list progress.setAttribute('id', 'pgs' + fileCount);
for (let index = 0; index < this.imageList.childNodes.length; index++) { item.setAttribute('id', fileCount);
items.push(this.imageList.childNodes[index]);
} }
return item;
for (let index = 0; index < this.fileList.childNodes.length; index++) {
items.push(this.fileList.childNodes[index]);
}
for (let index = 0; index < items.length; index++) {
var item = items[index];
let url = '';
if (item.className == 'img-item') {
url = item.style.backgroundImage.slice(4, -1).replace(/"/g, '');
} else {
url = item.getAttribute('data-source');
}
currentFiles.push({
earl: url,
fileName: item.getAttribute('data-file-name')
});
}
this.reindexFiles(currentFiles, 0);
} }
//--------------------------
// event handlers
//--------------------------
removeFile(e) { removeFile(e) {
var list = []; var list = [];
switch (e.target.parentNode.className) { switch (e.target.parentNode.className) {
@ -227,7 +266,7 @@ export default class FileManager {
if (media.id == e.target.id) { if (media.id == e.target.id) {
list.removeChild(media); list.removeChild(media);
notify.alert('REINDEXING MEDIA', null); notify.alert('REINDEXING MEDIA', null);
this.updateFiles(); //this.updateFiles();
} }
} }
} }

@ -1,12 +1,13 @@
import anime from 'animejs/lib/anime.es.js'; import anime from 'animejs/lib/anime.es.js';
const notifcation = document.getElementById('notifications'); const notifcation = document.querySelector('[role="notify-message"]');
const notify = document.getElementById('notify-message'); const notify = document.getElementById('notify-message');
const messageText = document.getElementById('message-text'); const responseText = document.querySelector('[role="response-text"]');
const notifyText = document.getElementById('notify-text'); const notifyText = document.querySelector('[role="notify-text"]');
const notifyProgress = document.getElementById('notify-progress'); const notifyIcons = document.querySelector('[role="notify-icons"]');
const iconGood = document.getElementById('notify-good'); //const notifyProgress = document.getElementById('notify-progress');
const iconLame = document.getElementById('notify-lame'); const iconGood = document.querySelector('[role="notify-good"]');
const iconWorking = document.getElementById('notify-working'); const iconNotGood = document.querySelector('[role="notify-notgood"]');
const iconWorking = document.querySelector('[role="notify-working"]');
export default class Notfications { export default class Notfications {
//-------------------------- //--------------------------
@ -20,16 +21,10 @@ export default class Notfications {
alert(text, status) { alert(text, status) {
iconWorking.style.display = 'none'; iconWorking.style.display = 'none';
iconGood.style.display = 'none'; iconGood.style.display = 'none';
iconLame.style.display = 'none'; iconNotGood.style.display = 'none';
var color = ''; var color = '';
if (status !== null) { if (status !== null) {
anime({
targets: notifyProgress,
opacity: 0,
easing: 'easeInOutQuint',
duration: 500
});
if (status) { if (status) {
color = '#32cd32'; color = '#32cd32';
iconWorking.style.display = 'none'; iconWorking.style.display = 'none';
@ -37,60 +32,46 @@ export default class Notfications {
} else { } else {
color = '#F64747'; color = '#F64747';
iconWorking.style.display = 'none'; iconWorking.style.display = 'none';
iconLame.style.display = 'block'; iconNotGood.style.display = 'block';
} }
} else { } else {
color = '#200317'; color = '#200317';
iconWorking.style.display = 'block'; iconWorking.style.display = 'block';
anime({
targets: notifyProgress,
opacity: 1,
easing: 'easeInOutQuint',
duration: 500
});
} }
messageText.innerHTML = text; responseText.innerHTML = text;
anime({ anime({
targets: notifcation, targets: notifyIcons,
marginTop: '-10', width: 39,
easing: 'easeInOutQuint', opacity: 1,
duration: 10, easing: 'easeInQuint',
duration: 300
});
anime({
targets: notifyText,
backgroundColor: color,
opacity: 1,
easing: 'easeInOutQuad',
duration: 400,
complete: () => { complete: () => {
anime({ setTimeout(() => {
targets: notify, anime({
rotateX: '0', targets: notifyText,
easing: 'easeInOutQuint', backgroundColor: color,
duration: 700 opacity: 0,
}); easing: 'easeInOutQuad',
anime({ duration: 400
targets: notifyText, });
backgroundColor: color,
easing: 'easeInOutQuint', anime({
duration: 700, targets: notifyIcons,
complete: () => { width: 0,
setTimeout(() => { opacity: 0,
if (status !== null) { easing: 'easeOutQuint',
anime({ duration: 350
targets: notify, });
rotateX: '-120', }, 2000);
easing: 'easeInOutQuint',
duration: 700,
complete: () => {
anime({
targets: notifcation,
marginTop: '-55',
easing: 'easeInOutQuint',
delay: 700,
duration: 50
});
//notifcation.style.display = 'none';
}
});
}
}, 1000);
}
});
} }
}); });
} }

@ -1,194 +1,194 @@
import * as DataEvent from "../events/DataEvent"; import * as DataEvent from '../events/DataEvent';
import { position } from "caret-pos"; import { position } from 'caret-pos';
import EventEmitter from "../events/EventEmitter"; import EventEmitter from '../events/EventEmitter';
import * as EditorEvent from "../events/EditorEvent"; import * as EditorEvent from '../events/EditorEvent';
import Prism from "prismjs"; import Prism from 'prismjs';
class TextEditor extends EventEmitter { class TextEditor extends EventEmitter {
/** /**
* Text Editor UI Component * Text Editor UI Component
* @constructor * @constructor
* @param {object} textEditor - Text area that will edit text * @param {object} textEditor - Text area that will edit text
* @param {number} scrollLimit - YPos where editor position will become fixed * @param {number} scrollLimit - YPos where editor position will become fixed
*/ */
//-------------------------- //--------------------------
// constructor // constructor
//-------------------------- //--------------------------
constructor(textEditor, scrollLimit) { constructor(textEditor, scrollLimit) {
super(); super();
document.getElementById("edit").addEventListener("input", (e) => { document.getElementById('edit').addEventListener('input', e => {
let result_element = document.querySelector("#highlight-content"); let result_element = document.querySelector('#highlight-content');
this.textEditor = textEditor; this.textEditor = textEditor;
// Update code // Update code
let text = e.target.value; let text = e.target.value;
result_element.innerHTML = text result_element.innerHTML = text
.replace(new RegExp("&", "g"), "&amp;") .replace(new RegExp('&', 'g'), '&amp;')
.replace(new RegExp("<", "g"), "&lt;"); .replace(new RegExp('<', 'g'), '&lt;');
let editorHeight = document.getElementById("highlight").offsetHeight; let editorHeight = document.getElementById('highlight').offsetHeight;
document.getElementById("edit-post-wrapper").style.height = document.querySelector('[role="edit-post-wrapper"]').style.height =
editorHeight + "px"; editorHeight + 'px';
e.target.style.height = editorHeight + 30 + "px"; //TODO: yeah, it's ugly but it works for now, fix soon e.target.style.height = editorHeight + 30 + 'px'; //TODO: yeah, it's ugly but it works for now, fix soon
// Syntax Highlight // Syntax Highlight
Prism.highlightElement(result_element); Prism.highlightElement(result_element);
}); });
document.getElementById("edit").addEventListener("scroll", (e) => { document.getElementById('edit').addEventListener('scroll', e => {
/* Scroll result to scroll coords of event - sync with textarea */ /* Scroll result to scroll coords of event - sync with textarea */
let result_element = document.querySelector("#highlight"); let result_element = document.querySelector('#highlight');
// Get and set x and y // Get and set x and y
result_element.scrollTop = e.scrollTop; result_element.scrollTop = e.scrollTop;
result_element.scrollLeft = e.scrollLeft; result_element.scrollLeft = e.scrollLeft;
}); });
document.getElementById("edit").dispatchEvent(new Event("input")); document.getElementById('edit').dispatchEvent(new Event('input'));
this.setInputs(); this.setInputs();
//freeze editor formatting so it doesn't scroll off screen //freeze editor formatting so it doesn't scroll off screen
window.addEventListener("scroll", () => { window.addEventListener('scroll', () => {
var fixLimit = scrollLimit; var fixLimit = scrollLimit;
if (window.pageYOffset + 5 >= fixLimit) { if (window.pageYOffset + 5 >= fixLimit) {
document.getElementById("edit-control").style.position = "fixed"; document.getElementById('edit-control').style.position = 'fixed';
} else { } else {
document.getElementById("edit-control").style.position = "relative"; document.getElementById('edit-control').style.position = 'relative';
} }
}); });
} }
//-------------------------- //--------------------------
// methods // methods
//-------------------------- //--------------------------
setInputs() { setInputs() {
var editorButtons = document.querySelectorAll(".editor-button"); var editorButtons = document.querySelectorAll('.editor-button');
for (var i = 0, length = editorButtons.length; i < length; i++) { for (var i = 0, length = editorButtons.length; i < length; i++) {
editorButtons[i].addEventListener( editorButtons[i].addEventListener(
"click", 'click',
(e) => this.handleEditorOption(e), e => this.handleEditorOption(e),
false false
); );
} }
} }
notify(type, data) { notify(type, data) {
switch (type) { switch (type) {
case DataEvent.PAGE_UPDATED: case DataEvent.PAGE_UPDATED:
document.getElementById("submit-update").classList.add("icon-hide"); document.getElementById('submit-update').classList.add('icon-hide');
document.getElementById("submit-good").classList.remove("icon-hide"); document.getElementById('submit-good').classList.remove('icon-hide');
document.getElementById("edit-update").classList.remove("submit-start"); document.getElementById('edit-update').classList.remove('submit-start');
document.getElementById("edit-update").classList.add("submit-cool"); document.getElementById('edit-update').classList.add('submit-cool');
setTimeout(() => { setTimeout(() => {
document document
.getElementById("submit-update") .getElementById('submit-update')
.classList.remove("icon-hide"); .classList.remove('icon-hide');
document.getElementById("submit-good").classList.add("icon-hide"); document.getElementById('submit-good').classList.add('icon-hide');
document.getElementById("edit-update").classList.add("submit-start"); document.getElementById('edit-update').classList.add('submit-start');
document document
.getElementById("edit-update") .getElementById('edit-update')
.classList.remove("submit-cool"); .classList.remove('submit-cool');
}, 2000); }, 2000);
break; break;
case DataEvent.PAGE_ADDED: case DataEvent.PAGE_ADDED:
// do nothing // do nothing
break; break;
case EditorEvent.EDITOR_UPLOAD_POST_IMAGE: { case EditorEvent.EDITOR_UPLOAD_POST_IMAGE: {
let len = this.textEditor.value.length; let len = this.textEditor.value.length;
let start = this.textEditor.selectionStart; let start = this.textEditor.selectionStart;
let end = this.textEditor.selectionEnd; let end = this.textEditor.selectionEnd;
let insert = "![image alt text](" + data + ")"; let insert = '![image alt text](' + data + ')';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
document.getElementById("edit").dispatchEvent(new Event("input")); document.getElementById('edit').dispatchEvent(new Event('input'));
break; break;
} }
} }
} }
//-------------------------- //--------------------------
// event handlers // event handlers
//-------------------------- //--------------------------
handleEditorOption(e) { handleEditorOption(e) {
e.preventDefault(); e.preventDefault();
let len = this.textEditor.value.length; let len = this.textEditor.value.length;
let start = this.textEditor.selectionStart; let start = this.textEditor.selectionStart;
let end = this.textEditor.selectionEnd; let end = this.textEditor.selectionEnd;
let selectedText = this.textEditor.value.substring(start, end); let selectedText = this.textEditor.value.substring(start, end);
let insert = ""; let insert = '';
switch (e.target.id) { switch (e.target.id) {
case "edit-bold": case 'edit-bold':
insert = "**" + selectedText + "**"; insert = '**' + selectedText + '**';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
break; break;
case "edit-italic": case 'edit-italic':
insert = "*" + selectedText + "*"; insert = '*' + selectedText + '*';
//console.log(this.textEditor); //console.log(this.textEditor);
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
break; break;
case "edit-strikethrough": case 'edit-strikethrough':
insert = "~~" + selectedText + "~~"; insert = '~~' + selectedText + '~~';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
break; break;
case "edit-header1": case 'edit-header1':
insert = "# " + selectedText + "\n"; insert = '# ' + selectedText + '\n';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
break; break;
case "edit-header2": case 'edit-header2':
insert = "## " + selectedText + "\n"; insert = '## ' + selectedText + '\n';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
break; break;
case "edit-header3": case 'edit-header3':
insert = "### " + selectedText + "\n"; insert = '### ' + selectedText + '\n';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
break; break;
case "edit-link": case 'edit-link':
{ {
let url = prompt("Let's get that url, boss"); let url = prompt("Let's get that url, boss");
let link = url.toLowerCase(); let link = url.toLowerCase();
insert = "[" + selectedText + "](" + link + ")"; insert = '[' + selectedText + '](' + link + ')';
this.textEditor.value = this.textEditor.value =
this.textEditor.value.substring(0, start) + this.textEditor.value.substring(0, start) +
insert + insert +
this.textEditor.value.substring(end, len); this.textEditor.value.substring(end, len);
} }
break; break;
case "edit-image": case 'edit-image':
this.caretPos = position(this.textEditor).pos; this.caretPos = position(this.textEditor).pos;
this.emitEvent(EditorEvent.EDITOR_UPLOAD_POST_IMAGE); this.emitEvent(EditorEvent.EDITOR_UPLOAD_POST_IMAGE);
break; break;
case "submit-save": case 'submit-save':
case "edit-save": case 'edit-save':
this.emitEvent(EditorEvent.EDITOR_SAVE); this.emitEvent(EditorEvent.EDITOR_SAVE);
break; break;
case "submit-update": case 'submit-update':
case "edit-update": case 'edit-update':
this.emitEvent(EditorEvent.EDITOR_UPDATE); this.emitEvent(EditorEvent.EDITOR_UPDATE);
break; break;
case "edit-delete": case 'edit-delete':
this.emitEvent(EditorEvent.EDITOR_DELETE); this.emitEvent(EditorEvent.EDITOR_DELETE);
break; break;
default: default:
//do stuff //do stuff
break; break;
} }
document.getElementById("edit").dispatchEvent(new Event("input")); document.getElementById('edit').dispatchEvent(new Event('input'));
} }
} }
export default TextEditor; export default TextEditor;

@ -25,7 +25,9 @@ export default class DataUtils {
// If it fails, reject the promise with a error message // If it fails, reject the promise with a error message
reject( reject(
new Error( new Error(
"Image didn't load successfully; error code:" + "Image didn't load successfully; error code: " +
request.status +
' ' +
request.statusText request.statusText
) )
); );

@ -1,70 +1,70 @@
//** REQUEST TYPES **// //** REQUEST TYPES **//
export const REQUEST_TYPE_POST = "POST"; export const REQUEST_TYPE_POST = 'POST';
export const REQUEST_TYPE_GET = "GET"; export const REQUEST_TYPE_GET = 'GET';
export const REQUEST_TYPE_PUT = "PUT"; export const REQUEST_TYPE_PUT = 'PUT';
export const REQUEST_TYPE_DELETE = "DELETE"; export const REQUEST_TYPE_DELETE = 'DELETE';
//** POST CONTENT TYPES **// //** POST CONTENT TYPES **//
export const CONTENT_TYPE_JSON = "json"; export const CONTENT_TYPE_JSON = 'json';
export const CONTENT_TYPE_FORM = "x-www-form-urlencoded"; export const CONTENT_TYPE_FORM = 'x-www-form-urlencoded';
//** API URLS **// //** API URLS **//
export const API_STATUS = "/api/v1/status"; export const API_STATUS = '/api/v1/status';
export const API_GET_SETTINGS = "/api/v1/settings/site"; export const API_GET_SETTINGS = '/api/v1/settings/site';
export const API_GET_MEMBER_INFO = "/api/v1/settings/member"; export const API_GET_MEMBER_INFO = '/api/v1/settings/member';
export const API_NEW_PAGE = "/api/v1/page/create"; export const API_NEW_PAGE = '/api/v1/page/create';
export const API_EDIT_PAGE = "/api/v1/page/write"; export const API_EDIT_PAGE = '/api/v1/page/write';
export const API_DELETE_PAGE = "/api/v1/page/delete"; export const API_DELETE_PAGE = '/api/v1/page/delete';
export const API_SETTINGS_SYNC = "/api/v1/settings/sync"; export const API_SETTINGS_SYNC = '/api/v1/settings/sync';
export const API_PUBLISH_PAGES = "/api/v1/settings/publish"; export const API_PUBLISH_PAGES = '/api/v1/settings/publish';
export const API_NAV_SYNC = "/api/v1/settings/nav-sync"; export const API_NAV_SYNC = '/api/v1/settings/nav-sync';
export const API_REINDEX_PAGES = "/api/v1/settings/reindex"; export const API_REINDEX_PAGES = '/api/v1/settings/reindex';
export const API_SEND_MAIL = "/api/v1/mailer"; export const API_SEND_MAIL = '/api/v1/mailer';
export const API_LOGIN = "/api/v1/login"; export const API_LOGIN = '/api/v1/login';
//** API TASKS **// //** API TASKS **//
export const AUTH_STATUS = "getAuthStatus"; export const AUTH_STATUS = 'getAuthStatus';
export const TASK_SETTINGS_WRITE = "writeSettings"; export const TASK_SETTINGS_WRITE = 'writeSettings';
export const TASK_PUBLISH_SITE = "publishSite"; export const TASK_PUBLISH_SITE = 'publishSite';
export const TASK_PAGE_CREATE = "createNewPage"; export const TASK_PAGE_CREATE = 'createNewPage';
export const TASK_PAGE_EDIT = "editPage"; export const TASK_PAGE_EDIT = 'editPage';
export const TASK_PAGE_DELETE = "deletePage"; export const TASK_PAGE_DELETE = 'deletePage';
export const TASK_SEND_MAIL = "sendMail"; export const TASK_SEND_MAIL = 'sendMail';
export const TASK_REINDEX_PAGE = "reIndexPages"; export const TASK_REINDEX_PAGE = 'reIndexPages';
export const TASK_SYNC_SETTNIGS = "syncSite"; export const TASK_SYNC_SETTNIGS = 'syncSite';
export const TASK_SYNC_NAV = "syncNav"; export const TASK_SYNC_NAV = 'syncNav';
export const TASK_GET_SETTINGS = "getSiteSettings"; export const TASK_GET_SETTINGS = 'getSiteSettings';
export const TASK_GET_MEMBER_INFO = "getMemberInfo"; export const TASK_GET_MEMBER_INFO = 'getMemberInfo';
//** API STATUS **// //** API STATUS **//
export const API_ACCESS_GOOD = "apiUseAuthorized"; export const API_ACCESS_GOOD = 'apiUseAuthorized';
export const API_ACCESS_BAD = "apiUseNotAuthorized"; export const API_ACCESS_BAD = 'apiUseNotAuthorized';
/** /**
* A can of methods used to edit install settings, navigation pages and content pages * A can of methods used to edit install settings, navigation pages and content pages
*/ */
class FipamoAdminAPI { class FipamoAdminAPI {
/** /**
* @constructor * @constructor
* @param {string} baseURL - url of site; uses local when empty * @param {string} baseURL - url of site; uses local when empty
* @param {object} progressBar - element to be used to display upload progress * @param {object} progressBar - element to be used to display upload progress
*/ */
constructor(baseURL = null, progressBar = null) { constructor(baseURL = null, progressBar = null) {
this.percentComplete = 0; //for later this.percentComplete = 0; //for later
this.baseURL = null; this.baseURL = null;
this.progressBar = progressBar; this.progressBar = progressBar;
this.status = false; this.status = false;
if (baseURL) this.baseURL = baseURL; if (baseURL) this.baseURL = baseURL;
//asks server if a session is active //asks server if a session is active
this._request(this.baseURL ? this.baseURL + API_STATUS : API_STATUS).then( this._request(this.baseURL ? this.baseURL + API_STATUS : API_STATUS).then(
(response) => { response => {
if (response.type === API_ACCESS_GOOD) { if (response.type === API_ACCESS_GOOD) {
this.token = response.token; this.token = response.token;
} else { } else {
//don't set token //don't set token
//console.log("NO TOKEN"); //console.log("NO TOKEN");
} }
} }
); );
} }
/** /**
* Promise method for authenticating and starting a session\ * Promise method for authenticating and starting a session\
* **POST**`/api/v1/login` * **POST**`/api/v1/login`
* @param {Object[]} data - json object that contains data for set up * @param {Object[]} data - json object that contains data for set up
@ -82,26 +82,26 @@ class FipamoAdminAPI {
} }
``` ```
*/ */
login(data) { login(data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.baseURL ? (data.remote = true) : (data.remote = false); this.baseURL ? (data.remote = true) : (data.remote = false);
this.key ? (data.key = this.key) : (data.key = null); this.key ? (data.key = this.key) : (data.key = null);
this._request( this._request(
this.baseURL ? this.baseURL + API_LOGIN : API_LOGIN, this.baseURL ? this.baseURL + API_LOGIN : API_LOGIN,
AUTH_STATUS, AUTH_STATUS,
REQUEST_TYPE_POST, REQUEST_TYPE_POST,
CONTENT_TYPE_JSON, CONTENT_TYPE_JSON,
data data
) )
.then((result) => { .then(result => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch(err => {
reject(err); reject(err);
}); });
}); });
} }
/** /**
* Method for saving site and navigation settings\ * Method for saving site and navigation settings\
* **POST**`/api/v1/settings/:task` * **POST**`/api/v1/settings/:task`
* @param {string} task - settings being synced `config | navigation` * @param {string} task - settings being synced `config | navigation`
@ -140,34 +140,34 @@ class FipamoAdminAPI {
} }
``` ```
*/ */
sync(task, data) { sync(task, data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let url = ""; let url = '';
switch (task) { switch (task) {
case "syncSite": case 'syncSite':
url = API_SETTINGS_SYNC; url = API_SETTINGS_SYNC;
break; break;
case "syncNav": case 'syncNav':
url = API_NAV_SYNC; url = API_NAV_SYNC;
break; break;
} }
this._request( this._request(
this.baseURL ? this.baseURL + url : url, this.baseURL ? this.baseURL + url : url,
TASK_SETTINGS_WRITE, TASK_SETTINGS_WRITE,
REQUEST_TYPE_POST, REQUEST_TYPE_POST,
CONTENT_TYPE_JSON, CONTENT_TYPE_JSON,
data data
) )
.then((result) => { .then(result => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch(err => {
reject(err); reject(err);
}); });
}); });
} }
/** /**
* Method for retrieving user authorizing user login * Method for retrieving user authorizing user login
* @param {object[]} data - json object that contains task * @param {object[]} data - json object that contains task
* @param {string} data[].task - publishing task * @param {string} data[].task - publishing task
@ -183,26 +183,26 @@ class FipamoAdminAPI {
} }
* ``` * ```
*/ */
publish(data) { publish(data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this._request( this._request(
//API_PUBLISH_PAGES, //API_PUBLISH_PAGES,
this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES, this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES,
TASK_PUBLISH_SITE, TASK_PUBLISH_SITE,
REQUEST_TYPE_POST, REQUEST_TYPE_POST,
CONTENT_TYPE_JSON, CONTENT_TYPE_JSON,
data data
) )
.then((result) => { .then(result => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch(err => {
reject(err); reject(err);
}); });
}); });
} }
/** /**
* Method for handling page creating and editing\ * Method for handling page creating and editing\
* **POST**`/api/v1/page/:task` * **POST**`/api/v1/page/:task`
* @param {string} task - current page action * @param {string} task - current page action
@ -233,55 +233,55 @@ class FipamoAdminAPI {
} }
``` ```
*/ */
pageActions(task, data) { pageActions(task, data) {
let url, event, content; let url, event, content;
switch (task) { switch (task) {
case TASK_PAGE_CREATE: case TASK_PAGE_CREATE:
url = API_NEW_PAGE; url = API_NEW_PAGE;
event = TASK_PAGE_CREATE; event = TASK_PAGE_CREATE;
content = CONTENT_TYPE_FORM; content = CONTENT_TYPE_JSON;
break; break;
case TASK_PAGE_EDIT: case TASK_PAGE_EDIT:
url = API_EDIT_PAGE; url = API_EDIT_PAGE;
event = TASK_PAGE_EDIT; event = TASK_PAGE_EDIT;
content = CONTENT_TYPE_FORM; content = CONTENT_TYPE_JSON;
break; break;
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_FORM; content = CONTENT_TYPE_JSON;
break; break;
default: default:
break; break;
} }
if (this.baseURL) { if (this.baseURL) {
//data.key = this.key; //data.key = this.key;
data.remote = true; data.remote = true;
} else { } else {
data.remote = false; data.remote = false;
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this._request( this._request(
this.baseURL ? this.baseURL + url : url, this.baseURL ? this.baseURL + url : url,
event, event,
REQUEST_TYPE_POST, REQUEST_TYPE_POST,
content, content,
data data
) )
.then((result) => { .then(result => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch(err => {
reject(err); reject(err);
}); });
}); });
} }
/** /**
* Method for sending mail (if completed in settings)\ * Method for sending mail (if completed in settings)\
* **POST**`/api/v1/mailer` * **POST**`/api/v1/mailer`
* @param {object[]} message - json object that contains items to be included in main site navigation * @param {object[]} message - json object that contains items to be included in main site navigation
@ -298,25 +298,25 @@ class FipamoAdminAPI {
} }
``` ```
*/ */
sendMail(message) { sendMail(message) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this._request( this._request(
this.baseURL ? this.baseURL + API_SEND_MAIL : API_SEND_MAIL, this.baseURL ? this.baseURL + API_SEND_MAIL : API_SEND_MAIL,
TASK_SEND_MAIL, TASK_SEND_MAIL,
REQUEST_TYPE_POST, REQUEST_TYPE_POST,
CONTENT_TYPE_JSON, CONTENT_TYPE_JSON,
message message
) )
.then((result) => { .then(result => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch(err => {
reject(err); reject(err);
}); });
}); });
} }
/** /**
* *Promise method for retrieving site and member info*\ * *Promise method for retrieving site and member info*\
* **GET** `/api/v1/settings/:type` * **GET** `/api/v1/settings/:type`
* @param {string} type - type of info requested ['site'|'member']; * @param {string} type - type of info requested ['site'|'member'];
@ -336,97 +336,97 @@ class FipamoAdminAPI {
* ``` * ```
*/ */
getInfo(type) { getInfo(type) {
let url, task; let url, task;
if (type == "site") { if (type == 'site') {
url = API_GET_SETTINGS; url = API_GET_SETTINGS;
task = TASK_GET_SETTINGS; task = TASK_GET_SETTINGS;
} else { } else {
url = API_GET_MEMBER_INFO; url = API_GET_MEMBER_INFO;
task = TASK_GET_MEMBER_INFO; task = TASK_GET_MEMBER_INFO;
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this._request(this.baseURL ? this.baseURL + url : url, task) this._request(this.baseURL ? this.baseURL + url : url, task)
.then((result) => { .then(result => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch(err => {
reject(err); reject(err);
}); });
}); });
} }
//-------------------------- //--------------------------
// private // private
//-------------------------- //--------------------------
_request( _request(
requestURL, requestURL,
eventType, eventType,
requestType = REQUEST_TYPE_GET, requestType = REQUEST_TYPE_GET,
contentType = CONTENT_TYPE_JSON, contentType = CONTENT_TYPE_JSON,
requestData = null requestData = null
) { ) {
var self = this; var self = this;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.upload.addEventListener("progress", (e) => request.upload.addEventListener('progress', e =>
self.handleLoadProgress(e, self.progressBar) self.handleLoadProgress(e, self.progressBar)
); );
request.open(requestType, requestURL, true); request.open(requestType, requestURL, true);
request.onload = () => { request.onload = () => {
if (request.status == 200) { if (request.status == 200) {
let response = JSON.parse(request["response"]); let response = JSON.parse(request['response']);
resolve(response); resolve(response);
} else { } else {
let error = JSON.parse(request["response"]); let error = JSON.parse(request['response']);
reject(error); reject(error);
} }
}; };
if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) { if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) {
if ( if (
eventType === TASK_SETTINGS_WRITE || eventType === TASK_SETTINGS_WRITE ||
eventType === TASK_PAGE_EDIT || eventType === TASK_PAGE_EDIT ||
eventType === TASK_PAGE_CREATE || eventType === TASK_PAGE_CREATE ||
eventType === TASK_PAGE_DELETE || eventType === TASK_PAGE_DELETE ||
eventType === TASK_PUBLISH_SITE || eventType === TASK_PUBLISH_SITE ||
eventType === TASK_REINDEX_PAGE eventType === TASK_REINDEX_PAGE
) )
request.setRequestHeader("fipamo-access-token", self.token); request.setRequestHeader('fipamo-access-token', self.token);
switch (contentType) { switch (contentType) {
case CONTENT_TYPE_JSON: case CONTENT_TYPE_JSON:
request.setRequestHeader( request.setRequestHeader(
"Content-type", 'Content-type',
"application/" + contentType 'application/' + contentType
); );
request.send(JSON.stringify(requestData)); request.send(JSON.stringify(requestData));
break; break;
case CONTENT_TYPE_FORM: case CONTENT_TYPE_FORM:
request.send(requestData); request.send(requestData);
break; break;
} }
} else { } else {
if ( if (
eventType === TASK_GET_SETTINGS || eventType === TASK_GET_SETTINGS ||
eventType === TASK_GET_MEMBER_INFO eventType === TASK_GET_MEMBER_INFO
) { ) {
request.setRequestHeader("fipamo-access-token", self.token); request.setRequestHeader('fipamo-access-token', self.token);
} }
request.send(); request.send();
} }
}); });
} }
//-------------------------- //--------------------------
// event handlers // event handlers
//-------------------------- //--------------------------
handleLoadProgress(e, progressBar) { handleLoadProgress(e, progressBar) {
let percent = Math.ceil((e.loaded / e.total) * 100); let percent = Math.ceil((e.loaded / e.total) * 100);
//if a progress bar element is present, talk to it //if a progress bar element is present, talk to it
if (progressBar != null) { if (progressBar != null) {
progressBar.style.width = percent + "%"; progressBar.style.width = percent + '%';
} }
} }
} }
export { FipamoAdminAPI as default }; export { FipamoAdminAPI as default };

Loading…
Cancel
Save