fixed cloing entree history nav

This commit is contained in:
Bachir Soussi Chiadmi
2018-04-12 23:54:45 +02:00
parent 97dd8cdf97
commit d485286289
5 changed files with 30 additions and 36 deletions
@@ -348,7 +348,7 @@
function onHistoryPopState(e){
console.log('onPopState',e.state);
if(e.state.home){
backToFrontPage();
backToFrontPage(true);
}else{
if(e.state.entree_tid){
openEntree(e.state.entree_tid);
@@ -369,7 +369,8 @@
function initAjaxLinks(){
// console.log('initAjaxLinks');
$('a', '#block-mainnavigation')
$('a.site-name', '#block-edlptheme-branding')
.add('a', '#block-mainnavigation')
.add('a', '#block-footer.menu--footer')
.add('a', '#block-productions')
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
@@ -1070,13 +1071,16 @@
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
// |_||_| \___/_||_\__|_| \__,_\__, \___|
// |___/
function backToFrontPage(){
function backToFrontPage(pop_state){
closeAllModals();
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'});
if(!pop_state){
history.pushState({home:true}, null, window.location.origin);
}
}
function initHome(){
@@ -348,7 +348,7 @@
function onHistoryPopState(e){
console.log('onPopState',e.state);
if(e.state.home){
backToFrontPage();
backToFrontPage(true);
}else{
if(e.state.entree_tid){
openEntree(e.state.entree_tid);
@@ -369,7 +369,8 @@
function initAjaxLinks(){
// console.log('initAjaxLinks');
$('a', '#block-mainnavigation')
$('a.site-name', '#block-edlptheme-branding')
.add('a', '#block-mainnavigation')
.add('a', '#block-footer.menu--footer')
.add('a', '#block-productions')
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
@@ -1070,13 +1071,16 @@
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
// |_||_| \___/_||_\__|_| \__,_\__, \___|
// |___/
function backToFrontPage(){
function backToFrontPage(pop_state){
closeAllModals();
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'});
if(!pop_state){
history.pushState({home:true}, null, window.location.origin);
}
}
function initHome(){
@@ -17,12 +17,12 @@
{% if site_logo or site_name %}
<h1>
{% if site_logo %}
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo">
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo" data-drupal-link-system-path="<front>">
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
</a>
{% endif %}
{% if site_name %}
<a class="site-name" href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
<a class="site-name" href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" data-drupal-link-system-path="<front>">{{ site_name }}</a>
{% endif %}
</h1>
{% endif %}