Skip to content

Commit

Permalink
fix(UI): Changed user and menu panels size for LG breakpoint. Clear `…
Browse files Browse the repository at this point in the history
…cache.global_clearer` in CacheController and SchemaUpdater.
  • Loading branch information
ambroisemaupate committed Jun 19, 2023
1 parent 4e0f81b commit c20463e
Show file tree
Hide file tree
Showing 21 changed files with 441 additions and 177 deletions.
1 change: 1 addition & 0 deletions lib/RoadizCoreBundle/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ services:
- { name: doctrine.event_subscriber }

RZ\Roadiz\CoreBundle\Doctrine\SchemaUpdater:
arguments: ['@cache.global_clearer']
tags:
- { name: monolog.logger, channel: doctrine }

Expand Down
5 changes: 5 additions & 0 deletions lib/RoadizCoreBundle/src/Doctrine/SchemaUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,32 @@

use Psr\Log\LoggerInterface;
use RZ\Roadiz\CoreBundle\Cache\Clearer\OPCacheClearer;
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
use Symfony\Component\Process\Process;

final class SchemaUpdater
{
private LoggerInterface $logger;
private OPCacheClearer $opCacheClearer;
private string $projectDir;
private CacheClearerInterface $cacheClearer;

public function __construct(
CacheClearerInterface $cacheClearer,
OPCacheClearer $opCacheClearer,
LoggerInterface $logger,
string $projectDir
) {
$this->logger = $logger;
$this->opCacheClearer = $opCacheClearer;
$this->projectDir = $projectDir;
$this->cacheClearer = $cacheClearer;
}

public function clearMetadata(): void
{
$this->opCacheClearer->clear();
$this->cacheClearer->clear('');

$process = $this->runCommand(
'doctrine:cache:clear-metadata',
Expand Down
3 changes: 3 additions & 0 deletions lib/RoadizRozierBundle/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ services:

RZ\Roadiz\RozierBundle\Controller\PingController:
arguments: ['@?profiler']

Themes\Rozier\Controllers\CacheController:
arguments: ['@cache.global_clearer']
53 changes: 8 additions & 45 deletions lib/Rozier/src/Controllers/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,35 @@
use Psr\Log\LoggerInterface;
use RZ\Roadiz\CoreBundle\Event\Cache\CachePurgeRequestEvent;
use RZ\Roadiz\Documents\Events\CachePurgeAssetsRequestEvent;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
use Themes\Rozier\RozierApp;

/**
* @package Themes\Rozier\Controllers
*/
class CacheController extends RozierApp
final class CacheController extends RozierApp
{
private LoggerInterface $logger;
private CacheClearerInterface $cacheClearer;

/**
* @param LoggerInterface $logger
*/
public function __construct(
CacheClearerInterface $cacheClearer,
LoggerInterface $logger
) {
$this->logger = $logger;
$this->cacheClearer = $cacheClearer;
}

public function deleteDoctrineCache(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_ACCESS_DOCTRINE_CACHE_DELETE');

$form = $this->buildDeleteDoctrineForm();
$form = $this->createFormBuilder()->getForm();
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$event = new CachePurgeRequestEvent();
$this->dispatchEvent($event);
$this->cacheClearer->clear('');

$msg = $this->getTranslator()->trans('cache.deleted');
$this->publishConfirmMessage($request, $msg);
Expand All @@ -57,34 +55,9 @@ public function deleteDoctrineCache(Request $request): Response

$this->assignation['form'] = $form->createView();

$this->assignation['cachesInfo'] = [
'resultCache' => $this->em()->getConfiguration()->getResultCacheImpl(),
'hydratationCache' => $this->em()->getConfiguration()->getHydrationCacheImpl(),
'queryCache' => $this->em()->getConfiguration()->getQueryCacheImpl(),
'metadataCache' => $this->em()->getConfiguration()->getMetadataCacheImpl(),
];

foreach ($this->assignation['cachesInfo'] as $key => $value) {
if (null !== $value) {
$this->assignation['cachesInfo'][$key] = get_class($value);
} else {
$this->assignation['cachesInfo'][$key] = false;
}
}

return $this->render('@RoadizRozier/cache/deleteDoctrine.html.twig', $this->assignation);
}

/**
* @return FormInterface
*/
private function buildDeleteDoctrineForm(): FormInterface
{
$builder = $this->createFormBuilder();

return $builder->getForm();
}

/**
* @param Request $request
*
Expand All @@ -95,7 +68,7 @@ public function deleteAssetsCache(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_ACCESS_DOCTRINE_CACHE_DELETE');

$form = $this->buildDeleteAssetsForm();
$form = $this->createFormBuilder()->getForm();
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
Expand All @@ -113,14 +86,4 @@ public function deleteAssetsCache(Request $request): Response

return $this->render('@RoadizRozier/cache/deleteAssets.html.twig', $this->assignation);
}

/**
* @return FormInterface
*/
private function buildDeleteAssetsForm(): FormInterface
{
$builder = $this->createFormBuilder();

return $builder->getForm();
}
}
2 changes: 1 addition & 1 deletion lib/Rozier/src/Resources/app/less/base/elements.less
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
}

.touch-scroll(){
-webkit-overflow-scrolling: touch;
--webkit-overflow-scrolling: touch;
}

.clearfloat() {
Expand Down
29 changes: 0 additions & 29 deletions lib/Rozier/src/Resources/app/less/documents/documents.less
Original file line number Diff line number Diff line change
Expand Up @@ -83,37 +83,8 @@ table.documents {
}

.document-checkbox {
position: absolute;
top: 8px;
right: 5px;
display: none;
width: 14px;
height: 14px;
line-height:12px;
border: 1px solid #aaa;
overflow: hidden;
vertical-align: middle;
-webkit-appearance: none;
outline: 0;
background: #fff;

&:focus{
border-color: @grey-form-submit-border-hover;
}

&:checked {
display: inline-block;

&:before{
content: "\f00c";
font-family: FontAwesome;
font-size: 12px;
-webkit-font-smoothing: antialiased;
text-align: center;
line-height: 12px;
color: darken(@contrast-color, 10%);
}
}
}

.document-item{
Expand Down
2 changes: 1 addition & 1 deletion lib/Rozier/src/Resources/app/less/grid/grid_layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#main-content {
position: relative;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
--webkit-overflow-scrolling: touch;
width: 100%;

#main-content-overlay{
Expand Down
10 changes: 7 additions & 3 deletions lib/Rozier/src/Resources/app/less/nodes/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,23 @@
}

// Tree
.document-checkbox,
.tag-checkbox,
.node-checkbox{
.node-checkbox {
position: absolute;
top: 10px; right: 0px;
top: 10px;
right: 0;
display: none;
width: 14px; height: 14px;
width: 14px;
height: 14px;
line-height:12px;
border: 1px solid #aaa;
overflow: hidden;
vertical-align: middle;
-webkit-appearance: none;
outline: 0;
background: #fff;
cursor: pointer;

&:focus{
border-color: @grey-form-submit-border-hover;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
bottom:0;
left:0;
right:0;
-webkit-overflow-scrolling: touch;
--webkit-overflow-scrolling: touch;

& > ul{
position: relative;
Expand Down
37 changes: 16 additions & 21 deletions lib/Rozier/src/Resources/app/less/panels/user_panel/user_panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
color: @user-panel-text-alt-color;
}
p, li, h1, h2, h3, h4, h5, h6 {
font-size: 16px;
line-height: 1.2em;
.transition(font-size ease 1s);
}

Expand Down Expand Up @@ -72,9 +70,10 @@

.dev-mode {
.opacity(0.75);
padding: 10px 0px;
padding: 10px;
margin: 0;
font-size: 10px;
line-height: 1.5em;
.transition(font-size 1s ease);
text-shadow: 0 1px 0 rgba(0,0,0,.8);

Expand All @@ -88,20 +87,13 @@
}
}
&.minified {

p, li, h1, h2, h3, h4, h5, h6 {
font-size: 12px;
}
.dev-mode {
font-size: 10px;
}
.user-actions-menu {
padding: 12px 0 16px 0;

h3 {
display: none;
}
}
#user-picture {
width: @user-picture-size-mini;
height: @user-picture-size-mini;
Expand Down Expand Up @@ -139,13 +131,6 @@
.dev-mode {
font-size: 9px;
}

.user-actions-menu {
h3 {
font-size: 10px;
margin: 5px 6px;
}
}
}
}

Expand Down Expand Up @@ -216,9 +201,8 @@
text-align: center;
padding: 20px 0 10px 0;

h3 {
h3, p {
font-size: 12px;
font-weight: bold;
margin-top: 6px;
}

Expand All @@ -227,9 +211,20 @@
}

.user-actions {
padding: 10px;
margin-top: 9px;
border-top: 1px solid @user-panel-border-color;
<<<<<<< Updated upstream
=======

@media (min-width: @screen-sm-min) {
padding: 10px;
margin-top: 9px;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 5px;
}
>>>>>>> Stashed changes
}

.user-action-label{
Expand Down
16 changes: 2 additions & 14 deletions lib/Rozier/src/Resources/app/less/responsive/less-768.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
position: fixed !important;
}
// User panel
#user-panel{
#user-panel {
display:block;
width:100%;
height: @mobile-admin-menu-height;
Expand Down Expand Up @@ -117,18 +117,6 @@
}
}

.user-actions-menu {
padding:0;
h3{
display: none;
}

.user-actions {
padding: 0;
margin-top: 0;
}
}

.uk-icon-button{
position: relative;
width:100%;
Expand Down Expand Up @@ -200,7 +188,7 @@
background: #f2f2f2;
.translate(-80vw, 0);
z-index:9;
-webkit-overflow-scrolling: touch;
--webkit-overflow-scrolling: touch;
overflow-y: scroll;
padding-bottom: 50px;
box-sizing: border-box;
Expand Down
6 changes: 3 additions & 3 deletions lib/Rozier/src/Resources/app/less/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@

/* -------- PANEL SIZES -------- */

@user-panel-width: 200px;
@user-panel-width: 150px;
@user-panel-sm-width: 90px;
@user-panel-lg-width: 120px;
@user-panel-xl-width: 200px;
@user-panel-xl-width: 150px;

@entries-panel-width: 60px;
@entries-panel-lg-width: 70px;
@entries-panel-xl-width: 88px;
@entries-panel-xl-width: 70px;
@trees-panel-width: 270px;
@trees-panel-lg-width: 270px;
@trees-panel-xl-width: 350px;
Expand Down
2 changes: 1 addition & 1 deletion lib/Rozier/src/Resources/views/panels/user_panel.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
src="{{ app.user.pictureUrl }}"
alt="{{ app.user.identifier }}" />
</a>
<h3>{{ "hello.%name%"|trans({'%name%': app.user.identifier}) }}</h3>
<p>{{ "hello.%name%"|trans({'%name%': app.user.identifier}) }}</p>
{% elseif app.user %}
{% set displayName = app.user.nickname|default(app.user.givenName|default(app.user.name)) %}
{% if app.user.picture %}
Expand Down
Loading

0 comments on commit c20463e

Please sign in to comment.