audio cartel ids now complete

This commit is contained in:
2018-04-14 22:47:25 +02:00
parent d4087b2924
commit 6d88ca7c8d
18 changed files with 6422 additions and 217 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:1em;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.4em;
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); }
@@ -34,7 +34,7 @@ div.node-popup{
pointer-events: none;
.inner{
padding:1em;
padding:0.4em;
outline: 1px solid red;
background-color: white;
}
@@ -41,6 +41,11 @@ function edlp_corpus_entity_extra_field_info(){
'weight' => 99,
// 'visible' => FALSE,
];
$extra['node']['enregistrement']['display']['relations'] = [
'label' => t('Relations'),
'description' => 'Display enregistrement relations with other content types',
'weight' => 99,
];
return $extra;
}
@@ -93,6 +98,58 @@ function edlp_corpus_taxonomy_term_view(array &$build, EntityInterface $entity,
}
}
function edlp_corpus_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
if($entity->bundle() == "enregistrement"){
$relations_display_settings = $display->getComponent('relations');
if(!empty($relations_display_settings)){
// querying all productions page that have this document in their entity reference "field_documents_liés"
$query = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'page') // page (production)
->exists('field_page_type')
->condition('field_documents_lies.target_id', $entity->id(), 'IN');
$nids = $query->execute();
$nodes = entity_load_multiple('node', $nids);
// dpm($nodes, '$nodes');
// build the array of relateds classified by page_type (taxonomy)
$relateds = array();
foreach ($nodes as $nid => $node) {
$page_type = $node->get('field_page_type')->get(0)->getValue();
// dpm($page_type, 'page_type');
$term = entity_load('taxonomy_term', $page_type['target_id']);
// dpm($term, 'term');
$relateds[$term->getName()][] = $node->getTitle();
}
// dpm($relateds, 'relateds');
// if relateds, build the sentence for display and the render array
if(count($relateds)){
$relations = '<h3>' . t('This sound is about :') . '</h3><p>';
foreach ($relateds as $cat => $titles) {
$relations .= '<span class="cat">' . $cat . ' :</span> ' . implode(', ', $titles) . ' | ';
}
$relations = preg_replace('/\s\|\s$/', '', $relations);
$relations .= '</p>';
$build['relations'] = array(
'#type'=>"container",
'#attributes'=>array(
'class'=>'relations'
),
"#markup"=> $relations,
);
}
}
}
}
/**
* Implements hook_page_attachments().
* @param array $attachments
@@ -1,2 +1,13 @@
void 0;if(edlp.redirect){void 0;void 0;window.localStorage.setItem('edlp_origin_path',edlp.sys_path.replace(/^\//,''));window.localStorage.setItem('edlp_origin_url',window.location.pathname);window.localStorage.setItem('edlp_origin_hash',window.location.hash);window.location.replace(window.location.origin+'/'+edlp.lang_code);}else{void 0;}
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(/^\//, ''));
window.localStorage.setItem('edlp_origin_url', window.location.pathname);
window.localStorage.setItem('edlp_origin_hash', window.location.hash);
// 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
@@ -20,31 +20,38 @@
animation: rotation 2s infinite linear;
}
@mixin entrie-micro-square {
display:inline-block;
$s:8px;
width:$s; height:$s;
background-color: black;
margin-right: 3px;
&[tid='134']{background-color: var(--e-col-134);}
&[tid='121']{background-color: var(--e-col-121);}
&[tid='125']{background-color: var(--e-col-125);}
&[tid='119']{background-color: var(--e-col-119);}
&[tid='132']{background-color: var(--e-col-132);}
&[tid='122']{background-color: var(--e-col-122);}
&[tid='129']{background-color: var(--e-col-129);}
&[tid='120']{background-color: var(--e-col-120);}
&[tid='130']{background-color: var(--e-col-130);}
&[tid='118']{background-color: var(--e-col-118);}
&[tid='127']{background-color: var(--e-col-127);}
&[tid='133']{background-color: var(--e-col-133);}
&[tid='128']{background-color: var(--e-col-128);}
&[tid='124']{background-color: var(--e-col-124);}
&[tid='116']{background-color: var(--e-col-116);}
&[tid='117']{background-color: var(--e-col-117);}
&[tid='131']{background-color: var(--e-col-131);}
&[tid='126']{background-color: var(--e-col-126);}
&[tid='123']{background-color: var(--e-col-123);}
@mixin entree-micro-square {
white-space: nowrap;
font-size: 0.5em;
line-height: 0;
letter-spacing: 0px;
span{
display:inline-block;
$s:6px;
width:$s; height:$s;
background-color: black;
margin-right: 2px;
&[tid='134']{background-color: var(--e-col-134);}
&[tid='121']{background-color: var(--e-col-121);}
&[tid='125']{background-color: var(--e-col-125);}
&[tid='119']{background-color: var(--e-col-119);}
&[tid='132']{background-color: var(--e-col-132);}
&[tid='122']{background-color: var(--e-col-122);}
&[tid='129']{background-color: var(--e-col-129);}
&[tid='120']{background-color: var(--e-col-120);}
&[tid='130']{background-color: var(--e-col-130);}
&[tid='118']{background-color: var(--e-col-118);}
&[tid='127']{background-color: var(--e-col-127);}
&[tid='133']{background-color: var(--e-col-133);}
&[tid='128']{background-color: var(--e-col-128);}
&[tid='124']{background-color: var(--e-col-124);}
&[tid='116']{background-color: var(--e-col-116);}
&[tid='117']{background-color: var(--e-col-117);}
&[tid='131']{background-color: var(--e-col-131);}
&[tid='126']{background-color: var(--e-col-126);}
&[tid='123']{background-color: var(--e-col-123);}
}
}
@@ -385,7 +392,7 @@ main[role="main"]{
.cartel{
// TODO: set max-width regarding responsive
position: relative;
max-width: 350px;
// max-width: 350px;
margin-left: 1em;
background-color: white;
opacity: 1;
@@ -403,20 +410,18 @@ main[role="main"]{
}
.cartels{
.first-cartel{
// visibility: hidden;
.entrees{
line-height: 0;
span{
@include entrie-micro-square;
}
@include entree-micro-square;
}
h2.node-title{
margin:0.2em 0 0;
font-size: 1em;
font-size: 0.9em;
font-weight: 600;
}
p{
margin:0;
font-size: 0.75em;
font-size: 0.756em;
}
}
.second-cartel{
@@ -424,29 +429,49 @@ main[role="main"]{
top: 0; left:0;
background-color: white;
height:100%; min-width: 100%;
opacity: 0;
opacity: 1;
transition: opacity 0.2s ease-in-out;
white-space: nowrap;
&>*{
display: inline-block;
vertical-align: top;
white-space: normal;
}
.col-left{
a{
display: block;
font-size: 0.90em;
font-size: 0.82em;
font-weight: 600;
}
}
.col-right{
font-size: 0.75em;
border-left:1px solid #1A1A1A;
margin-left:5px; padding-left:5px;
h3{
font-size: 0.82em;
margin:0;
}
p{
font-size: 0.756em;
margin:0;
span.cat{
font-weight: 600;
}
}
}
}
}
&:hover{
.second-cartel{
opacity: 1;
}
}
article:not(.has-second-cartel){
.second-cartel{
display:none;
}
}
}
}
@@ -490,7 +515,13 @@ main[role="main"]{
text-indent: 0;
padding: 0.5em;
margin:$s*1.2 0 0 $s*1.2;
p{margin: 0;}
p{
font-size: 0.756em;
margin:0;
&:not(:last-of-type){
margin: 0 0 0.4em 0;
}
}
}
}
&:hover{
@@ -606,10 +637,7 @@ main[role="main"]{
}
}
.entrees{
line-height: 0;
span{
@include entrie-micro-square;
}
@include entree-micro-square;
}
a.audio-link{
text-transform: capitalize;
@@ -992,9 +1020,7 @@ main[role="main"]{
}
article{
.entrees{
span{
@include entrie-micro-square;
}
@include entree-micro-square;
}
h2.node-title{
margin:0 0 0.3em 0;
@@ -1647,24 +1673,23 @@ footer{
.inner{
position: relative;
.entrees{
span{
@include entrie-micro-square;
}
@include entree-micro-square;
}
.title{
margin:0.3em 0;
font-size: 1.2em;
font-weight: 500;
margin:0.2em 0 0;
// margin:0.3em 0;
font-size: 0.9em;
font-weight: 600;
}
.description{
p{
margin:0;
font-size: 0.75em;
font-size: 0.756em;
}
}
.chutier-icon{
position:absolute;
top:1em; right:1em;
top:0.4em; right:0.4em;
}
}
}
@@ -6,6 +6,7 @@
*/
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Template\Attribute;
use Drupal\Component\Utility\Unicode;
@@ -164,58 +165,50 @@ function edlptheme_preprocess_node__enregistrement__compo(&$vars){
function edlptheme_preprocess_node__enregistrement__player_cartel(&$vars){
// dpm($vars);
$node = $vars['node'];
$vars['col_left'] = false;
$vars['col_right'] = false;
// if transcript not empty
$url = Url::fromRoute('entity.node.canonical', ['node'=>$vars['node']->id()], array(
'attributes' => array(
'class' => ['link-transcript', 'ajax-link'],
'viewmode'=>'transcript'
)
));
$vars['link_transcript'] = array(
'#title' => t("Lire le text."),
'#type' => 'link',
'#url' => $url,
'#options'=>array(
$transcript = $node->get('field_transcript_vo');
if(!$transcript->isEmpty()){
$vars['col_left'] = true;
$url = Url::fromRoute('entity.node.canonical', ['node'=>$node->id()]);
$url->setOptions(array(
'attributes' => array(
'class' => ['link-transcript', 'ajax-link'],
'viewmode'=>'transcript',
'data-drupal-link-system-path' => $url->getInternalPath()
)
)
);
// TODO: refacorize the link generator as following :
// $url = Url::fromRoute('entity.taxonomy_term.canonical', ['taxonomy_term'=>$tid]);
// $url->setOptions(array(
// 'attributes' => array(
// 'class' => ['index-link', 'ajax-link'],
// 'viewmode'=>'index',
// 'tid'=>$tid,
// 'data-drupal-link-system-path' => $url->getInternalPath()
// )
// ));
// $entree['index_link'] = Link::fromTextAndUrl('index', $url);
));
$vars['link_transcript'] = Link::fromTextAndUrl(t("Lire le text."), $url);
}
// if article not empty
$url = Url::fromRoute('entity.node.canonical', ['node'=>$vars['node']->id()], array(
'attributes' => array(
'class' => ['link-article', 'ajax-link'],
'viewmode'=>'article'
)
));
$vars['link_article'] = array(
'#title' => t("Lire l'article."),
'#type' => 'link',
'#url' => $url,
'#options' => array(
'attributes'=>array(
$article = $node->get('body');
if(!$article->isEmpty()){
$vars['col_left'] = true;
$url = Url::fromRoute('entity.node.canonical', ['node'=>$node->id()]);
$url->setOptions(array(
'attributes' => array(
'class' => ['link-article', 'ajax-link'],
'viewmode'=>'article',
'data-drupal-link-system-path' => $url->getInternalPath()
)
)
);
// if article or transcript
$vars['col_left'] = true;
));
$vars['link_article'] = Link::fromTextAndUrl(t("Lire l'article."), $url);
}
// if
$vars['col_right'] = true;
// relations (defined in edlp_corpus.module)
if(isset($vars['content']['relations'])){
// dpm($relations);
$vars['col_right'] = true;
}
if($vars['col_left'] || $vars['col_right']){
$vars['second_cartel'] = true;
}
}
@@ -78,6 +78,7 @@
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
second_cartel ? 'has-second-cartel',
]
%}
{{ attach_library('classy/node') }}
@@ -111,7 +112,7 @@
{% endif %}
{% if col_right %}
<div class="col-right">
right colume
{{ content.relations }}
</div>
{% endif %}
</section>