Browse Source

fixed article links from audio cartel not beeing deactivate after modale close

Bachir Soussi Chiadmi 5 years ago
parent
commit
4071378981

File diff suppressed because it is too large
+ 0 - 0
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js


+ 15 - 4
sites/all/themes/custom/edlptheme/assets/scripts/main.js

@@ -262,20 +262,26 @@
     };
     function onAjaxLoaded(data, state){
       console.log('ajax loaded', state, data);
+
+      var $rendered = $(data.rendered);
+      $rendered.attr({
+        'sys_path':state.sys_path,
+        'view_mode': state.view_mode
+      });
       // console.log(data);
       // reset all style may been added by other pages (like masonry for productions)
       // and replace all content with newly loaded
       // TODO: build a system to replace or append contents (like studio + search)
       if(data.entity_type == "node" && data.bundle == "evenement"){
         if(_$row.find('.col.event').length){
-          _$row.find('.col.event').replaceWith(data.rendered);
+          _$row.find('.col.event').replaceWith($rendered);
         }else if(_$row.find('.col.aside').length){
-          _$row.find('.col.aside').replaceWith(data.rendered);
+          _$row.find('.col.aside').replaceWith($rendered);
         }else{
-          _$row.append(data.rendered);
+          _$row.append($rendered);
         }
       }else{
-        _$row.removeAttr('style').html(data.rendered);
+        _$row.removeAttr('style').html($rendered);
       }
 
       // add body class for currently loaded content
@@ -491,6 +497,11 @@
       }
       checkRowEmpty();
       checkVisibleCorpusMapSpace();
+
+      // set links to this modal to not active (tested on articles from audio cartel)
+      if( $col.attr('view_mode') && $col.attr('sys_path')){
+        $('a[data-drupal-link-system-path="'+$col.attr('sys_path')+'"][viewmode="'+$col.attr('view_mode')+'"]').removeClass('is-active');
+      }
     };
 
     //    _    _            ___ _         _

Some files were not shown because too many files changed in this diff