remove cover image function, search plugin improvments, add search to theme alternative, tinymce css content

This commit is contained in:
Diego Najar 2018-10-03 00:19:19 +02:00
parent 8f2e1c5fa2
commit 8221fbb40b
11 changed files with 61 additions and 18 deletions

View File

@ -116,6 +116,9 @@
?>
<img id="jscoverImagePreview" style="width: 350px; height: 200px;" class="img-thumbnail" alt="coverImagePreview" src="<?php echo (empty($coverImage) ? HTML_PATH_ADMIN_THEME_IMG.'default.svg' : $page->coverImage() ) ?>" />
<div class="mt-2">
<button type="button" id="jsbuttonRemoveCoverImage" class="btn btn-primary btn-sm"><?php echo $L->g('Remove cover image') ?></button>
</div>
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('External Cover image')));
@ -406,6 +409,11 @@ $(document).ready(function() {
$("#jscoverImage").val( $(this).val() );
});
$("#jsbuttonRemoveCoverImage").on("click", function() {
$("#jscoverImage").val('');
$("#jscoverImagePreview").attr('src', HTML_PATH_ADMIN_THEME_IMG+'default.svg');
});
// Autosave interval
// Autosave works when the content of the page is bigger than 100 characters
setInterval(function() {

View File

@ -63,7 +63,7 @@
</div>
<div class="form-group m-0">
<button id="jsmediaManagerButton" type="button" class="mt-1 btn btn-form btn-sm d-block d-sm-inline d-sm-none" data-toggle="modal" data-target="#jsbluditMediaModal"><span class="oi oi-image"></span> <?php $L->p('Media Manager') ?></button>
<button id="jsmediaManagerButton" type="button" class="mt-1 btn btn-form btn-sm d-block d-sm-inline d-sm-none" data-toggle="modal" data-target="#jsbluditMediaModal"><span class="oi oi-image"></span> <?php $L->p('Images') ?></button>
<button id="jscategoryButton" type="button" class="mt-1 btn btn-form btn-sm" data-toggle="modal" data-target="#jscategoryModal"><span class="oi oi-tag"></span> <?php $L->p('Category') ?>: <span class="option">-</span></button>
<button id="jsdescriptionButton" type="button" class="mt-1 btn btn-form btn-sm" data-toggle="modal" data-target="#jsdescriptionModal"><span class="oi oi-tag"></span> <?php $L->p('Description') ?>: <span class="option">-</span></button>
</div>
@ -92,6 +92,9 @@
</div>
<img id="jscoverImagePreview" style="width: 350px; height: 200px;" class="img-thumbnail" alt="coverImagePreview" src="<?php echo HTML_PATH_ADMIN_THEME_IMG ?>default.svg" />
<div class="mt-2">
<button type="button" id="jsbuttonRemoveCoverImage" class="btn btn-primary btn-sm"><?php echo $L->g('Remove cover image') ?></button>
</div>
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('External Cover Image')));
@ -350,6 +353,11 @@ $(document).ready(function() {
$("#jscoverImage").val( $(this).val() );
});
$("#jsbuttonRemoveCoverImage").on("click", function() {
$("#jscoverImage").val('');
$("#jscoverImagePreview").attr('src', HTML_PATH_ADMIN_THEME_IMG+'default.svg');
});
// Generate slug when the user type the title
$("#jstitle").keyup(function() {
var text = $(this).val();

View File

@ -42,12 +42,17 @@ class Theme {
return false;
}
// Returns the absolute URL of the site
// Ex. https://example.com the method returns https://example.com/
// Ex. https://example.com/bludit/ the method returns https://example.com/bludit/
public static function siteUrl()
{
global $site;
return $site->url();
return DOMAIN_BASE;
}
// Returns the absolute URL of admin panel
// Ex. https://example.com/admin/ the method returns https://example.com/admin/
// Ex. https://example.com/bludit/admin/ the method returns https://example.com/bludit/admin/
public static function adminUrl()
{
return DOMAIN_ADMIN;
@ -180,7 +185,7 @@ class Theme {
$scripts = '';
foreach($files as $file) {
$scripts .= '<script charset="utf-8" src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
$scripts .= '<script src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
}
return $scripts;
@ -214,12 +219,12 @@ class Theme {
public static function jquery()
{
return '<script charset="utf-8" src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
return '<script src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
}
public static function jsBootstrap()
{
return '<script charset="utf-8" src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
return '<script src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
}
public static function cssBootstrap()
@ -230,7 +235,7 @@ class Theme {
public static function jsSortable()
{
// https://github.com/psfpro/bootstrap-html5sortable
return '<script charset="utf-8" src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
return '<script src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
}
}

View File

@ -3,6 +3,7 @@
echo 'var HTML_PATH_ROOT = "'.HTML_PATH_ROOT.'";'.PHP_EOL;
echo 'var HTML_PATH_ADMIN_ROOT = "'.HTML_PATH_ADMIN_ROOT.'";'.PHP_EOL;
echo 'var HTML_PATH_ADMIN_THEME = "'.HTML_PATH_ADMIN_THEME.'";'.PHP_EOL;
echo 'var HTML_PATH_ADMIN_THEME_IMG = "'.HTML_PATH_ADMIN_THEME_IMG.'";'.PHP_EOL;
echo 'var HTML_PATH_UPLOADS = "'.HTML_PATH_UPLOADS.'";'.PHP_EOL;
echo 'var HTML_PATH_UPLOADS_THUMBNAILS = "'.HTML_PATH_UPLOADS_THUMBNAILS.'";'.PHP_EOL;
echo 'var PARENT = "'.PARENT.'";'.PHP_EOL;

View File

@ -96,15 +96,13 @@ class Site extends dbJSON {
return false;
}
// Returns the URL of the rss.xml file
// You need to have enabled the plugin RSS
// DEPRECATED in v3.0, use Theme::rssUrl()
public function rss()
{
return DOMAIN_BASE.'rss.xml';
}
// Returns the URL of the sitemap.xml file
// You need to have enabled the plugin Sitemap
// DEPRECATED in v3.0, use Theme::sitemapUrl()
public function sitemap()
{
return DOMAIN_BASE.'sitemap.xml';

View File

@ -38,8 +38,8 @@ class pluginSearch extends Plugin {
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<div class="plugin-content">';
$html .= '<input type="text" id="plugin-search-input" /> ';
$html .= '<input type="button" value="Search" onClick="javascript: window.open(\'http://localhost:8000/search/\' + document.getElementById(\'plugin-search-input\').value, \'_self\');" />';
$html .= '</div>';
$html .= '<input type="button" value="Search" onClick="javascript: window.open(\''.DOMAIN_BASE.'search/\' + document.getElementById(\'plugin-search-input\').value, \'_self\');" />';
$html .= '</div>';
$html .= '</div>';
return $html;

View File

@ -1,5 +1,5 @@
body {
padding: 10px 10%;
padding: 10px 5%;
font-size: 16px;
}
@ -24,3 +24,10 @@ body {
.mce-content-body ul {
line-height: 1.5em;
}
.mce-content-body blockquote p {
padding: 10px 20px;
margin: 0 0 20px;
border-left: 5px solid #eee;
font-style: italic;
}

View File

@ -8,6 +8,20 @@
<?php if ($site->description()): ?>
<p class="lead"><?php echo $site->description(); ?></p>
<?php endif ?>
<!-- Custom search form if the plugin "search" is enabled -->
<?php if (pluginActivated('pluginSearch')): ?>
<div class="form-inline d-block">
<input id="search-input" class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-primary my-2 my-sm-0" type="button" onClick="searchNow()">Search</button>
<script>
function searchNow() {
var searchURL = "<?php echo Theme::siteUrl(); ?>search/";
window.open(searchURL + document.getElementById("search-input").value, "_self");
}
</script>
</div>
<?php endif ?>
</div>
</header>
@ -58,7 +72,7 @@
<!-- Home button -->
<?php if (Paginator::currentPage() > 1): ?>
<li class="page-item">
<a class="page-link" href="<?php echo $site->url() ?>">Home</a>
<a class="page-link" href="<?php echo Theme::siteUrl() ?>">Home</a>
</li>
<?php endif ?>

View File

@ -1,12 +1,13 @@
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark text-uppercase">
<div class="container">
<a class="navbar-brand" href="<?php echo $site->url(); ?>">
<a class="navbar-brand" href="<?php echo Theme::siteUrl(); ?>">
<span class="text-white"><?php echo $site->title(); ?></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<!-- Static pages -->
@ -42,6 +43,7 @@
<?php endforeach; ?>
</ul>
</div>
</div>
</nav>

View File

@ -51,7 +51,7 @@
<!-- Home button -->
<li class="page-item <?php if (Paginator::currentPage()==1) echo 'disabled' ?>">
<a class="page-link" href="<?php echo $site->url() ?>">Home</a>
<a class="page-link" href="<?php echo Theme::siteUrl() ?>">Home</a>
</li>
<!-- Next button -->

View File

@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark text-uppercase">
<div class="container">
<a class="navbar-brand" href="<?php echo $site->url() ?>">
<a class="navbar-brand" href="<?php echo Theme::siteUrl() ?>">
<span class="text-white"><?php echo $site->title() ?></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">