mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-12 16:26:07 +01:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -330,6 +330,8 @@ class AdminPlugin extends Plugin
|
||||
// make sure page is not frozen!
|
||||
unset($this->grav['page']);
|
||||
|
||||
$this->admin->pagesCount();
|
||||
|
||||
// Replace page service with admin.
|
||||
$this->grav['page'] = function () use ($self) {
|
||||
$page = new Page;
|
||||
@@ -411,14 +413,13 @@ class AdminPlugin extends Plugin
|
||||
|
||||
// Dynamic type support
|
||||
$format = $this->uri->extension();
|
||||
$ext = '.' . ($format ? $format : 'html') . TWIG_EXT;
|
||||
|
||||
$twig->twig_vars['location'] = $this->template;
|
||||
$twig->twig_vars['base_url_relative_frontend'] = $twig->twig_vars['base_url_relative'] ?: '/';
|
||||
$twig->twig_vars['admin_route'] = trim($this->config->get('plugins.admin.route'), '/');
|
||||
$twig->twig_vars['base_url_relative'] =
|
||||
$twig->twig_vars['base_url_simple'] . '/' . $twig->twig_vars['admin_route'];
|
||||
$twig->twig_vars['theme_url'] = '/user/plugins/admin/themes/' . $this->theme;
|
||||
$twig->twig_vars['theme_url'] = $this->grav['locator']->findResource('plugin://admin/themes/' . $this->theme, false);
|
||||
$twig->twig_vars['base_url'] = $twig->twig_vars['base_url_relative'];
|
||||
$twig->twig_vars['base_path'] = GRAV_ROOT;
|
||||
$twig->twig_vars['admin'] = $this->admin;
|
||||
|
||||
@@ -75,6 +75,11 @@ class Admin
|
||||
*/
|
||||
protected $gpm;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $pages_count;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -404,9 +409,13 @@ class Admin
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function countPages()
|
||||
public function pagesCount()
|
||||
{
|
||||
return count($this->grav['pages']->all());
|
||||
if (!$this->pages_count) {
|
||||
$this->pages_count = count($this->grav['pages']->all());
|
||||
}
|
||||
|
||||
return $this->pages_count;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
filename = filename.replace(/@3x|@2x|@1x/, '');
|
||||
filename = filename.replace(/\(/g, '%28');
|
||||
filename = filename.replace(/\)/g, '%29');
|
||||
if (filename.match(/\.(jpg|jpeg|png|gif)$/)) {
|
||||
if (filename.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)) {
|
||||
editor.doc.replaceSelection('');
|
||||
} else {
|
||||
editor.doc.replaceSelection('[' + decodeURI(filename) + '](' + filename + ')');
|
||||
|
||||
@@ -57,7 +57,14 @@
|
||||
addRemoveLinks: false,
|
||||
dictRemoveFileConfirmation: '[placeholder]',
|
||||
acceptedFiles: $('[data-media-types]').data('media-types'),
|
||||
previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>✔</span></div>\n <div class=\"dz-error-mark\"><span>✘</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>Delete</a>\n<a class=\"dz-insert\" href=\"javascript:undefined;\" data-dz-insert>Insert</a>\n</div>",
|
||||
previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n " +
|
||||
"<div class=\"dz-filename\"><span data-dz-name></span></div>\n " +
|
||||
"<div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n " +
|
||||
"<div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n "+
|
||||
"<div class=\"dz-success-mark\"><span>✔</span></div>\n <div class=\"dz-error-mark\"><span>✘</span></div>\n " +
|
||||
"<div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n" +
|
||||
"<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>Delete</a>\n" +
|
||||
"<a class=\"dz-insert\" href=\"javascript:undefined;\" data-dz-insert>Insert</a>\n</div>",
|
||||
init: function() {
|
||||
thisDropzone = this;
|
||||
$.get(URI + '/task{{ config.system.param_sep }}listmedia/admin-nonce{{ config.system.param_sep }}' + GravAdmin.config.admin_nonce, function(data) {
|
||||
@@ -73,7 +80,7 @@
|
||||
thisDropzone.files.push(mockFile);
|
||||
thisDropzone.options.addedfile.call(thisDropzone, mockFile);
|
||||
|
||||
if (filename.match(/\.(jpg|jpeg|png|gif)$/)) {
|
||||
if (filename.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)) {
|
||||
thisDropzone.options.thumbnail.call(thisDropzone, mockFile, data.url);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<div class="form-actions secondary-accent">
|
||||
{% if notAuthorized %}
|
||||
<a class="button secondary" onclick="window.history.back()"><i class="fa fa-reply"></i> {{ 'PLUGIN_ADMIN.BACK'|tu }}</a>
|
||||
<button type="submit" class="button primary" name="task" value="logout"><i class="fa fa-sign-in"></i> {{ 'PLUGIN_ADMIN.LOGOUT'|tu }}</button>
|
||||
{% else %}
|
||||
{% if not authenticated %}
|
||||
<a class="button secondary" href="{{ base_url_relative }}/forgot"><i class="fa fa-exclamation-circle"></i> {{ 'PLUGIN_ADMIN.LOGIN_BTN_FORGOT'|tu }}</a>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
{% endif %}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/png" href="{{ base_url_simple }}{{ theme_url }}/images/favicon.png">
|
||||
<link rel="icon" type="image/png" href="{{ base_url_simple }}/{{ theme_url }}/images/favicon.png">
|
||||
|
||||
{% block stylesheets %}
|
||||
{% do assets.addCss(theme_url~'/css-compiled/nucleus.css') %}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<a href="{{ base_url_relative }}/pages">
|
||||
<i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_ADMIN.PAGES"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge count">{{ admin.countPages }}</span>
|
||||
<span class="badge count">{{ admin.pagesCount }}</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user