Bläddra i källkod

audio cartel ids now complete

Bachir Soussi Chiadmi 6 år sedan
förälder
incheckning
6d88ca7c8d
18 ändrade filer med 241 tillägg och 99 borttagningar
  1. 9 0
      sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js
  2. 22 0
      sites/all/modules/figli/edlp_corpus/assets/dist/scripts/physics.min.js
  3. 0 0
      sites/all/modules/figli/edlp_corpus/assets/dist/styles/corpus.min.css
  4. 1 1
      sites/all/modules/figli/edlp_corpus/assets/styles/corpus.scss
  5. 57 0
      sites/all/modules/figli/edlp_corpus/edlp_corpus.module
  6. 13 2
      sites/all/themes/custom/edlptheme/assets/dist/scripts/history.min.js
  7. 1 1
      sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js
  8. 0 0
      sites/all/themes/custom/edlptheme/assets/dist/styles/app.min.css
  9. 77 52
      sites/all/themes/custom/edlptheme/assets/styles/app.scss
  10. 35 42
      sites/all/themes/custom/edlptheme/edlptheme.theme
  11. 2 1
      sites/all/themes/custom/edlptheme/templates/content/node--enregistrement--player-cartel.html.twig
  12. 8 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.article.yml
  13. 3 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.chutier.yml
  14. 1 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.compo.yml
  15. 1 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.default.yml
  16. 4 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.index.yml
  17. 3 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.search_index.yml
  18. 4 0
      sites/default/config/sync/core.entity_view_display.node.enregistrement.transcript.yml

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 9 - 0
sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 22 - 0
sites/all/modules/figli/edlp_corpus/assets/dist/scripts/physics.min.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
sites/all/modules/figli/edlp_corpus/assets/dist/styles/corpus.min.css


+ 1 - 1
sites/all/modules/figli/edlp_corpus/assets/styles/corpus.scss

@@ -34,7 +34,7 @@ div.node-popup{
   pointer-events: none;
 
   .inner{
-    padding:1em;
+    padding:0.4em;
     outline: 1px solid red;
     background-color: white;
   }

+ 57 - 0
sites/all/modules/figli/edlp_corpus/edlp_corpus.module

@@ -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

+ 13 - 2
sites/all/themes/custom/edlptheme/assets/dist/scripts/history.min.js

@@ -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');
+}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
sites/all/themes/custom/edlptheme/assets/dist/styles/app.min.css


+ 77 - 52
sites/all/themes/custom/edlptheme/assets/styles/app.scss

@@ -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;
     }
   }
 }

+ 35 - 42
sites/all/themes/custom/edlptheme/edlptheme.theme

@@ -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;
+  }
 }
 
 

+ 2 - 1
sites/all/themes/custom/edlptheme/templates/content/node--enregistrement--player-cartel.html.twig

@@ -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>

+ 8 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.article.yml

@@ -11,7 +11,10 @@ dependencies:
     - field.field.node.enregistrement.field_genres
     - field.field.node.enregistrement.field_langues
     - field.field.node.enregistrement.field_locuteurs
+    - field.field.node.enregistrement.field_nbr_locuteurs
     - field.field.node.enregistrement.field_son
+    - field.field.node.enregistrement.field_transcript_trad
+    - field.field.node.enregistrement.field_transcript_vo
     - field.field.node.enregistrement.field_workflow
     - node.type.enregistrement
   module:
@@ -35,13 +38,18 @@ content:
     settings: {  }
     third_party_settings: {  }
 hidden:
+  chutier_actions: true
   field_collectionneurs: true
   field_description: true
   field_entrees: true
   field_genres: true
   field_langues: true
   field_locuteurs: true
+  field_nbr_locuteurs: true
   field_son: true
+  field_transcript_trad: true
+  field_transcript_vo: true
   field_workflow: true
   langcode: true
   links: true
+  relations: true

+ 3 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.chutier.yml

@@ -11,6 +11,7 @@ dependencies:
     - field.field.node.enregistrement.field_genres
     - field.field.node.enregistrement.field_langues
     - field.field.node.enregistrement.field_locuteurs
+    - field.field.node.enregistrement.field_nbr_locuteurs
     - field.field.node.enregistrement.field_son
     - field.field.node.enregistrement.field_transcript_trad
     - field.field.node.enregistrement.field_transcript_vo
@@ -44,9 +45,11 @@ hidden:
   field_genres: true
   field_langues: true
   field_locuteurs: true
+  field_nbr_locuteurs: true
   field_son: true
   field_transcript_trad: true
   field_transcript_vo: true
   field_workflow: true
   langcode: true
   links: true
+  relations: true

+ 1 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.compo.yml

@@ -52,3 +52,4 @@ hidden:
   field_workflow: true
   langcode: true
   links: true
+  relations: true

+ 1 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.default.yml

@@ -58,3 +58,4 @@ hidden:
   field_workflow: true
   langcode: true
   links: true
+  relations: true

+ 4 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.index.yml

@@ -11,6 +11,7 @@ dependencies:
     - field.field.node.enregistrement.field_genres
     - field.field.node.enregistrement.field_langues
     - field.field.node.enregistrement.field_locuteurs
+    - field.field.node.enregistrement.field_nbr_locuteurs
     - field.field.node.enregistrement.field_son
     - field.field.node.enregistrement.field_transcript_trad
     - field.field.node.enregistrement.field_transcript_vo
@@ -38,14 +39,17 @@ content:
     region: content
 hidden:
   body: true
+  chutier_actions: true
   field_collectionneurs: true
   field_entrees: true
   field_genres: true
   field_langues: true
   field_locuteurs: true
+  field_nbr_locuteurs: true
   field_son: true
   field_transcript_trad: true
   field_transcript_vo: true
   field_workflow: true
   langcode: true
   links: true
+  relations: true

+ 3 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.search_index.yml

@@ -11,6 +11,7 @@ dependencies:
     - field.field.node.enregistrement.field_genres
     - field.field.node.enregistrement.field_langues
     - field.field.node.enregistrement.field_locuteurs
+    - field.field.node.enregistrement.field_nbr_locuteurs
     - field.field.node.enregistrement.field_son
     - field.field.node.enregistrement.field_transcript_trad
     - field.field.node.enregistrement.field_transcript_vo
@@ -51,9 +52,11 @@ hidden:
   field_genres: true
   field_langues: true
   field_locuteurs: true
+  field_nbr_locuteurs: true
   field_son: true
   field_transcript_trad: true
   field_transcript_vo: true
   field_workflow: true
   langcode: true
   links: true
+  relations: true

+ 4 - 0
sites/default/config/sync/core.entity_view_display.node.enregistrement.transcript.yml

@@ -11,6 +11,7 @@ dependencies:
     - field.field.node.enregistrement.field_genres
     - field.field.node.enregistrement.field_langues
     - field.field.node.enregistrement.field_locuteurs
+    - field.field.node.enregistrement.field_nbr_locuteurs
     - field.field.node.enregistrement.field_son
     - field.field.node.enregistrement.field_transcript_trad
     - field.field.node.enregistrement.field_transcript_vo
@@ -45,13 +46,16 @@ content:
     third_party_settings: {  }
 hidden:
   body: true
+  chutier_actions: true
   field_collectionneurs: true
   field_description: true
   field_entrees: true
   field_genres: true
   field_langues: true
   field_locuteurs: true
+  field_nbr_locuteurs: true
   field_son: true
   field_workflow: true
   langcode: true
   links: true
+  relations: true

Vissa filer visades inte eftersom för många filer har ändrats