chutier icon added to corpus map nodepopup
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
EdlpCorpus = function(){
|
||||
var _activated = true;
|
||||
var _$container = $('body');
|
||||
var _$body = _$container = $('body');
|
||||
var _$canvas = $('<canvas id="corpus-map">').appendTo(_$container);
|
||||
var _canvas = _$canvas[0];
|
||||
var _ctx = _canvas.getContext('2d');
|
||||
@@ -37,6 +37,8 @@
|
||||
var _articles_nodes = [];
|
||||
var _no_articles_nodes = [];
|
||||
var _nodes_by_entries = {};
|
||||
var _nodes_by_nid = {};
|
||||
|
||||
// var _particules = [];
|
||||
// var _base_radius = 3; // nodes radius (real radius, not diametre)
|
||||
var _p_velocity_factor = 0.5;
|
||||
@@ -182,6 +184,8 @@
|
||||
// record the node in different lists
|
||||
_nodes.push(this);
|
||||
|
||||
_nodes_by_nid[this.nid] = this;
|
||||
|
||||
if(this.has_article == 1){
|
||||
_articles_nodes.push(this);
|
||||
}else{
|
||||
@@ -664,6 +668,15 @@
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// $('body').trigger({
|
||||
// 'type':'chutier-action-done',
|
||||
// 'action_done':data.action_done,
|
||||
// 'target_id':$link.attr('target_id'),
|
||||
// });
|
||||
_$body.on('chutier-action-done', function(e) {
|
||||
_nodes_by_nid[e.target_id].chutier_action = e.new_action;
|
||||
});
|
||||
};
|
||||
|
||||
// _ _ _ ___ _ _
|
||||
@@ -718,10 +731,12 @@
|
||||
var tid = this.node.entrees[i];
|
||||
$entrees.append($('<span>').addClass('entree').attr('tid', tid));
|
||||
}
|
||||
var $chutier_action = $('<span>').addClass('chutier-icon').attr('action', this.node.chutier_action);
|
||||
this.$content
|
||||
.append($entrees)
|
||||
.append('<h2 class="title">'+this.node.title+'</h2>')
|
||||
.append('<section class="description">'+this.node.description+'</section>');
|
||||
.append('<section class="description">'+this.node.description+'</section>')
|
||||
.append($chutier_action);
|
||||
|
||||
// TODO: favoris marker
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
EdlpCorpus = function(){
|
||||
var _activated = true;
|
||||
var _$container = $('body');
|
||||
var _$body = _$container = $('body');
|
||||
var _$canvas = $('<canvas id="corpus-map">').appendTo(_$container);
|
||||
var _canvas = _$canvas[0];
|
||||
var _ctx = _canvas.getContext('2d');
|
||||
@@ -37,6 +37,8 @@
|
||||
var _articles_nodes = [];
|
||||
var _no_articles_nodes = [];
|
||||
var _nodes_by_entries = {};
|
||||
var _nodes_by_nid = {};
|
||||
|
||||
// var _particules = [];
|
||||
// var _base_radius = 3; // nodes radius (real radius, not diametre)
|
||||
var _p_velocity_factor = 0.5;
|
||||
@@ -182,6 +184,8 @@
|
||||
// record the node in different lists
|
||||
_nodes.push(this);
|
||||
|
||||
_nodes_by_nid[this.nid] = this;
|
||||
|
||||
if(this.has_article == 1){
|
||||
_articles_nodes.push(this);
|
||||
}else{
|
||||
@@ -664,6 +668,15 @@
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// $('body').trigger({
|
||||
// 'type':'chutier-action-done',
|
||||
// 'action_done':data.action_done,
|
||||
// 'target_id':$link.attr('target_id'),
|
||||
// });
|
||||
_$body.on('chutier-action-done', function(e) {
|
||||
_nodes_by_nid[e.target_id].chutier_action = e.new_action;
|
||||
});
|
||||
};
|
||||
|
||||
// _ _ _ ___ _ _
|
||||
@@ -718,10 +731,12 @@
|
||||
var tid = this.node.entrees[i];
|
||||
$entrees.append($('<span>').addClass('entree').attr('tid', tid));
|
||||
}
|
||||
var $chutier_action = $('<span>').addClass('chutier-icon').attr('action', this.node.chutier_action);
|
||||
this.$content
|
||||
.append($entrees)
|
||||
.append('<h2 class="title">'+this.node.title+'</h2>')
|
||||
.append('<section class="description">'+this.node.description+'</section>');
|
||||
.append('<section class="description">'+this.node.description+'</section>')
|
||||
.append($chutier_action);
|
||||
|
||||
// TODO: favoris marker
|
||||
};
|
||||
|
||||
@@ -86,6 +86,7 @@ class CorpusController extends ControllerBase {
|
||||
// "son_fid" => $son_fid,
|
||||
"son_url" => $son_url,
|
||||
"has_article" => $has_article,
|
||||
"chutier_action" => 'add',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,18 +20,7 @@
|
||||
function onClickAjaxLink(e){
|
||||
console.log('studio onClickAjaxLink chutier');
|
||||
e.preventDefault();
|
||||
// var $this = $(this);
|
||||
addRemoveToChutier($(this));
|
||||
// switch($this.attr('action')){
|
||||
// case 'add':
|
||||
// // TODO: get target chutier
|
||||
// addToChutier($this);
|
||||
// break;
|
||||
// case 'remove':
|
||||
// // TODO: if we use more than one chutoer per user get target chutier
|
||||
// removeFromChutier($this);
|
||||
// break;
|
||||
// }
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -51,6 +40,12 @@
|
||||
|
||||
function onActionToChutierDone($link, data){
|
||||
console.log('onActionToChutierDone',data);
|
||||
$('body').trigger({
|
||||
'type':'chutier-action-done',
|
||||
'action_done':data.action_done,
|
||||
'new_action':data.action_done == 'add' ? 'remove' : 'add',
|
||||
'target_id':$link.attr('target_id'),
|
||||
});
|
||||
$link.replaceWith(data.new_link);
|
||||
initAjax();
|
||||
};
|
||||
|
||||
@@ -97,6 +97,7 @@ class ChutierController extends ControllerBase {
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'new_link' => $new_link,
|
||||
'action_done' => $action,
|
||||
);
|
||||
$response->setData($data);
|
||||
return $response;
|
||||
|
||||
@@ -284,7 +284,7 @@ class Chutier extends ContentEntityBase implements ChutierInterface {
|
||||
);
|
||||
$url = Url::fromRoute('edlp_studio.chutier_controller_ajax_add_content', $args, array(
|
||||
'attributes' => array(
|
||||
'class' => ['chutier-link','chutier-ajax-link'],
|
||||
'class' => ['chutier-icon','chutier-link','chutier-ajax-link'],
|
||||
'action' => $action,
|
||||
'target_id' => $id,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user