Bug fixes on UI
This commit is contained in:
parent
2eac988843
commit
6a0f32900b
5 changed files with 367 additions and 339 deletions
bl-kernel/admin/views
|
@ -80,6 +80,7 @@ function table($type)
|
|||
global $scheduled;
|
||||
global $static;
|
||||
global $sticky;
|
||||
global $unlisted;
|
||||
|
||||
if ($type == 'published') {
|
||||
$list = $published;
|
||||
|
@ -113,6 +114,14 @@ function table($type)
|
|||
echo '</p>';
|
||||
return false;
|
||||
}
|
||||
} elseif ($type == 'unlisted') {
|
||||
$list = $unlisted;
|
||||
if (empty($list)) {
|
||||
echo '<p class="text-muted p-4">';
|
||||
echo $L->g('There are no unlisted pages at this moment.');
|
||||
echo '</p>';
|
||||
return false;
|
||||
}
|
||||
} elseif ($type == 'sticky') {
|
||||
$list = $sticky;
|
||||
if (empty($list)) {
|
||||
|
@ -234,6 +243,9 @@ function table($type)
|
|||
} ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="unlisted-tab" data-bs-toggle="tab" href="#unlisted" role="tab" aria-controls="unlisted" aria-selected="true"><?php $L->p('Unlisted') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="draft-tab" data-bs-toggle="tab" href="#draft" role="tab" aria-controls="draft" aria-selected="true"><?php $L->p('Draft') ?></a>
|
||||
</li>
|
||||
|
@ -295,6 +307,11 @@ function table($type)
|
|||
<?php table('scheduled'); ?>
|
||||
</div>
|
||||
|
||||
<!-- TABS UNLISTED -->
|
||||
<div class="tab-pane" id="unlisted" role="tabpanel">
|
||||
<?php table('unlisted'); ?>
|
||||
</div>
|
||||
|
||||
<!-- TABS DRAFT -->
|
||||
<div class="tab-pane" id="draft" role="tabpanel">
|
||||
<?php table('draft'); ?>
|
||||
|
|
|
@ -134,8 +134,11 @@
|
|||
var args = {
|
||||
title: $('#title').val(),
|
||||
content: editorGetContent(),
|
||||
coverImage: $('#coverImage').val(),
|
||||
category: $('#category option:selected').val(),
|
||||
tags: $('#tags').val()
|
||||
tags: $("#tags option:selected").map(function() {
|
||||
return this.value
|
||||
}).get().join(",")
|
||||
}
|
||||
savePage(args);
|
||||
disableBtnSave();
|
||||
|
@ -177,6 +180,7 @@
|
|||
var args = {
|
||||
title: $('#title').val(),
|
||||
content: editorGetContent(),
|
||||
coverImage: $('#coverImage').val(),
|
||||
category: $('#category option:selected').val(),
|
||||
tags: $("#tags option:selected").map(function() {
|
||||
return this.value
|
||||
|
@ -288,7 +292,9 @@
|
|||
// ------------------------------------------------------------------------
|
||||
$('#btnSaveSeo').on('click', function() {
|
||||
var args = {
|
||||
parent: $('#parent').val()
|
||||
noindex: $('input[name="noindex"]').is(':checked'),
|
||||
nofollow: $('input[name="nofollow"]').is(':checked'),
|
||||
noarchive: $('input[name="noarchive"]').is(':checked')
|
||||
};
|
||||
savePage(args);
|
||||
disableBtnSave();
|
||||
|
@ -594,7 +600,8 @@
|
|||
<!-- Cover Image -->
|
||||
<h6 class="text-uppercase"><?php $L->p('Cover Image') ?></h6>
|
||||
<div>
|
||||
<img id="jscoverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo (($pageKey && $page->coverImage()) ? $page->coverImage() : HTML_PATH_CORE_IMG . 'default.svg') ?>" />
|
||||
<input id="coverImage" name="coverImage" data-save="true" type="hidden" value="<?php echo (($pageKey && $page->coverImage()) ? $page->coverImage(false) : '') ?>">
|
||||
<img id="coverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo (($pageKey && $page->coverImage()) ? $page->coverImage() : HTML_PATH_CORE_IMG . 'default.svg') ?>" />
|
||||
</div>
|
||||
<!-- End Cover Image -->
|
||||
|
||||
|
|
|
@ -94,6 +94,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
function setCoverImage(filename) {
|
||||
var image = DOMAIN_UPLOADS_PAGES+_pageKey+'/'+filename;
|
||||
$("#coverImage").val(filename);
|
||||
$("#coverImagePreview").attr("src", image);
|
||||
}
|
||||
|
||||
// Displays the files in the table
|
||||
function fmDisplayFiles(files) {
|
||||
$('#fmFiles').empty();
|
||||
|
@ -107,7 +113,7 @@
|
|||
console.log(file);
|
||||
var row = '<tr>' +
|
||||
'<td class="align-middle">' +
|
||||
' <img style="width: 32px" src="'+ file.thumbnailSmall +'" />' +
|
||||
' <img style="width: 32px" src="' + file.thumbnailSmall + '" />' +
|
||||
'</td>' +
|
||||
'<td class="align-middle">' + file.filename + '</td>' +
|
||||
'<td class="align-middle">' + file.mime + '</td>' +
|
||||
|
@ -115,9 +121,12 @@
|
|||
'<td class="align-middle text-center">' +
|
||||
'<div class="dropdown">' +
|
||||
' <button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="fileOptions" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-gear"></i>Options</button>' +
|
||||
' <ul class="dropdown-menu" aria-labelledby="fileOptions">' +
|
||||
' <li><a class="dropdown-item" href="#" onClick="fmInsertFile(\'' + file.filename + '\', \'' + file.absoluteURL + '\', \'' + file.mime + '\'); fmClose();"><i class="bi bi-plus-circle"></i><?php $L->p('Insert') ?></a></li>' +
|
||||
' <li><a class="dropdown-item" href="#"><i class="bi bi-image"></i>Set as cover image</a></li>' +
|
||||
' <ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="fileOptions">' +
|
||||
' <li><a class="dropdown-item" href="#" onClick="fmInsertFile(\'' + file.filename + '\', \'' + file.absoluteURL + '\', \'' + file.mime + '\'); fmClose();"><i class="bi bi-plus-circle"></i><?php $L->p('Insert original') ?></a></li>' +
|
||||
' <li><a class="dropdown-item" href="#" onClick="fmInsertFile(\'' + file.filename + '\', \'' + file.thumbnailSmall + '\', \'' + file.mime + '\'); fmClose();"><i class="bi bi-plus-circle"></i><?php $L->p('Insert small') ?></a></li>' +
|
||||
' <li><a class="dropdown-item" href="#" onClick="fmInsertFile(\'' + file.filename + '\', \'' + file.thumbnailMedium + '\', \'' + file.mime + '\'); fmClose();"><i class="bi bi-plus-circle"></i><?php $L->p('Insert medium') ?></a></li>' +
|
||||
' <li><hr class="dropdown-divider"></li>' +
|
||||
' <li><a class="dropdown-item" href="#" onClick="setCoverImage(\'' + file.filename + '\')"><i class="bi bi-image"></i>Set as cover image</a></li>' +
|
||||
' <li><hr class="dropdown-divider"></li>' +
|
||||
' <li><a class="dropdown-item" href="#"><i class="bi bi-trash"></i><?php $L->p('Delete') ?></a></li>' +
|
||||
' </ul>' +
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
api.activatePlugin(args).then(function(response) {
|
||||
if (response.status == 0) {
|
||||
logs('Plugin activated: ' + response.data.key);
|
||||
window.location.replace('<?php echo HTML_PATH_ADMIN_ROOT . 'plugins-settings/' ?>'+response.data.key);
|
||||
window.location.replace('<?php echo HTML_PATH_ADMIN_ROOT . 'plugins-settings/' ?>' + response.data.key);
|
||||
} else {
|
||||
logs('An error occurred while trying to activate the plugin.');
|
||||
showAlertError(response.message);
|
||||
|
@ -92,85 +92,74 @@
|
|||
|
||||
<?php
|
||||
|
||||
// Plugins installed
|
||||
echo Bootstrap::formTitle(array('icon' => 'check-square', 'title' => $L->g('Enabled plugins')));
|
||||
echo '<table class="table table-striped"><tbody>';
|
||||
|
||||
echo '
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
';
|
||||
|
||||
// Show installed plugins
|
||||
foreach ($pluginsInstalled as $plugin) {
|
||||
echo '<tr id="' . $plugin->className() . '" class="searchItem">';
|
||||
|
||||
echo '<td class="align-middle pt-3 pb-3 w-25">
|
||||
<div class="searchText">' . $plugin->name() . '</div>
|
||||
<div class="mt-1">';
|
||||
echo '<td class="align-middle pt-3 pb-3 w-25">';
|
||||
echo '<div class="searchText">' . $plugin->name().'</div>';
|
||||
echo '<div class="mt-1">';
|
||||
if (method_exists($plugin, 'form')) {
|
||||
echo '<a class="me-3" href="' . HTML_PATH_ADMIN_ROOT . 'plugins-settings/' . $plugin->className() . '">' . $L->g('Settings') . '</a>';
|
||||
}
|
||||
// You can not disable a plugin for an activated theme
|
||||
if ($plugin->type()!='theme') {
|
||||
// You can not disable a plugin for theme which is active
|
||||
if ($plugin->type() != 'theme') {
|
||||
echo '<span class="link deactivatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
|
||||
echo $plugin->description();
|
||||
echo '<div>' . $plugin->description() . '</div>';
|
||||
if (in_array($plugin->type(), array('dashboard','theme','editor'))) {
|
||||
echo '<div class="badge bg-primary">'.$L->g($plugin->type()).'</div>';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<span>' . $plugin->version() . '</span>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
||||
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
|
||||
</td>';
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
|
||||
echo Bootstrap::formTitle(array('icon' => 'dash-square', 'title' => $L->g('Disabled plugins')));
|
||||
|
||||
echo '
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
';
|
||||
echo '</tbody></table>';
|
||||
|
||||
// Plugins not installed
|
||||
echo Bootstrap::formTitle(array('icon' => 'dash-square', 'title' => $L->g('Disabled plugins')));
|
||||
echo '<table class="table table-striped"><tbody>';
|
||||
|
||||
$pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled);
|
||||
foreach ($pluginsNotInstalled as $plugin) {
|
||||
echo '<tr id="' . $plugin->className() . '" class="searchItem">';
|
||||
|
||||
echo '<td class="align-middle pt-3 pb-3 w-25">
|
||||
<div class="searchText">' . $plugin->name() . '</div>
|
||||
<div class="mt-1">
|
||||
<span class="link activatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Activate') . '</a>
|
||||
</div>
|
||||
</td>';
|
||||
echo '<td class="align-middle pt-3 pb-3 w-25">';
|
||||
echo '<div class="searchText">' . $plugin->name() . '</div>';
|
||||
echo '<div class="mt-1"><span class="link activatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Activate') . '</a></div>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
|
||||
echo $plugin->description();
|
||||
echo '<div>' . $plugin->description() . '</div>';
|
||||
if (in_array($plugin->type(), array('dashboard','theme','editor'))) {
|
||||
echo '<div class="badge bg-primary">'.$L->g($plugin->type()).'</div>';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<span>' . $plugin->version() . '</span>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
||||
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
|
||||
</td>';
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
echo '</tbody></table>';
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
args[key] = value;
|
||||
});
|
||||
|
||||
$('textarea[data-save="true"]').each(function() {
|
||||
var key = $(this).attr('name');
|
||||
var value = $(this).val();
|
||||
args[key] = value;
|
||||
});
|
||||
|
||||
api.saveSettings(args).then(function(response) {
|
||||
if (response.status == 0) {
|
||||
logs('Settings saved.');
|
||||
|
|
Loading…
Add table
Reference in a new issue