refactored edlp_ajax_node module to edlp_ajax to be able to get taxonomy terms
This commit is contained in:
@@ -97,7 +97,7 @@
|
||||
// cartel functions
|
||||
loadNode(nid){
|
||||
this.$cartel.addClass('loading');
|
||||
$.getJSON('/edlp/node/'+nid+'/ajax/player_cartel', {})
|
||||
$.getJSON('/edlp/ajax/json/node/'+nid+'/player_cartel', {})
|
||||
.done(this.onNodeLoaded.bind(this))
|
||||
.fail(this.onNodeLoadFail.bind(this));
|
||||
},
|
||||
@@ -219,11 +219,7 @@
|
||||
var $this = $(this);
|
||||
// avoid already ajaxified links
|
||||
// if($this.is('.ajax-enable')) return;
|
||||
var sys_path = $this.attr('data-drupal-link-system-path');
|
||||
if(sys_path){
|
||||
// convert node link to edlp_ajax_node module links
|
||||
m = sys_path.match(/^\/?(node\/\d+)$/g);
|
||||
if(m) $this.attr('data-drupal-link-system-path', 'edlp/'+m[0]);
|
||||
if($this.attr('data-drupal-link-system-path')){
|
||||
$this.on('click', onClickAjaxLink).addClass('ajax-enable');
|
||||
}
|
||||
});
|
||||
@@ -237,19 +233,28 @@
|
||||
return false;
|
||||
|
||||
var sys_path = $(this).attr('data-drupal-link-system-path');
|
||||
var ajax_path = sys_path;
|
||||
if(sys_path == '<front>'){
|
||||
backToFrontPage();
|
||||
return false;
|
||||
}
|
||||
m = ajax_path.match(/^\/?(node\/\d+)$/g);
|
||||
if(m){
|
||||
// convert node link to edlp_ajax_node module links
|
||||
ajax_path = 'edlp/ajax/json/'+m[0];
|
||||
// check for viewmode attribute
|
||||
if($link.attr('viewmode')){
|
||||
ajax_path += '/'+$link.attr('viewmode');
|
||||
}
|
||||
}else{
|
||||
// convert other link to ajax
|
||||
ajax_path += '/ajax'
|
||||
}
|
||||
|
||||
var path = window.location.origin + drupalSettings.path.baseUrl + sys_path;
|
||||
_$body.addClass('ajax-loading');
|
||||
$link.addClass('ajax-loading');
|
||||
// check for viewmode attribute
|
||||
path += '/ajax';
|
||||
if($link.attr('viewmode') != ''){
|
||||
path += '/'+$link.attr('viewmode');
|
||||
}
|
||||
|
||||
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
|
||||
$.getJSON(path, {})
|
||||
.done(function(data){
|
||||
onAjaxLinkLoaded(data, $link, sys_path);
|
||||
@@ -275,9 +280,16 @@
|
||||
_$content_container.html(data.rendered);
|
||||
|
||||
// add body class for currently loaded content
|
||||
_$body.removeClass().addClass('path-'+sys_path.replace(/\//g, '-'));
|
||||
var body_classes = [
|
||||
'path-'+sys_path.replace(/\//g, '-'),
|
||||
'entity-type-'+data.entity_type,
|
||||
'bundle-'+data.bundle,
|
||||
'view-mode-'+data.view_mode
|
||||
];
|
||||
_$body.removeClass().addClass(body_classes.join(' '));
|
||||
|
||||
// id node add a generic path-node class to body
|
||||
m = sys_path.match(/^\/?(edlp\/node\/\d+)$/g);
|
||||
m = sys_path.match(/^\/?(node\/\d+)$/g);
|
||||
if(m)
|
||||
_$body.addClass('path-edlp-node');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user