mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-11 15:56:06 +01:00
Merge branch 'develop' into feature/admin-gpm-dependencies
This commit is contained in:
14
admin.php
14
admin.php
@@ -368,6 +368,9 @@ class AdminPlugin extends Plugin
|
||||
throw new \RuntimeException('Page Not Found', 404);
|
||||
}
|
||||
}
|
||||
|
||||
// Explicitly set a timestamp on assets
|
||||
$this->grav['assets']->setTimestamp(substr(md5(GRAV_VERSION . $this->grav['config']->checksum()),0,10));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -377,15 +380,8 @@ class AdminPlugin extends Plugin
|
||||
{
|
||||
// Disable Asset pipelining
|
||||
$assets = $this->grav['assets'];
|
||||
if (method_exists($assets, 'setJsPipeline')) {
|
||||
$assets->setJsPipeline(false);
|
||||
$assets->setCssPipeline(false);
|
||||
}
|
||||
|
||||
// Explicitly set a timestamp on assets
|
||||
if (method_exists($assets, 'setTimestamp')) {
|
||||
$assets->setTimestamp(substr(md5(GRAV_VERSION),0,10));
|
||||
}
|
||||
$assets->setJsPipeline(false);
|
||||
$assets->setCssPipeline(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,17 +18,18 @@ export const defaults = {
|
||||
total: 100,
|
||||
showLabel: false,
|
||||
height: 150,
|
||||
chartPadding: !isFirefox ? 10 : 25
|
||||
// chartPadding: !isFirefox ? 10 : 25 // workaround for older versions of firefox
|
||||
chartPadding: 5
|
||||
},
|
||||
Bar: {
|
||||
height: 164,
|
||||
chartPadding: !isFirefox ? 5 : 25,
|
||||
chartPadding: !isFirefox ? 5 : 10, // workaround for older versions of firefox
|
||||
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
labelOffset: {
|
||||
x: 0,
|
||||
y: 5
|
||||
y: 0
|
||||
}
|
||||
},
|
||||
axisY: {
|
||||
@@ -39,7 +40,7 @@ export const defaults = {
|
||||
x: 5,
|
||||
y: 5
|
||||
},
|
||||
scaleMinSpace: 20
|
||||
scaleMinSpace: !isFirefox ? 20 : 10
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +60,8 @@ export default class Chart {
|
||||
options,
|
||||
data
|
||||
});
|
||||
this.chart = chartist[this.type](this.element.find('.ct-chart')[0], this.data, this.options);
|
||||
this.chart = chartist[this.type](this.element.find('.ct-chart').empty()[0], this.data, this.options);
|
||||
this.element.find('.hidden').removeClass('hidden');
|
||||
}
|
||||
|
||||
updateData(data) {
|
||||
|
||||
@@ -164,6 +164,10 @@ export class Toolbar {
|
||||
let element = $(`<li class="grav-editor-button-${key}"><a class="hint--top" data-hint="${obj.title}" title="${obj.title}">${obj.label}</a></li>`);
|
||||
this.ui.navigation.find('.grav-editor-actions ul').append(element);
|
||||
|
||||
if (obj.shortcut) {
|
||||
this.addShortcut(obj.identifier, obj.shortcut, element);
|
||||
}
|
||||
|
||||
obj.action && obj.action.call(obj.action, {
|
||||
codemirror: this.codemirror,
|
||||
button: element,
|
||||
@@ -183,6 +187,10 @@ export class Toolbar {
|
||||
let element = $(`<li class="grav-editor-button-${key}"><a class="hint--top" data-hint="${obj.title}" title="${obj.title}">${obj.label}</a></li>`);
|
||||
this.ui.navigation.find('.grav-editor-modes ul').append(element);
|
||||
|
||||
if (obj.shortcut) {
|
||||
this.addShortcut(obj.identifier, obj.shortcut, element);
|
||||
}
|
||||
|
||||
obj.action && obj.action.call(obj.action, {
|
||||
codemirror: this.codemirror,
|
||||
button: element,
|
||||
@@ -193,6 +201,21 @@ export class Toolbar {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
addShortcut(identifier, shortcut, element) {
|
||||
let map = {};
|
||||
if (!Array.isArray(shortcut)) {
|
||||
shortcut = [shortcut];
|
||||
}
|
||||
|
||||
shortcut.forEach((key) => {
|
||||
map[key] = () => {
|
||||
element.trigger(`click.editor.${identifier}`, [this.codemirror]);
|
||||
};
|
||||
});
|
||||
|
||||
this.codemirror.addKeyMap(map);
|
||||
}
|
||||
}
|
||||
|
||||
export let Instance = new EditorField();
|
||||
|
||||
@@ -64,14 +64,61 @@ export let strategies = {
|
||||
replaceRange() {}
|
||||
};
|
||||
|
||||
const flipDisabled = (codemirror, button, type) => {
|
||||
let hasHistory = codemirror.historySize()[type];
|
||||
let element = button.find('a');
|
||||
button[hasHistory ? 'removeClass' : 'addClass']('button-disabled');
|
||||
|
||||
if (!hasHistory) {
|
||||
element.attr('title-disabled', element.attr('title'));
|
||||
element.attr('data-hint-disabled', element.attr('data-hint'));
|
||||
element.removeAttr('title').removeAttr('data-hint');
|
||||
} else {
|
||||
element.attr('title', element.attr('title-disabled'));
|
||||
element.attr('data-hint', element.attr('data-hint-disabled'));
|
||||
element.removeAttr('title-disabled').removeAttr('data-hint-disabled');
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
navigation: [
|
||||
{
|
||||
undo: {
|
||||
identifier: 'undo',
|
||||
title: 'Undo',
|
||||
label: '<i class="fa fa-fw fa-undo"></i>',
|
||||
modes: [],
|
||||
action({ codemirror, button, textarea}) {
|
||||
button.addClass('button-disabled');
|
||||
codemirror.on('change', () => flipDisabled(codemirror, button, 'undo'));
|
||||
button.on('click.editor.undo', () => {
|
||||
codemirror.undo();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
redo: {
|
||||
identifier: 'redo',
|
||||
title: 'Redo',
|
||||
label: '<i class="fa fa-fw fa-repeat"></i>',
|
||||
modes: [],
|
||||
action({ codemirror, button, textarea}) {
|
||||
button.addClass('button-disabled');
|
||||
codemirror.on('change', () => flipDisabled(codemirror, button, 'redo'));
|
||||
button.on('click.editor.redo', () => {
|
||||
codemirror.redo();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
bold: {
|
||||
identifier: 'bold',
|
||||
title: 'Bold',
|
||||
label: '<i class="fa fa-fw fa-bold"></i>',
|
||||
modes: ['gfm', 'markdown'],
|
||||
shortcut: ['Ctrl-B', 'Cmd-B'],
|
||||
action({ codemirror, button, textarea }) {
|
||||
replacer({ name: 'bold', replace: '**$1$cur**', codemirror, button });
|
||||
}
|
||||
@@ -82,6 +129,7 @@ export default {
|
||||
title: 'Italic',
|
||||
label: '<i class="fa fa-fw fa-italic"></i>',
|
||||
modes: ['gfm', 'markdown'],
|
||||
shortcut: ['Ctrl-I', 'Cmd-I'],
|
||||
action({ codemirror, button, textarea }) {
|
||||
replacer({ name: 'italic', replace: '_$1$cur_', codemirror, button });
|
||||
}
|
||||
|
||||
2
themes/grav/css-compiled/preset.css
vendored
2
themes/grav/css-compiled/preset.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
themes/grav/css-compiled/template.css
vendored
4
themes/grav/css-compiled/template.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
themes/grav/js/admin.min.js
vendored
18
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -536,7 +536,7 @@ form {
|
||||
|
||||
.form-list-wrapper {
|
||||
ul[data-collection-holder] {
|
||||
li {
|
||||
> li {
|
||||
border: 1px solid $form-border;
|
||||
background: lighten($content-bg, 4%);
|
||||
color: lighten($content-text, 10%);
|
||||
@@ -785,6 +785,18 @@ form {
|
||||
border-right: 1px solid transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.button-disabled a {
|
||||
color: #ccc;
|
||||
text-shadow: 0 1px white;
|
||||
|
||||
&:hover, &:focus {
|
||||
background: lighten($content-bg, 5%);
|
||||
color: #ccc;
|
||||
border-left: 1px solid transparent;
|
||||
border-right: 1px solid transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ $update-height: 3rem;
|
||||
#grav-logo {
|
||||
max-width: 100%;
|
||||
padding-left: 1.5rem;
|
||||
height: $topbar-height;
|
||||
height: $topbar-height - 1.4;
|
||||
margin: 0.7rem 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
|
||||
@@ -102,11 +102,8 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
.selectize-control {
|
||||
height: 39px;
|
||||
}
|
||||
|
||||
.selectize-input {
|
||||
display: block !important;
|
||||
box-shadow: none;
|
||||
padding: $form-select-pad;
|
||||
margin: 0;
|
||||
@@ -117,7 +114,6 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.selectize-control.multi .selectize-input {
|
||||
padding: ($leading-margin / 4) ($leading-margin / 4);
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
<div class="backups-chart" data-chart-name="backups" data-chart-type="pie" data-chart-data="{{ {'series': [backup.chart_fill, backup.chart_empty]}|json_encode|e('html_attr') }}">
|
||||
<div class="chart-wrapper">
|
||||
<div class="ct-chart"></div>
|
||||
<span class="numeric">{{ backup.days }}<em>{{ "PLUGIN_ADMIN.DAYS"|tu|lower }}</em></span>
|
||||
<span class="numeric hidden">{{ backup.days }}<em>{{ "PLUGIN_ADMIN.DAYS"|tu|lower }}</em></span>
|
||||
</div>
|
||||
<p>{{ "PLUGIN_ADMIN.LAST_BACKUP"|tu }}</p>
|
||||
<p class="hidden">{{ "PLUGIN_ADMIN.LAST_BACKUP"|tu }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flush-bottom button-bar">
|
||||
|
||||
Reference in New Issue
Block a user