Compare commits

..
2 Commits
Author SHA1 Message Date
bachir 41717783ac agenda dates displaying ok 2018-04-23 23:35:26 +02:00
bachir bf0dade005 corpus map evolution zone linked to visible space left by modals 2018-04-23 22:38:02 +02:00
18 changed files with 7646 additions and 197 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1 +1,71 @@
canvas#corpus-map{position:absolute;-webkit-box-sizing:border-box;box-sizing:border-box;top:0;left:0;z-index:0}canvas#corpus-map.de-activated{background-color:#f4f4f4}div.node-popup{z-index:10;position:absolute;-webkit-box-sizing:content-box;box-sizing:content-box;width:300px;min-height:30px;top:60%;left:30%;pointer-events:none}div.node-popup .inner{padding:.6em;outline:red solid 1px;background-color:#fff}div.node-popup:before{content:"";position:absolute;width:60px;height:0;border-top:1px solid red}div.node-popup[pos=bottom-right]{-webkit-transform:translateY(42px) translateX(42px);transform:translateY(42px) translateX(42px)}div.node-popup[pos=bottom-right]:before{top:-1px;left:-61px;-webkit-transform-origin:bottom right;transform-origin:bottom right;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}div.node-popup[pos=bottom-left]{-webkit-transform:translateX(-100%) translateY(42px) translateX(-42px);transform:translateX(-100%) translateY(42px) translateX(-42px)}div.node-popup[pos=bottom-left]:before{top:calc(100% +1px);left:100%;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}div.node-popup[pos=top-left]{-webkit-transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px);transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px)}div.node-popup[pos=top-left]:before{bottom:0;left:100%;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}div.node-popup[pos=top-right]{-webkit-transform:translateY(-100%) translateY(-42px) translateX(42px);transform:translateY(-100%) translateY(-42px) translateX(42px)}div.node-popup[pos=top-right]:before{top:calc(100% + 1px);left:-61px;-webkit-transform-origin:top right;transform-origin:top right;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}
canvas#corpus-map {
position: absolute;
-webkit-box-sizing: border-box;
box-sizing: border-box;
top: 0;
left: 0;
z-index: 0; }
canvas#corpus-map.de-activated {
background-color: #f4f4f4; }
div.node-popup {
z-index: 10;
position: absolute;
-webkit-box-sizing: content-box;
box-sizing: content-box;
width: 300px;
min-height: 30px;
pointer-events: none;
top: 60%;
left: 30%;
pointer-events: none; }
div.node-popup .inner {
padding: 0.6em;
outline: 1px solid red;
background-color: white; }
div.node-popup:before {
content: "";
position: absolute;
width: 60px;
height: 0;
border-top: 1px solid red; }
div.node-popup[pos="bottom-right"] {
-webkit-transform: translateY(42px) translateX(42px);
transform: translateY(42px) translateX(42px); }
div.node-popup[pos="bottom-right"]:before {
top: -1px;
left: -61px;
-webkit-transform-origin: bottom right;
transform-origin: bottom right;
-webkit-transform: rotateZ(45deg);
transform: rotateZ(45deg); }
div.node-popup[pos="bottom-left"] {
-webkit-transform: translateX(-100%) translateY(42px) translateX(-42px);
transform: translateX(-100%) translateY(42px) translateX(-42px); }
div.node-popup[pos="bottom-left"]:before {
top: calc(100% +1px);
left: 100%;
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-transform: rotateZ(-45deg);
transform: rotateZ(-45deg); }
div.node-popup[pos="top-left"] {
-webkit-transform: translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px);
transform: translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px); }
div.node-popup[pos="top-left"]:before {
bottom: 0;
left: 100%;
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-transform: rotateZ(45deg);
transform: rotateZ(45deg); }
div.node-popup[pos="top-right"] {
-webkit-transform: translateY(-100%) translateY(-42px) translateX(42px);
transform: translateY(-100%) translateY(-42px) translateX(42px); }
div.node-popup[pos="top-right"]:before {
top: calc(100% + 1px);
left: -61px;
-webkit-transform-origin: top right;
transform-origin: top right;
-webkit-transform: rotateZ(-45deg);
transform: rotateZ(-45deg); }
@@ -26,8 +26,8 @@
var _ctx = _canvas.getContext('2d');
var _dpi = window.devicePixelRatio;
var _scene_props = {
width:0,
height:0,
width:window.innerWidth,
height:window.innerHeight,
// 'margin_top':90, // with red border on head
'margin_top':75, // without red border on head
// 'margin_top':0,
@@ -36,6 +36,12 @@
// 'margin_bottom':0,
'margin_left':0
};
var _evolution_zone = {
left:_scene_props.width/4,
right:_scene_props.width - _scene_props.width/4,
center:_scene_props.width/2,
};
var _physics = new Physics();
var _nodes = [];
var _articles_nodes = [];
@@ -102,12 +108,15 @@
_canvas.height = _scene_props.height*_dpi;
_ctx.scale(_dpi, _dpi);
moveEvolutionZone();
if(_loaded){
for (var i = 0; i < _nodes.length; i++) {
_nodes[i].onResizeCanvas();
}
// move _attracter and _repulser to their right places again
resizePhysics();
// moveEvolutionZone() will trigger resizePhysics()
// resizePhysics();
}
};
@@ -161,7 +170,9 @@
};
function resizePhysics(){
// attracters
_attracter.position = {x:_scene_props.width/2, y:_scene_props.height/2};
if(typeof _attracter != 'undefined'){
_attracter.position = {x:_evolution_zone.center, y:_scene_props.height/2};
}
};
// _ _ _
@@ -479,7 +490,10 @@
this.p.velocity.multiplyScalar(0.99); // 0.995
}
}
if( Math.abs(_attracter.position.x - this.x) > _scene_props.width/4
// limit evolution zone
// if( Math.abs(_attracter.position.x - this.x) > _scene_props.width/4
// || Math.abs(_attracter.position.y - this.y) > _scene_props.height/4){
if( this.x < _evolution_zone.left || this.x > _evolution_zone.right
|| Math.abs(_attracter.position.y - this.y) > _scene_props.height/4){
this.attract.on = true;
}else{
@@ -731,6 +745,23 @@
// console.log('_physics.attractions.length', _physics.attractions.length);
};
// ___ _ _ _ ____
// | __|_ _____| |_ _| |_(_)___ _ _ |_ /___ _ _ ___
// | _|\ V / _ \ | || | _| / _ \ ' \ / // _ \ ' \/ -_)
// |___|\_/\___/_|\_,_|\__|_\___/_||_| /___\___/_||_\___|
function moveEvolutionZone(l, r){
var left = l || 0;
var right = r || 0;
_evolution_zone.left = Math.max(_scene_props.width/5, left+20);
_evolution_zone.right = Math.min(_scene_props.width - _scene_props.width/5, _scene_props.width-right+20);
_evolution_zone.center = _evolution_zone.left + (_evolution_zone.right - _evolution_zone.left)/2;
// move _attracter to the center of the zone
resizePhysics();
}
// ___ _ ___ _ _ _ _
// | _ \__ _ _ _ __| |___ _ __ | _ \ |__ _ _ _| (_)__| |_
// | / _` | ' \/ _` / _ \ ' \ | _/ / _` | || | | (_-< _|
@@ -1050,6 +1081,10 @@
.parents('.item-list').removeClass('opened');
scrambleCollection();
}
})
.on('visible-space-changed', function(e){
// limits are absolute distance from each side (not positions from left)
moveEvolutionZone(e.left_limit, e.right_limit);
});
};
@@ -1,4 +1,125 @@
(function ($, Drupal, drupalSettings) {
(function($,Drupal,drupalSettings){var settings=drupalSettings.edlp_search;var _$body=$('body');var _$container;var _$form;function init(){initEvents();initAjax();};function initEvents(){$('body').on('new-content-ajax-loaded',initAjax).on('edlp_search_search_form-col-closed',onSearchClosed);};function initAjax(){_$form=$('#edlp-search-form:not(.ajax-enabled)');if(!_$form.length)return false;_$form=$('#edlp-search-form:not(.ajax-enabled)').on('submit',onSubmitForm).addClass('ajax-enabled');_$container=_$form.parents('.row');if(!_$container.length){_$container=_$form.parent();}};function onSubmitForm(e){e.preventDefault();var args={};args.keys=$('input[type="search"]',this).val();args.entries=[];$('input[type="checkbox"]:checked','#edit-entries').each(function(index,el){args.entries.push($(this).val());});args.langues=$('input[name="language"]',this).val();args.genres=$('input[name="genres"]',this).val();loadResults(args);return false;};function loadResults(args){_$form.addClass('ajax-loading');_$body.addClass('ajax-loading');$('[theme="edlp_search_results"]',_$container).addClass('ajax-loading');var path=window.location.origin+drupalSettings.path.baseUrl+settings.results_ajax_url;$.getJSON(path,args).done(function(data){onResultsLoaded(data);}).fail(function(jqxhr,textStatus,error){onResultsLoadFail(jqxhr,textStatus,error);});};function onResultsLoaded(data){_$form.removeClass('ajax-loading');_$body.removeClass('ajax-loading');$prev_results=$('[theme="edlp_search_results"]',_$container);if($prev_results.length){$prev_results.replaceWith(data.rendered);}else{_$container.append(data.rendered);}
_$body.trigger({'type':'search-results-loaded','results':data.results_nids});if(typeof _paq!=='undefined'){var search_name=data.keys+';'+data.langues+';'+data.genres+';'+data.entry_names.join(',');_paq.push(['trackSiteSearch',search_name,'search',data.results_nids.length]);}};function onResultsLoadFail(jqxhr,textStatus,error){void 0;};function onSearchClosed(e){$('div[theme="edlp_search_results"]').remove();_$body.trigger({'type':'search-closed'});}
init();})(jQuery,Drupal,drupalSettings);
var settings = drupalSettings.edlp_search;
var _$body = $('body');
var _$container;
var _$form;
function init(){
// console.log('EdlpSearch Init', settings);
initEvents();
initAjax();
};
function initEvents(){
$('body')
.on('new-content-ajax-loaded', initAjax)
.on('edlp_search_search_form-col-closed', onSearchClosed);
};
function initAjax(){
_$form = $('#edlp-search-form:not(.ajax-enabled)');
if(!_$form.length) return false;
//console.log('EdlpSearch initAjaxForm()');
_$form = $('#edlp-search-form:not(.ajax-enabled)')
.on('submit', onSubmitForm)
.addClass('ajax-enabled');
_$container = _$form.parents('.row');
if(!_$container.length){
_$container = _$form.parent();
}
};
function onSubmitForm(e){
e.preventDefault();
// console.log('onSubmitForm',e);
var args = {};
// search for key words
args.keys = $('input[type="search"]', this).val();
// entries filter
args.entries = [];
$('input[type="checkbox"]:checked', '#edit-entries').each(function(index, el) {
args.entries.push($(this).val());
});
// langues
args.langues = $('input[name="language"]', this).val();
// genres
args.genres = $('input[name="genres"]', this).val();
//console.log('EdlpSearch onSubmitForm() : args',args);
loadResults(args);
return false;
};
function loadResults(args){
//console.log('EdlpSearch loadResults() : args', args);
_$form.addClass('ajax-loading');
_$body.addClass('ajax-loading');
$('[theme="edlp_search_results"]', _$container).addClass('ajax-loading');
var path = window.location.origin + drupalSettings.path.baseUrl +settings.results_ajax_url;
$.getJSON(path, args)
.done(function(data){
onResultsLoaded(data);
})
.fail(function(jqxhr, textStatus, error){
onResultsLoadFail(jqxhr, textStatus, error);
});
};
function onResultsLoaded(data){
// console.log('EdlpSearch onResultsLoaded()', data);
_$form.removeClass('ajax-loading');
_$body.removeClass('ajax-loading');
// insert results col
$prev_results = $('[theme="edlp_search_results"]', _$container);
if($prev_results.length){
$prev_results.replaceWith(data.rendered);
}else{
_$container.append(data.rendered);
}
// trigger event
_$body.trigger({
'type':'search-results-loaded',
'results':data.results_nids
});
// piwik
if(typeof _paq !== 'undefined'){
// page tracking
// https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/
// _paq.push(['setCustomUrl', state.url]);
// _paq.push(['setDocumentTitle', data.title]);
// _paq.push(['trackPageView']);
// trackEvent(category, action, [name], [value])
var search_name = data.keys+';'+data.langues+';'+data.genres+';'+data.entry_names.join(',');
// _paq.push(['trackEvent', 'AjaxSearch', 'Results', search_name, data.results_nids.length]);
// piwik track searches
// trackSiteSearch(keyword, [category], [resultsCount])
_paq.push(['trackSiteSearch', search_name, 'search', data.results_nids.length]);
}
};
function onResultsLoadFail(jqxhr, textStatus, error){
console.warn('EdlpSearch : search results ajax load failed : '+error, jqxhr.responseText);
};
function onSearchClosed(e){
// console.log('Edlp Search onSearchClosed()');
$('div[theme="edlp_search_results"]').remove();
// trigger event
_$body.trigger({'type':'search-closed'});
}
init();
})(jQuery, Drupal, drupalSettings);
@@ -1,10 +1,408 @@
(function ($, Drupal, drupalSettings) {
(function($,Drupal,drupalSettings){var _settings=drupalSettings.edlp_studio;var $composer;function init(){initEvents();initStudio();};function initEvents(){$('body').on('new-audio-cartel-loaded',initAjaxChutierLinks).on('new-content-ajax-loaded',initStudio).on('all-modal-closed',initStudio);};function initStudio(){if($('#studio-ui').length){$composer=$('.composition_ui .composer','#studio-ui');initAjaxChutierLinks();initAjaxCompoLinks();initDragAndDropUI();$('body').trigger({'type':'studio-initialized'});}else{$('body').trigger({'type':'studio-not-active'});}}
function initAjaxChutierLinks(){$('.chutier-ajax-link:not(.ajax-enabled)').addClass('ajax-enabled').on('click',onClickChutierAjaxLink);};function onClickChutierAjaxLink(e){e.preventDefault();addRemoveToChutier($(this));return false;};function addRemoveToChutier($link){var ajax_path=$link.attr('data-drupal-link-system-path');var path=window.location.origin+drupalSettings.path.baseUrl+ajax_path;$link.addClass('ajax-loading');$.getJSON(path,{}).done(function(data){onActionToChutierDone($link,data);}).fail(function(jqxhr,textStatus,error){onErrorActionToChutier(jqxhr,textStatus,error,$link);});};function onActionToChutierDone($link,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);initAjaxChutierLinks();updateStudioChutier();};function onErrorActionToChutier(jqxhr,textStatus,error,$link){void 0;};function initAjaxCompoLinks(){$('.new-composition-link:not(.ajax-enabled)').on('click',onClickNewCompoLink).addClass('ajax-enabled');$('.composition-link:not(.ajax-enabled)').on('click',onClickCompoLink).addClass('ajax-enabled');$('.delete-composition-link:not(.ajax-enabled)').on('click',onClickDeleteCompoLink).addClass('ajax-enabled');};function onClickCompoLink(e){e.preventDefault();openCompo($(this));return false;};function openCompo($link){var cid=$link.attr('cid');var ajax_path=_settings.open_compo_ajax_url+'/'+cid;var path=window.location.origin+Drupal.url(ajax_path);$link.addClass('ajax-loading');$composer.addClass('ajax-loading');$.getJSON(path,{}).done(function(data){onOpenCompoDone(data,$link);}).fail(function(jqxhr,textStatus,error){onErrorOpenCompo(jqxhr,textStatus,error,$link);});};function onOpenCompoDone(data,$link){$('.composition-link').removeClass('is-active');$link.removeClass('ajax-loading').addClass('is-active');if($('.composition',$composer).length){$('.composition',$composer).replaceWith(data.compo);}else{$('header',$composer).after(data.compo);}
$composer.removeClass('ajax-loading');initDragAndDropUI();$('body').trigger({'type':'on-studio-compo-opened'});};function onErrorOpenCompo(jqxhr,textStatus,error,$link){$link.removeClass('ajax-loading');void 0;};function onClickNewCompoLink(e){e.preventDefault();setInputForNewCompoName($(this));return false;};function setInputForNewCompoName($link){var $form=$('<form>').addClass('new-compo-form').append($('<input>').attr('type','text').attr('placeholder','new name')).append($('<button>').attr('type','submit').html('+')).submit(function(e){onNewCompoFormSubmit(e,$link,$(this));});$link.after($form).addClass('folded');$form.children('input[type="text"]').focus();};function onNewCompoFormSubmit(e,$link,$form){var name=$('input[type="text"]',$form).val();if(name!=''){$form.addClass('ajax-loading').children('*').attr('disabled','disabled');createNewCompo(name,$link,$form);}
e.preventDefault();};function createNewCompo(name,$link,$form){var ajax_path=$link.attr('data-drupal-link-system-path');var path=window.location.origin+drupalSettings.path.baseUrl+ajax_path;$.getJSON(path,{'new_name':name}).done(function(data){onCreateCompoDone(data,$link,$form);}).fail(function(jqxhr,textStatus,error){onErrorCreateCompo(jqxhr,textStatus,error,$link);});};function onCreateCompoDone(data,$link,$form){var $new_link=$(data.new_link);var $delete_link=$(data.delete_link);$link.removeClass('folded').parents('li').before($('<li>').append($new_link).append($delete_link));$form.remove();initAjaxCompoLinks();openCompo($new_link);};function onErrorCreateCompo(jqxhr,textStatus,error,$link){void 0;};function onClickDeleteCompoLink(e){e.preventDefault();deleteCompo($(this));return false;};function deleteCompo($link){var ajax_path=$link.attr('data-drupal-link-system-path');var path=window.location.origin+Drupal.url(ajax_path);$link.parents('li').addClass('ajax-loading');$.getJSON(path,{}).done(function(data){onDeleteCompoDone(data,$link);}).fail(function(jqxhr,textStatus,error){onErrorDeleteCompo(jqxhr,textStatus,error,$link);});};function onDeleteCompoDone(data,$link,$form){if(data.status=="ok"){$link.parents('li').remove();if($('.composition-link').length){openCompo($('.composition-link').eq(0));}else{$('.composition',$composer).html();}}else{void 0;}};function onErrorDeleteCompo(jqxhr,textStatus,error,$link){$link.parents('li').removeClass('ajax-loading');void 0;};function updateStudioChutier(){$studioChutier=$('#studio-ui .chutier_ui');if($studioChutier.length){var ajax_path=_settings.chutier_ui_ajax;var path=window.location.origin+drupalSettings.path.baseUrl+ajax_path;$studioChutier.addClass('loading');$.getJSON(path,{}).done(function(data){onLoadedChutier($studioChutier,data);}).fail(function(jqxhr,textStatus,error){onLoadChutierError(jqxhr,textStatus,error,$studioChutier);});}};function onLoadedChutier($studioChutier,data){$studioChutier.replaceWith(data.rendered);initAjaxChutierLinks();setChutierDraggable();$('body').trigger({'type':'on-studio-chutier-updated'});}
function onLoadChutierError(jqxhr,textStatus,error,$studioChutier){void 0;$studioChutier.removeClass('loading');}
function initDragAndDropUI(){if(!$('.composition_ui .composer .composition .field--name-documents').length){$field_documents=$('<div>').addClass('field').addClass('field--name-documents').appendTo('.composition_ui .composer .composition');}else{$field_documents=$('.composition_ui .composer .composition .field--name-documents');$('.field__item',$field_documents).each(function(i){$(this).prepend($('<span>').addClass('handler'));});}
var $remove_zone=$('<div>').addClass('remove-drop-zone').appendTo('.composition_ui .composer .composition').droppable({tolerance:'pointer',over:function(e,ui){ui.draggable.addClass('ready-to-remove');},out:function(e,ui){ui.draggable.removeClass('ready-to-remove');},drop:function(e,ui){ui.draggable.remove();}});$field_documents.sortable({revert:false,handle:".handler",receive:function(e,ui){$('.field__item',this).attr('style','');},update:function(e,ui){onOrderChanged(e,ui);},connectWith:$remove_zone,});setChutierDraggable();};function setChutierDraggable(){$('.chutier_ui .item-list li>div').draggable({containment:$('#studio-ui'),scroll:false,helper:function(e){return $('<div>').addClass('field__item').append($('<article>').addClass('node').append($('<h2>').addClass('node-title').append($('.audio-link',this).clone().removeClass('ajax-enable')))).prepend($('<span>').addClass('handler'));},cursorAt:{bottom:10,left:10},zIndex:999,revert:true,revertDuration:0,connectToSortable:$('.composition_ui .composer .composition .field--name-documents'),});}
function onOrderChanged(e,ui){var cid=$(e.target).parents('.composition').attr('cid');var documents={};$('a',e.target).each(function(i){documents[i]=$(this).attr('nid');});recordCompoList(cid,documents);};function recordCompoList(cid,docs){var ajax_path=_settings.save_compo_ajax_url+'/'+cid;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{documents:docs}).done(function(data){onRecordCompoDone(data);}).fail(function(jqxhr,textStatus,error){onErrorRecordCompo(jqxhr,textStatus,error);});$('body').trigger({'type':'on-studio-compo-updated'});}
function onRecordCompoDone(data){if(data.status=="ok"){}else{void 0;}};function onErrorRecordCompo(jqxhr,textStatus,error){void 0;};init();})(jQuery,Drupal,drupalSettings);
var _settings = drupalSettings.edlp_studio;
var $composer;
// audio play is handled by edlp_theme
function init(){
// console.log('Studio Init');
initEvents();
initStudio();
};
function initEvents(){
$('body')
.on('new-audio-cartel-loaded', initAjaxChutierLinks)
.on('new-content-ajax-loaded', initStudio)
.on('all-modal-closed', initStudio);
};
function initStudio(){
if($('#studio-ui').length){
$composer = $('.composition_ui .composer', '#studio-ui');
initAjaxChutierLinks();
initAjaxCompoLinks();
initDragAndDropUI();
$('body').trigger({'type':'studio-initialized'});
}else{
$('body').trigger({'type':'studio-not-active'});
}
}
// ___ _ _ _ _ _ _ _ _ _
// / __| |_ _ _| |_(_)___ _ _ | \| |___ __| |___ | | (_)_ _ | |__ ___
// | (__| ' \ || | _| / -_) '_| | .` / _ \/ _` / -_) | |__| | ' \| / /(_-<
// \___|_||_\_,_|\__|_\___|_| |_|\_\___/\__,_\___| |____|_|_||_|_\_\/__/
function initAjaxChutierLinks(){
//console.log('studio initAjaxChutierLinks');
$('.chutier-ajax-link:not(.ajax-enabled)')
.addClass('ajax-enabled')
.on('click', onClickChutierAjaxLink);
};
function onClickChutierAjaxLink(e){
//console.log('studio onClickAjaxLink chutier');
e.preventDefault();
addRemoveToChutier($(this));
return false;
};
function addRemoveToChutier($link){
// var ajax_path = 'edlp_studio/ajax/chutier/add/'+id; // + '/' +cid;
var ajax_path = $link.attr('data-drupal-link-system-path');
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
$link.addClass('ajax-loading');
$.getJSON(path, {})
.done(function(data){
onActionToChutierDone($link, data);
})
.fail(function(jqxhr, textStatus, error){
onErrorActionToChutier(jqxhr, textStatus, error, $link);
});
};
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);
initAjaxChutierLinks();
// reload Studio chutier_ui's documents list
updateStudioChutier();
};
function onErrorActionToChutier(jqxhr, textStatus, error, $link){
console.warn('action to chuttier load failed : '+error, jqxhr.responseText);
};
// ___ _ _ _
// / __|___ _ __ _ __ ___ __(_) |_(_)___ _ _ ___
// | (__/ _ \ ' \| '_ \/ _ (_-< | _| / _ \ ' \(_-<
// \___\___/_|_|_| .__/\___/__/_|\__|_\___/_||_/__/
// |_|
function initAjaxCompoLinks(){
//console.log('studio initAjaxCompoLinks');
$('.new-composition-link:not(.ajax-enabled)')
.on('click', onClickNewCompoLink)
.addClass('ajax-enabled');
$('.composition-link:not(.ajax-enabled)')
.on('click', onClickCompoLink)
.addClass('ajax-enabled');
$('.delete-composition-link:not(.ajax-enabled)')
.on('click', onClickDeleteCompoLink)
.addClass('ajax-enabled');
};
// ___ ___
// / _ \ _ __ ___ _ _ / __|___ _ __ _ __ ___
// | (_) | '_ \/ -_) ' \ | (__/ _ \ ' \| '_ \/ _ \
// \___/| .__/\___|_||_| \___\___/_|_|_| .__/\___/
// |_| |_|
function onClickCompoLink(e){
e.preventDefault();
//console.log('onClickCompoLink');
openCompo($(this));
return false;
};
function openCompo($link){
var cid = $link.attr('cid');
var ajax_path = _settings.open_compo_ajax_url+'/'+cid;
var path = window.location.origin + Drupal.url(ajax_path);
$link.addClass('ajax-loading');
$composer.addClass('ajax-loading');
$.getJSON(path, {})
.done(function(data){
onOpenCompoDone(data, $link);
})
.fail(function(jqxhr, textStatus, error){
onErrorOpenCompo(jqxhr, textStatus, error, $link);
});
};
function onOpenCompoDone(data, $link){
//console.log('onActionToCompoDone',data);
$('.composition-link').removeClass('is-active');
$link.removeClass('ajax-loading').addClass('is-active');
if($('.composition', $composer).length){
$('.composition', $composer).replaceWith(data.compo);
}else{
$('header', $composer).after(data.compo);
}
$composer.removeClass('ajax-loading');
initDragAndDropUI();
$('body').trigger({
'type':'on-studio-compo-opened'
});
};
function onErrorOpenCompo(jqxhr, textStatus, error, $link){
$link.removeClass('ajax-loading');
console.warn('open compo load failed : '+error, jqxhr.responseText);
};
// _ _ _____ __ __ __ ___ _ __ _ __ ___
// | ' \/ -_) V V / / _/ _ \ ' \| '_ \/ _ \
// |_||_\___|\_/\_/ \__\___/_|_|_| .__/\___/
// |_|
function onClickNewCompoLink(e){
e.preventDefault();
setInputForNewCompoName($(this));
return false;
};
function setInputForNewCompoName($link){
var $form = $('<form>').addClass('new-compo-form')
.append($('<input>').attr('type', 'text').attr('placeholder', 'new name'))
.append($('<button>').attr('type', 'submit').html('+'))
.submit(function(e){
onNewCompoFormSubmit(e, $link, $(this));
});
$link
.after($form)
.addClass('folded');
$form.children('input[type="text"]').focus();
};
function onNewCompoFormSubmit(e, $link, $form){
var name = $('input[type="text"]',$form).val();
//console.log('onNewCompoFormSubmit', name);
if(name != ''){
$form.addClass('ajax-loading').children('*').attr('disabled', 'disabled');
createNewCompo(name, $link, $form);
}
e.preventDefault();
};
function createNewCompo(name,$link, $form){
var ajax_path = $link.attr('data-drupal-link-system-path');
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
// $link.addClass('ajax-loading');
$.getJSON(path, {
'new_name':name
})
.done(function(data){
onCreateCompoDone(data, $link, $form);
})
.fail(function(jqxhr, textStatus, error){
onErrorCreateCompo(jqxhr, textStatus, error, $link);
});
};
function onCreateCompoDone(data, $link, $form){
//console.log('onActionToCompoDone',data);
var $new_link = $(data.new_link);
var $delete_link = $(data.delete_link);
$link
.removeClass('folded')
.parents('li')
.before($('<li>').append($new_link).append($delete_link));
$form.remove();
// open new composition to composer
initAjaxCompoLinks();
openCompo($new_link);
};
function onErrorCreateCompo(jqxhr, textStatus, error, $link){
console.warn('action to compo load failed : '+error, jqxhr.responseText);
};
// ___ _ _
// | \ ___| |___| |_ ___ __ ___ _ __ _ __ ___
// | |) / -_) / -_) _/ -_) / _/ _ \ ' \| '_ \/ _ \
// |___/\___|_\___|\__\___| \__\___/_|_|_| .__/\___/
// |_|
function onClickDeleteCompoLink(e){
e.preventDefault();
// TODO: confirm compo deletion
deleteCompo($(this));
return false;
};
function deleteCompo($link){
var ajax_path = $link.attr('data-drupal-link-system-path');
var path = window.location.origin + Drupal.url(ajax_path);
$link.parents('li').addClass('ajax-loading');
$.getJSON(path, {})
.done(function(data){
onDeleteCompoDone(data, $link);
})
.fail(function(jqxhr, textStatus, error){
onErrorDeleteCompo(jqxhr, textStatus, error, $link);
});
};
function onDeleteCompoDone(data, $link, $form){
//console.log('onDeleteCompoDone',data);
if(data.status == "ok"){
$link.parents('li').remove();
//console.log("$('.composition-link').length", $('.composition-link').length);
if($('.composition-link').length){
openCompo($('.composition-link').eq(0));
}else{
$('.composition', $composer).html();
}
}else{
console.warn(data.message);
}
};
function onErrorDeleteCompo(jqxhr, textStatus, error, $link){
$link.parents('li').removeClass('ajax-loading');
console.warn('delete compo load failed : '+error, jqxhr.responseText);
};
// ___ _ _ _ _
// / __| |_ _ _ __| (_)___ ___ _ _(_)
// \__ \ _| || / _` | / _ \___| || | |
// |___/\__|\_,_\__,_|_\___/ \_,_|_|
// this seems dirty
function updateStudioChutier(){
$studioChutier = $('#studio-ui .chutier_ui');
if($studioChutier.length){
var ajax_path = _settings.chutier_ui_ajax;
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
$studioChutier.addClass('loading');
$.getJSON(path, {})
.done(function(data){
onLoadedChutier($studioChutier, data);
})
.fail(function(jqxhr, textStatus, error){
onLoadChutierError(jqxhr, textStatus, error, $studioChutier);
});
}
};
function onLoadedChutier($studioChutier, data){
$studioChutier.replaceWith(data.rendered);
initAjaxChutierLinks();
// set chutier element draggable again
setChutierDraggable();
$('body').trigger({
'type':'on-studio-chutier-updated'
});
}
function onLoadChutierError(jqxhr, textStatus, error, $studioChutier){
console.warn('Chutier load failed', jqxhr.responseText);
$studioChutier.removeClass('loading');
}
// ___ __ ___ _ _ ___
// | \ _ _ __ _ __ _ / _|___ | \ _ _ ___ _ __ | | | |_ _|
// | |) | '_/ _` / _` | > _|_ _| | |) | '_/ _ \ '_ \ | |_| || |
// |___/|_| \__,_\__, | \_____| |___/|_| \___/ .__/ \___/|___|
// |___/ |_|
function initDragAndDropUI(){
// check if field--name-documents exists
if (!$('.composition_ui .composer .composition .field--name-documents').length) {
// if not create it
$field_documents = $('<div>')
.addClass('field').addClass('field--name-documents')
.appendTo('.composition_ui .composer .composition');
}else{
// add real dom square element to handle sorting
$field_documents = $('.composition_ui .composer .composition .field--name-documents'); $('.field__item', $field_documents).each(function(i){
$(this).prepend($('<span>').addClass('handler'));
});
}
// create remove dropzone
var $remove_zone = $('<div>').addClass('remove-drop-zone')
.appendTo('.composition_ui .composer .composition')
.droppable({
tolerance:'pointer',
// scope:'composition_ui',
over:function(e,ui){
// console.log('on over remove : ui', ui);
ui.draggable.addClass('ready-to-remove');
},
out:function(e,ui){
// console.log('on over remove : ui', ui);
ui.draggable.removeClass('ready-to-remove');
},
drop:function(e,ui){
// console.log('on drop remove : ui', ui);
ui.draggable.remove();
// onOrderChanged(ui);
}
});
// create sortable
$field_documents.sortable({
revert:false,
handle: ".handler",
receive:function(e, ui){
$('.field__item', this).attr('style', '');
// TODO: trigger event to enable new audiolink player
},
update:function(e, ui){
onOrderChanged(e, ui);
},
connectWith : $remove_zone,
});
// set chutier element draggable
setChutierDraggable();
};
function setChutierDraggable(){
$('.chutier_ui .item-list li>div').draggable({
containment:$('#studio-ui'),
scroll:false,
helper:function(e){
// we reproduce here the irem structure of destination sortable elements
// var $audio_link = $('.audio-link',this);
return $('<div>').addClass('field__item')
.append(
$('<article>').addClass('node').append(
$('<h2>').addClass('node-title').append(
// $('<a>')
// .attr('nid', $audio_link.attr('nid'))
// .html($audio_link.html())
$('.audio-link',this).clone().removeClass('ajax-enable')
)
)
)
.prepend($('<span>').addClass('handler'));
},
// cursor:'grab',
cursorAt:{bottom:10,left:10},
zIndex:999,
revert:true,
revertDuration:0,
connectToSortable:$('.composition_ui .composer .composition .field--name-documents'),
});
}
function onOrderChanged(e, ui){
//console.log('onOrderChanged : e', e);
var cid = $(e.target).parents('.composition').attr('cid');
var documents = {};
$('a', e.target).each(function(i) {
// console.log(this);
documents[i] = $(this).attr('nid');
});
// console.log(documents);
recordCompoList(cid, documents);
};
function recordCompoList(cid, docs){
//console.log('recordCompoList '+cid, docs);
var ajax_path = _settings.save_compo_ajax_url+'/'+cid;
var path = window.location.origin + Drupal.url(ajax_path);
//console.log('path', path);
$.getJSON(path, {
documents:docs
})
.done(function(data){
onRecordCompoDone(data);
})
.fail(function(jqxhr, textStatus, error){
onErrorRecordCompo(jqxhr, textStatus, error);
});
$('body').trigger({
'type':'on-studio-compo-updated'
});
}
function onRecordCompoDone(data){
//console.log('onDeleteCompoDone',data);
if(data.status == "ok"){
}else{
console.warn(data.message);
}
};
function onErrorRecordCompo(jqxhr, textStatus, error){
console.warn('record compo failed : '+error, jqxhr.responseText);
};
init();
})(jQuery, Drupal, drupalSettings);
@@ -1,2 +1,20 @@
console.log('EDLP THEME HISTORY.js');
// var edlp is provided by edlp_ajax.module file
if(edlp.redirect){
console.log('history redirect', edlp);
console.log('window.location', window.location);
// window.localStorage.setItem('edlp_origin_path', edlp.sys_path.replace(/^\//, ''));
edlp.sys_path = edlp.sys_path.replace(/^\//, '');
void 0;if(edlp.redirect){void 0;void 0;edlp.sys_path=edlp.sys_path.replace(/^\//,'');edlp.url=window.location.pathname;edlp.hash=window.location.hash;window.localStorage.setItem('edlp_origin',JSON.stringify(edlp));window.location.replace(window.location.origin+'/'+edlp.lang_code);}else{void 0;}
// window.localStorage.setItem('edlp_origin_url', window.location.pathname);
edlp.url = window.location.pathname;
// window.localStorage.setItem('edlp_origin_hash', window.location.hash);
edlp.hash = window.location.hash;
window.localStorage.setItem('edlp_origin', JSON.stringify(edlp));
// redirect to home
window.location.replace(window.location.origin+'/'+edlp.lang_code);
}else{
console.log('history do not redirect');
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -323,6 +323,8 @@
initAjaxLinks();
checkVisibleCorpusMapSpace();
// trigger other modules behaviours
_$body.trigger({'type':'new-content-ajax-loaded'});
@@ -407,6 +409,7 @@
// remove the col
$col.remove();
checkRowEmpty();
checkVisibleCorpusMapSpace();
};
// _ _ ___ _ _
@@ -604,7 +607,7 @@
return false;
}
// NOT USED (YET)
// NOT USED ( YET ? )
// if($link.is('.language-link')){
// TODO: change global site current language
// load all blocks translated (exepted language switcher) ... :/
@@ -648,7 +651,6 @@
// | (__/ _ \ '_| '_ \ || (_-<
// \___\___/_| | .__/\_,_/__/
// |_|
function onCorpusMapReady(e){
//console.log('theme : onCorpusReady', e);
_corpus_ready = true;
@@ -690,6 +692,40 @@
}
};
function checkVisibleCorpusMapSpace(){
var left_limit = 0, right_limit = 0;
_$row.find('.col').each(function(i,e){
var $col = $(this);
var offset = $col.offset();
switch(true){
case $col.is('.float-right'):
right_limit = Math.max(right_limit, Math.abs(offset.left-window.innerWidth));
break;
default:
left_limit = Math.max(left_limit, offset.left+$col.width());
break;
}
});
console.log('checkVisibleCorpusMapSpace left_limit:'+left_limit+" right_limit:"+right_limit);
if(_corpus_ready){
_$body.trigger({
type:'visible-space-changed',
left_limit:left_limit,
right_limit:right_limit
});
}else{
_corpus_promise.done(function(){
_$body.trigger({
type:'visible-space-changed',
left_limit:left_limit,
right_limit:right_limit
});
});
}
};
// _ _ _
// /_\ _ _ __| (_)___
// / _ \ || / _` | / _ \
@@ -1473,15 +1509,20 @@
};
function checkRowEmpty(){
// TODO: remove is-active class from index or notice entree links
// if row is empty and we are not in productions or entree notice|index call closeAllModals()
if(!$('.col', _$row).length && !_$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
backToFrontPage();
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
backToFrontPage();
}else{
// if we were on production page just scramble collection in case of map was filtered
_$corpus_canvas.trigger({'type':'scramble-collection'});
}
}else{
// if we were on production page just scramble collection in case of map was filtered
_$corpus_canvas.trigger({'type':'scramble-collection'});
// remove is-active class from index or notice entree links
$('.entree-content a.is-active').removeClass('is-active');
// TODO: remove the hash index or notice
}
}
};
@@ -348,7 +348,19 @@ main[role="main"]{
@include content_courant;
}
}
}
article.node--type-evenement.node--view-mode-teaser{
.field--name-field-page-liee{
@include content_subtitles;
}
.field--name-field-date{
@include content_courant;
}
.field--name-title{
@include content_courant;
}
// .field--name-body{}
}
div.taxonomy-term{
@@ -439,6 +451,8 @@ main[role="main"]{
}
}
img{
max-width: 100%;
height: auto;
@@ -1,15 +1,8 @@
<div class="col small-col-12 med-col-4 large-col-3 ">
<div class="col small-col-12 med-col-4 large-col-3 float-right">
<div class="wrapper">
<div class="agenda">
{{ coming_events }}
{{ past_events }}
</div>
</div>
</div>
<div class="col small-col-12 med-col-8 large-col-5 event float-right">
<div class="wrapper">
<div class="agenda">
{{ next_event }}
{{ coming_events }}
{{ past_events }}
</div>
</div>
</div>
@@ -0,0 +1,94 @@
{#
/**
* @file
* Theme override to display a node.
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - node.getCreatedTime() will return the node creation timestamp.
* - node.hasField('field_example') returns TRUE if the node bundle includes
* field_example. (This does not indicate the presence of a value in this
* field.)
* - node.isPublished() will return whether the node is published or not.
* Calling other methods, such as node.delete(), will result in an exception.
* See \Drupal\node\Entity\Node for a full list of public properties and
* methods for the node object.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - author_picture: The node author user entity, rendered using the "compact"
* view mode.
* - metadata: Metadata for this node.
* - date: Themed creation date field.
* - author_name: Themed author name field.
* - url: Direct URL of the current node.
* - display_submitted: Whether submission information should be displayed.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - node: The current template type (also known as a "theming hook").
* - node--type-[type]: The current node type. For example, if the node is an
* "Article" it would result in "node--type-article". Note that the machine
* name will often be in a short form of the human readable label.
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
* teaser would result in: "node--view-mode-teaser", and
* full: "node--view-mode-full".
* The following are controlled through the node publishing options.
* - node--promoted: Appears on nodes promoted to the front page.
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
* teaser listings.
* - node--unpublished: Appears on unpublished nodes visible only to site
* admins.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main
* content tag that appears in the template.
* - author_attributes: Same as attributes, except applied to the author of
* the node tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
* - view_mode: View mode; for example, "teaser" or "full".
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_node()
*
* @todo Remove the id attribute (or make it a class), because if that gets
* rendered twice on a page this is invalid CSS for example: two lists
* in different view modes.
*/
#}
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
]
%}
{{ attach_library('classy/node') }}
<article{{ attributes.addClass(classes) }}>
{{ content.field_page_liee }}
{{ content.field_date }}
{{ label }}
{{ content|without('field_page_liee')|without('field_date') }}
</article>
@@ -0,0 +1,15 @@
<div class="col small-col-12 med-col-4 large-col-3 ">
<div class="wrapper">
<div class="agenda">
{{ coming_events }}
{{ past_events }}
</div>
</div>
</div>
<div class="col small-col-12 med-col-8 large-col-5 event float-right">
<div class="wrapper">
<div class="agenda">
{{ next_event }}
</div>
</div>
</div>
@@ -20,13 +20,13 @@ mode: aside
content:
body:
type: text_default
weight: 2
weight: 1
region: content
label: hidden
settings: { }
third_party_settings: { }
field_date:
weight: 1
weight: 0
label: hidden
settings:
timezone_override: ''
@@ -35,12 +35,8 @@ content:
third_party_settings: { }
type: daterange_custom
region: content
links:
weight: 0
region: content
settings: { }
third_party_settings: { }
hidden:
field_page_liee: true
field_workflow_generic: true
langcode: true
links: true
@@ -35,7 +35,7 @@ content:
type: daterange_custom
region: content
field_page_liee:
weight: 3
weight: 0
label: hidden
settings:
link: true
@@ -43,7 +43,7 @@ content:
type: entity_reference_label
region: content
links:
weight: 0
weight: 3
region: content
settings: { }
third_party_settings: { }
@@ -21,7 +21,7 @@ content:
body:
label: hidden
type: text_default
weight: 3
weight: 2
settings: { }
third_party_settings: { }
region: content
@@ -32,7 +32,7 @@ content:
label: hidden
settings:
timezone_override: ''
date_format: 'l j F Y G\hi'
date_format: 'l j F Y'
separator: '-'
third_party_settings: { }
field_page_liee:
@@ -41,13 +41,9 @@ content:
region: content
label: hidden
settings:
link: false
third_party_settings: { }
links:
weight: 2
region: content
settings: { }
link: true
third_party_settings: { }
hidden:
field_workflow_generic: true
langcode: true
links: true
+36 -8
View File
@@ -1,10 +1,10 @@
site_id: ''
url_http: ''
url_https: ''
domain_mode: 0
site_id: '1'
url_http: 'https://analytics.figureslibres.io/'
url_https: 'https://analytics.figureslibres.io/'
domain_mode: 1
visibility:
request_path_mode: 0
request_path_pages: "/admin\n/admin/*\n/batch\n/node/add*\n/node/*/*\n/user/*/*"
request_path_pages: "/admin\r\n/admin/*\r\n/batch\r\n/node/add*\r\n/node/*/*\r\n/user/*/*"
user_role_mode: 0
user_role_roles: { }
user_account_mode: 0
@@ -14,17 +14,45 @@ track:
files_extensions: '7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip'
colorbox: true
userid: false
messages: { }
messages:
status: status
warning: warning
error: error
site_search: false
privacy:
donottrack: true
custom:
variable: { }
variable:
1:
name: ''
value: ''
scope: visit
slot: 1
2:
name: ''
value: ''
scope: visit
slot: 2
3:
name: ''
value: ''
scope: visit
slot: 3
4:
name: ''
value: ''
scope: visit
slot: 4
5:
name: ''
value: ''
scope: visit
slot: 5
codesnippet:
before: ''
after: ''
translation_set: false
cache: false
cache: true
page_title_hierarchy: false
page_title_hierarchy_exclude_home: true
_core: