Dashboard improves

This commit is contained in:
Diego Najar 2018-06-03 21:51:47 +02:00
parent 6984170dce
commit 2b050abaea
13 changed files with 182 additions and 39 deletions

View File

@ -3,6 +3,81 @@ html {
font-size: 0.9em; font-size: 0.9em;
} }
/*
BOOTSTRAP Hacks
*/
@media (min-width: 1200px) {
.container {
max-width: 1250px;
}
}
a {
color: #4a90e2;
}
a:hover {
color: #4a90e2;
}
.btn {
border-radius: 2px;
}
.btn-primary {
background-color: #4F93E0;
border-color: #4a90e2;
}
.btn-primary:hover {
background-color: #4585CF;
border-color: #4a90e2;
}
/*
DASHBOARD
*/
#dashboard ul.list-group.list-group-striped li {
border: none;
}
#dashboard ul.list-group.list-group-striped li:nth-of-type(even) {
background: #f1f1f1;
}
#dashboard div.quick-links-icons {
font-size: 3em;
width: 100%;
}
#dashboard a.quick-links {
color: #777;
}
#dashboard a.quick-links:hover {
text-decoration: none;
color: #4586d4;
}
.ct-series-a .ct-line {
/* Set the colour of this series line */
stroke: #4a90e2;
/* Control the thikness of your lines */
stroke-width: 2px;
/* Create a dashed line with a pattern */
}
/* This selector overrides the points style on line charts. Points on line charts are actually just very short strokes. This allows you to customize even the point size in CSS */
.ct-series-a .ct-point {
/* Colour of your points */
stroke: #4a90e2;
/* Size of your points */
stroke-width: 8px;
}
/* /*
ALERT ALERT
*/ */

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,10 @@
<!-- Use .flex-column to set a vertical direction --> <!-- Use .flex-column to set a vertical direction -->
<ul class="nav flex-column pt-4"> <ul class="nav flex-column pt-4">
<li class="nav-item mb-4">
<img src="<?php echo HTML_PATH_ADMIN_THEME ?>img/logo.svg" width="20" height="20" alt=""> BLUDIT
</li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="oi oi-dashboard"></span><?php $L->p('Dashboard') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="oi oi-dashboard"></span><?php $L->p('Dashboard') ?></a>
</li> </li>

View File

@ -50,7 +50,7 @@
<?php include('html/alert.php'); ?> <?php include('html/alert.php'); ?>
<!-- TOPBAR --> <!-- TOPBAR -->
<?php include('html/topbar.php'); ?> <?php #include('html/topbar.php'); ?>
<div class="container"> <div class="container">
<!-- 25%/75% split on large devices, small, medium devices hide --> <!-- 25%/75% split on large devices, small, medium devices hide -->

View File

