added genres an langues condition to search, added close column bouton
This commit is contained in:
@@ -24,10 +24,14 @@
|
||||
|
||||
initAjaxLinks();
|
||||
|
||||
if (_$body.is('.path-productions')) {
|
||||
if (_$body.is('.path-productions')){
|
||||
initProductions();
|
||||
}
|
||||
|
||||
if(_$body.is('.path-frontpage')){
|
||||
addCloseBtnToCols();
|
||||
}
|
||||
|
||||
// initScrollbars();
|
||||
initEvents();
|
||||
};
|
||||
@@ -50,7 +54,7 @@
|
||||
})
|
||||
.on('close_entree', function(e){
|
||||
// e.tid available
|
||||
closeAllModals();
|
||||
backToFrontPage();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -392,7 +396,7 @@
|
||||
// return drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix + path;
|
||||
// };
|
||||
|
||||
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
|
||||
var path = window.location.origin + Drupal.url(ajax_path);
|
||||
$.getJSON(path, {})
|
||||
.done(function(data){
|
||||
onAjaxLinkLoaded(data, $link, sys_path);
|
||||
@@ -414,9 +418,13 @@
|
||||
|
||||
// replace all content with newly loaded
|
||||
// TODO: build a system to replace or append contents (like studio + search)
|
||||
|
||||
_$row.html(data.rendered);
|
||||
|
||||
// add close btn
|
||||
if(sys_path != 'procuction'){
|
||||
addCloseBtnToCols();
|
||||
}
|
||||
|
||||
// add body class for currently loaded content
|
||||
var body_classes = [
|
||||
'path-'+sys_path.replace(/\//g, '-'),
|
||||
@@ -452,11 +460,37 @@
|
||||
|
||||
_$body.trigger({'type':'new-content-ajax-loaded'});
|
||||
|
||||
// TODO: call behaviours
|
||||
// call behaviours
|
||||
Drupal.attachBehaviors(_$row[0]);
|
||||
|
||||
};
|
||||
|
||||
function addCloseBtnToCols(){
|
||||
$('.col', _$row).each(function(index, el) {
|
||||
|
||||
if($('span.close-col-btn', this).length)
|
||||
return true;
|
||||
|
||||
$(this).children('.wrapper').append($('<span>')
|
||||
.addClass('close-col-btn')
|
||||
.on('click', function(e){
|
||||
// check for theme attribute and emmit event
|
||||
var $col = $(this).parents('.col');
|
||||
var theme = $col.attr('theme');
|
||||
if(theme != ''){
|
||||
_$body.trigger({'type':theme+'-col-closed'});
|
||||
}
|
||||
// remove the col
|
||||
$col.remove();
|
||||
// if row is empty call closeAllModals()
|
||||
if(!$('.col', _$row).length){
|
||||
backToFrontPage();
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
// ___
|
||||
// / __|___ _ _ _ __ _ _ ___
|
||||
// | (__/ _ \ '_| '_ \ || (_-<
|
||||
|
||||
Reference in New Issue
Block a user