refactored articles, added articles index

This commit is contained in:
2018-10-23 16:48:43 +02:00
parent 4071378981
commit a6fb21f696
13 changed files with 327 additions and 90 deletions
@@ -301,7 +301,7 @@
// handle clicked link classes
$('.ajax-loading').removeClass('ajax-loading');
$('.ajax-link.is-active').removeClass('is-active');
$('.ajax-link.is-active:not(.articles-link)').removeClass('is-active');
$('.is-active-trail').removeClass('is-active-trail');
if(typeof state.selector != 'undefined'){
@@ -314,7 +314,10 @@
if(typeof state.view_mode != 'undefined'){
$('a[viewmode="'+state.view_mode+'"][data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
}else{
$('a[data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
// wait for corpus map beeing ready (e.g. for articles link)
_corpus_promise.done(function(){
$('a[data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
});
}
// as new content is not related to entree, we trigger close entree
_$body.trigger({'type':'new-content-not-entree-ajax-loaded'});
@@ -787,12 +790,15 @@
//console.log('theme : corpus-cliked-on-node', e);
_audioPlayer
.emmit('stop-shuffle')
.setAutoOpenArticle(e.article)
// .setAutoOpenArticle(e.article)
.openDocument(e.target_node);
});
_randomPlayer = new RandomPlayer(e.playlist);
// mainly for articles link
initAjaxLinks();
_$body.attr('corpus-map', 'ready');
}
function openEntree(tid){
@@ -1193,6 +1199,7 @@
// call drupal behaviours (for addtoany)
Drupal.attachBehaviors(this.$cartel);
// open automaticly tha article if needed
this.setAutoOpenArticle();
if(this.auto_open_article){
this.$cartel.find('a.link-article').trigger('click');
this.auto_open_article = false;
@@ -1203,7 +1210,7 @@
this.$cartel.removeClass('loading').html('');
},
setAutoOpenArticle(art){
this.auto_open_article = art;
this.auto_open_article = $('a.articles-link').is('.is-active');
return this;
},
// global
@@ -1881,15 +1888,26 @@
};
function checkRowEmpty(){
console.log('checkRowEmpty');
// if row is empty and we are not in productions or entree notice|index call closeAllModals()
if(!$('.col', _$row).length){
if(!_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
if(!_$body.is('.entity-type-node.bundle-page')){
// we weren't on production or entree, so go back to front page
if(!$('a.articles-link').is('.is-active')){
// don't go back to front page if articles filter is on
// debugger;
if(_$body.is('.bundle-enregistrement.view-mode-article')
&& $('a.articles-link').is('.is-active')){
console.log('Closing article while article index is active');
// if node article and articles is active, reload index
$('a.articles-link').removeClass('is-active').trigger('click');
}else{
backToFrontPage();
}
// if(!$('a.articles-link').is('.is-active')){
// // don't go back to front page if articles filter is on
// backToFrontPage();
// }else{
// }
}else{
// if we were on production page just scramble collection in case of map was filtered
_$corpus_canvas.trigger({'type':'scramble-collection'});