@ -1,12 +1,61 @@
<div class="container"> <div id="dashboard" class="container mt-3">
<div class="row"> <div class="row">
<div class="col-7"> <div class="col-7">
1 of 2
<!-- Quick Links -->
<div class="container border-bottom pb-4">
<h4 class="pb-3">Quick links</h4>
<div class="row">
<div class="col">
<a class="quick-links text-center" style="color: #4586d4" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>">
<div class="oi oi-justify-left quick-links-icons"></div>
<div>New content</div>
</a>
</div>
<div class="col border-left border-right">
<a class="quick-links text-center" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>">
<div class="oi oi-tags quick-links-icons"></div>
<div>Categories</div>
</a>
</div>
<div class="col">
<a class="quick-links text-center" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>">
<div class="oi oi-people quick-links-icons"></div>
<div>Users</div>
</a>
</div>
</div>
</div>
<div class="container mt-4">
<div class="row">
<div class="col">
<a class="quick-links text-center" target="_blank" href="https://docs.bludit.com">
<div class="oi oi-compass quick-links-icons"></div>
<div>Documentation</div>
</a>
</div>
<div class="col border-left border-right">
<a class="quick-links text-center" target="_blank" href="https://forum.bludit.org">
<div class="oi oi-loop-square quick-links-icons"></div>
<div>Forum support</div>
</a>
</div>
<div class="col">
<a class="quick-links text-center" target="_blank" href="https://gitter.im/bludit/support">
<div class="oi oi-chat quick-links-icons"></div>
<div>Chat support</div>
</a>
</div>
</div>
</div>
<?php Theme::plugins('dashboard') ?>
</div> </div>
<div class="col-5"> <div class="col-5">
<!-- Notifications --> <!-- Notifications -->
<ul class="list-group"> <ul class="list-group list-group-striped b-0">
<li class="list-group-item pt-0"><h4>Notifications</h4></li>
<?php <?php
$logs = array_slice($Syslog->db, 0, NOTIFICATIONS_AMOUNT); $logs = array_slice($Syslog->db, 0, NOTIFICATIONS_AMOUNT);
foreach ($logs as $log) { foreach ($logs as $log) {
@ -16,10 +65,10 @@
if (!empty($log['notes'])) { if (!empty($log['notes'])) {
echo ' « <b>'.$log['notes'].'</b> »'; echo ' « <b>'.$log['notes'].'</b> »';
} }
echo '<br><span class="notification-date">'; echo '<br><span class="notification-date"><small>';
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT); echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
echo ' - by '.$log['username']; echo ' - by '.$log['username'];
echo '</span>'; echo '</small></span>';
echo '</li>'; echo '</li>';
} }
?> ?>

View File

