gestion du header escamotable en préférence utilisateur (fixes #31431)

This commit is contained in:
afornerot 2021-03-04 13:46:32 +01:00
parent 3c47ed1d40
commit c7c10ded30
5 changed files with 38 additions and 2 deletions

View File

@ -309,8 +309,15 @@
$color = $this->container->get('cadoles.core.service.color');
$color->setColor();
// Visite
if($curentuser!="anon.") {
// Préférence header
$preference=$curentuser->getPreference();
if(array_key_exists("fgheader",$preference)) {
$fgheader=($preference["fgheader"][0]=="true");
$session->set("fgheader", $fgheader);
}
// Visite
$now=new \DateTime();
if(!$curentuser->getVisitedate()) {
$curentuser->setVisitedate($now);

View File

@ -62,6 +62,8 @@ body {
@media (max-width: 767px) {
.header { display: none }
#menu-header { display: none }
#navbarsmalltitle { display: none }
}

View File

@ -135,6 +135,26 @@
$(location).attr('href',"/{{ alias }}");
}
function switchHeader() {
{% if app.user %}
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_user_preference') }}",
data: {
id:0,
key:'fgheader',
{% if fgheader %}
value: false
{% else %}
value: true
{% endif %}
},
success: function(idbookmark) {
location.reload();
}
});
{% endif %}
}
$(document).ready(function() {
$(".js-datepicker").datepicker({

View File

@ -4,6 +4,13 @@
{% endif %}
{% set permannu = app.session.get('permannu') %}
{% if fgheader %}
<li id="menu-header"><a onclick="switchHeader()" title="Cacher / Affichier Bannière " style="cursor:pointer"><i class="fa fa-chevron-up fa-fw"></i></a>
{% else %}
<li id="menu-header"><a onclick="switchHeader()" title="Cacher / Affichier Bannière " style="cursor:pointer"><i class="fa fa-chevron-down fa-fw"></i></a>
{% endif %}
{% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permannu=="ROLE_MODO" or permannu=="ROLE_ANIM" or permannu=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permannu=="ROLE_ANIM" or permannu=="ROLE_USER")) or (is_granted('ROLE_USER') and permannu=="ROLE_USER") %}
<li id="menu-annuaire"><a href="{{ path('cadoles_core_user_users') }}" title="Annuaire"><i class="fa fa-address-book fa-fw"></i></a>
{%endif%}

View File

@ -102,7 +102,7 @@
<a class="navbar-brand" href="{{ path("cadoles_core_home") }}">
<img id="logo" src="/{{ alias }}/{{ logo }}">
{{ app.session.get('appname') }}
<span id="navbarsmalltitle">{{ app.session.get('appname') }}</span>
</a>
</div>