mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 02:46:04 +01:00
Added support for user-uploadable avatar
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
# v1.3.0-rc.4
|
# v1.3.0-rc.4
|
||||||
## 03/xx/2017
|
## 03/xx/2017
|
||||||
|
s̄
|
||||||
|
1. [](#new)
|
||||||
|
* User uploadable avatar (still falls back to Gravatar if not provided)
|
||||||
1. [](#improved)
|
1. [](#improved)
|
||||||
* Improved tabs CSS to handle long titles [#1036](https://github.com/getgrav/grav-plugin-admin/issues/1036)
|
* Improved tabs CSS to handle long titles [#1036](https://github.com/getgrav/grav-plugin-admin/issues/1036)
|
||||||
* Fixed `step` in range field [Form#136](https://github.com/getgrav/grav-plugin-form/issues/136)
|
* Fixed `step` in range field [Form#136](https://github.com/getgrav/grav-plugin-form/issues/136)
|
||||||
|
|||||||
@@ -339,8 +339,12 @@ class AdminBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set destination
|
// Set destination
|
||||||
$destination = Folder::getRelativePath(rtrim($settings->destination, '/'));
|
if ($this->grav['locator']->isStream($settings->destination)) {
|
||||||
$destination = $this->admin->getPagePathFromToken($destination);
|
$destination = $this->grav['locator']->findResource($settings->destination, false, true);
|
||||||
|
} else {
|
||||||
|
$destination = Folder::getRelativePath(rtrim($settings->destination, '/'));
|
||||||
|
$destination = $this->admin->getPagePathFromToken($destination);
|
||||||
|
}
|
||||||
|
|
||||||
// Create destination if needed
|
// Create destination if needed
|
||||||
if (!is_dir($destination)) {
|
if (!is_dir($destination)) {
|
||||||
|
|||||||
@@ -489,7 +489,6 @@ class AdminController extends AdminBaseController
|
|||||||
|
|
||||||
$parent = $route && $route != '/' && $route != '.' ? $pages->dispatch($route, true) : $pages->root();
|
$parent = $route && $route != '/' && $route != '.' ? $pages->dispatch($route, true) : $pages->root();
|
||||||
|
|
||||||
$original_slug = $obj->slug();
|
|
||||||
$original_order = intval(trim($obj->order(), '.'));
|
$original_order = intval(trim($obj->order(), '.'));
|
||||||
|
|
||||||
// Change parent if needed and initialize move (might be needed also on ordering/folder change).
|
// Change parent if needed and initialize move (might be needed also on ordering/folder change).
|
||||||
@@ -559,6 +558,7 @@ class AdminController extends AdminBaseController
|
|||||||
if ($this->view === 'user') {
|
if ($this->view === 'user') {
|
||||||
if ($obj->username == $this->grav['user']->username) {
|
if ($obj->username == $this->grav['user']->username) {
|
||||||
//Editing current user. Reload user object
|
//Editing current user. Reload user object
|
||||||
|
unset($this->grav['user']->avatar);
|
||||||
$this->grav['user']->merge(User::load($this->admin->route)->toArray());
|
$this->grav['user']->merge(User::load($this->admin->route)->toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1783,7 +1783,7 @@ class AdminController extends AdminBaseController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($input['folder']) && ($input['folder'] != $page->value('folder'))) {
|
if ($input['folder'] != $page->value('folder')) {
|
||||||
$order = $page->value('order');
|
$order = $page->value('order');
|
||||||
$ordering = $order ? sprintf('%02d.', $order) : '';
|
$ordering = $order ? sprintf('%02d.', $order) : '';
|
||||||
$page->folder($ordering . $input['folder']);
|
$page->folder($ordering . $input['folder']);
|
||||||
@@ -1881,8 +1881,6 @@ class AdminController extends AdminBaseController
|
|||||||
$order = $this->getNextOrderInFolder($page->parent()->path());
|
$order = $this->getNextOrderInFolder($page->parent()->path());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->preparePage($page);
|
|
||||||
|
|
||||||
// Make sure the header is loaded in case content was set through raw() (expert mode)
|
// Make sure the header is loaded in case content was set through raw() (expert mode)
|
||||||
$page->header();
|
$page->header();
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ PLUGIN_ADMIN:
|
|||||||
EVERYTHING_UPDATED: "Everything updated"
|
EVERYTHING_UPDATED: "Everything updated"
|
||||||
UPDATES_FAILED: "Updates failed"
|
UPDATES_FAILED: "Updates failed"
|
||||||
AVATAR_BY: "Avatar by"
|
AVATAR_BY: "Avatar by"
|
||||||
|
AVATAR_UPLOAD_OWN: "Or upload your own..."
|
||||||
LAST_BACKUP: "Last Backup"
|
LAST_BACKUP: "Last Backup"
|
||||||
FULL_NAME: "Full name"
|
FULL_NAME: "Full name"
|
||||||
USERNAME: "Username"
|
USERNAME: "Username"
|
||||||
|
|||||||
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
2
themes/grav/css-compiled/template.css
vendored
2
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
@@ -345,6 +345,12 @@ tr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.block-userinfo {
|
||||||
|
img {
|
||||||
|
border: 4px solid $form-border;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#admin-user-details, .admin-user-details {
|
#admin-user-details, .admin-user-details {
|
||||||
border-bottom: 1px solid lighten($nav-bg, 5%);
|
border-bottom: 1px solid lighten($nav-bg, 5%);
|
||||||
|
|
||||||
|
|||||||
@@ -311,6 +311,26 @@ $sidebar-padding: 2rem;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.block-userinfo {
|
||||||
|
img {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
& ~ .block-file {
|
||||||
|
margin-top: -5rem !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#admin-user-details {
|
||||||
|
img {
|
||||||
|
width: 47px;
|
||||||
|
height: 47px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#admin-user-details, .admin-user-details {
|
#admin-user-details, .admin-user-details {
|
||||||
padding: 15px 10px;
|
padding: 15px 10px;
|
||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
@@ -1110,4 +1130,4 @@ body.sidebar-quickopen #admin-main {
|
|||||||
display: none!important;
|
display: none!important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="form-field grid user-details">
|
<div class="form-field grid user-details">
|
||||||
<div class="form-label block size-1-3">
|
<div class="form-label block size-1-3">
|
||||||
<label>{% include 'partials/userinfo-avatar.html.twig' %}</label>
|
{% if data.avatar %}
|
||||||
|
<label><img src="{{ base_url_simple ~ '/' ~ (data.avatar|first).path }}" /></label>
|
||||||
|
{% else %}
|
||||||
|
<label>{% include 'partials/userinfo-avatar.html.twig' %}</label>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-data block size-2-3">
|
<div class="form-data block size-2-3">
|
||||||
<h2>{{ data.fullname }}</h2>
|
<h2>{{ data.fullname }}</h2>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<img src="https://www.gravatar.com/avatar/{{ admin.user.email|md5 }}?s=47" />
|
<img src="{{ admin.user.avatarUrl() }}?s=47" />
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<p class="gravatar">{{ "PLUGIN_ADMIN.AVATAR_BY"|tu }} <a href="https://gravatar.com" target="_blank">gravatar.com</a></p>
|
<p class="gravatar">{{ "PLUGIN_ADMIN.AVATAR_BY"|tu }} <a href="https://gravatar.com" target="_blank">gravatar.com</a>. {{ "PLUGIN_ADMIN.AVATAR_UPLOAD_OWN"|tu }}</p>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<img src="https://www.gravatar.com/avatar/{{ data.email|md5 }}?s=128" />
|
<img src="https://www.gravatar.com/avatar/{{ data.email|md5 }}?s=200" />
|
||||||
|
|||||||
Reference in New Issue
Block a user