@ -13,7 +13,7 @@
<?php <?php
echo Bootstrap::formOpen(array( echo Bootstrap::formOpen(array(
'id'=>'jsform', 'id'=>'jsform',
'class'=>'tab-content mt-4' 'class'=>'tab-content mt-1'
)); ));
// Token CSRF // Token CSRF
@ -56,18 +56,12 @@
<!-- TABS CONTENT --> <!-- TABS CONTENT -->
<div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab"> <div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab">
<?php <div class="form-group m-0">
// Title <input value="<?php echo $page->title() ?>" class="form-control form-control-lg rounded-0 " id="jstitle" name="title" placeholder="Enter title" type="text">
echo Bootstrap::formInputTextBlock(array( </div>
'name'=>'title',
'placeholder'=>'Enter title',
'class'=>'form-control-lg',
'value'=>$page->title()
));
?>
<div class="form-group mt-2"> <div class="form-group mt-1">
<div id="jscontent" name="content"><?php echo $page->contentRaw(true) ?></div> <div id="jscontent" name="content"><?php echo $page->contentRaw(false) ?></div>
</div> </div>
<div class="form-group mt-2"> <div class="form-group mt-2">
@ -246,9 +240,7 @@ $(document).ready(function() {
var ajax = new bluditAjax(); var ajax = new bluditAjax();
// showAlert is the function to display an alert defined in alert.php // showAlert is the function to display an alert defined in alert.php
ajax.autosave(uuid, title, content, showAlert); ajax.autosave(uuid, title, content, showAlert);
}, },1000*60*<?php echo $GLOBALS['AUTOSAVE_TIME'] ?>);
60*1000*<?php echo $GLOBALS['AUTOSAVE_TIME'] ?>
);
// Template autocomplete // Template autocomplete
$('input[name="template"]').autoComplete({ $('input[name="template"]').autoComplete({

View File

@ -1,7 +1,7 @@
<!-- TABS --> <!-- TABS -->
<ul class="nav nav-tabs" id="dynamicTab" role="tablist"> <ul class="nav nav-tabs" id="dynamicTab" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true">Content</a> <a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true">Editor</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false">Images</a> <a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false">Images</a>
@ -13,7 +13,7 @@
<?php <?php
echo Bootstrap::formOpen(array( echo Bootstrap::formOpen(array(
'id'=>'jsform', 'id'=>'jsform',
'class'=>'tab-content mt-4' 'class'=>'tab-content mt-1'
)); ));
// Token CSRF // Token CSRF
@ -50,22 +50,16 @@
<!-- TABS CONTENT --> <!-- TABS CONTENT -->
<div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab"> <div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab">
<?php <div class="form-group m-0">
// Title <input value="" class="form-control form-control-lg rounded-0 " id="jstitle" name="title" placeholder="Enter title" type="text">
echo Bootstrap::formInputTextBlock(array( </div>
'name'=>'title',
'placeholder'=>'Enter title',
'class'=>'form-control-lg',
'value'=>''
));
?>
<div class="form-group mt-2"> <div class="form-group mt-1">
<div id="jscontent" name="content"></div> <div id="jscontent" name="content"></div>
</div> </div>
<div class="form-group mt-2"> <div class="form-group mt-2">
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Save') ?></button> <button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn"><?php echo $L->g('Save as draft') ?></button> <button id="jsbuttonDraft" type="button" class="btn"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn"><?php echo $L->g('Cancel') ?></a> <a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn"><?php echo $L->g('Cancel') ?></a>
</div> </div>
@ -222,6 +216,7 @@ $(document).ready(function() {
}); });
// Autosave interval // Autosave interval
// Autosave works when the content of the page is bigger than 100 characters
setInterval(function() { setInterval(function() {
var uuid = $("#jsuuid").val(); var uuid = $("#jsuuid").val();
var title = $("#jstitle").val(); var title = $("#jstitle").val();
@ -229,9 +224,7 @@ $(document).ready(function() {
var ajax = new bluditAjax(); var ajax = new bluditAjax();
// showAlert is the function to display an alert defined in alert.php // showAlert is the function to display an alert defined in alert.php
ajax.autosave(uuid, title, content, showAlert); ajax.autosave(uuid, title, content, showAlert);
}, },1000*60*<?php echo $GLOBALS['AUTOSAVE_TIME'] ?>);
60*1000*<?php echo $GLOBALS['AUTOSAVE_TIME'] ?>
);
// Template autocomplete // Template autocomplete
$('input[name="template"]').autoComplete({ $('input[name="template"]').autoComplete({

View File

@ -22,6 +22,7 @@ $plugins = array(
'adminBodyEnd'=>array(), 'adminBodyEnd'=>array(),
'adminSidebar'=>array(), 'adminSidebar'=>array(),
'adminContentSidebar'=>array(), 'adminContentSidebar'=>array(),
'dashboard'=>array(),
'beforeRulesLoad'=>array(), 'beforeRulesLoad'=>array(),
'beforeAll'=>array(), 'beforeAll'=>array(),

View File

@ -36,6 +36,8 @@ class Date {
return self::translate($output); return self::translate($output);
} }
// Returns the current time shifted by offset
// $offest could be +1 day, +1 month
public static function currentOffset($format, $offset) public static function currentOffset($format, $offset)
{ {
$Date = new DateTime(); $Date = new DateTime();

View File

@ -48,4 +48,24 @@ class TCP {
return file_put_contents($destination, $data); return file_put_contents($destination, $data);
} }
public static function getIP()
{
if (getenv('HTTP_CLIENT_IP'))
$ip = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ip = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ip = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ip = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ip = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ip = getenv('REMOTE_ADDR');
else
return false;
return $ip;
}
} }

View File

@ -1,5 +1,7 @@
class bluditAjax { class bluditAjax {
// Autosave works only when the content has more than 100 characters
// callBack function need to be showAlert() is the function to display an alert defined in alert.php
autosave(uuid, title, content, callBack) { autosave(uuid, title, content, callBack) {
var ajaxRequest; var ajaxRequest;
if (ajaxRequest) { if (ajaxRequest) {

View File

@ -1,5 +1,8 @@
<script> <script>
// DEPRECATED
// ALL THIS FUNCTIONS IS DEPREACTED
var ajaxRequest; var ajaxRequest;
function autosave(title, content) { function autosave(title, content) {

View File

@ -1,5 +1,5 @@
.ql-container { .ql-container {
height: 360px; height: 480px;
font-size: 14px; font-size: 14px;
} }