Browse Source

studio improvement, fixe #537

Bachir Soussi Chiadmi 5 years ago
parent
commit
55f7def7cb

File diff suppressed because it is too large
+ 0 - 1
web/modules/custom/edlp_studio/assets/dist/scripts/edlp_studio.min.js


+ 26 - 10
web/modules/custom/edlp_studio/assets/scripts/edlp_studio.js

@@ -1,7 +1,7 @@
 (function ($, Drupal, drupalSettings) {
 
   var _settings = drupalSettings.edlp_studio;
-  var $composer;
+  var _$composer;
 
   // audio play is handled by edlp_theme
 
@@ -21,10 +21,11 @@
 
   function initStudio(){
     if($('#studio-ui').length){
-      $composer = $('.composition_ui .composer', '#studio-ui');
+      _$composer = $('.composition_ui .composer', '#studio-ui');
       initAjaxChutierLinks();
       initAjaxCompoLinks();
       initDragAndDropUI();
+      initUsedChutierInCompo();
       $('body').trigger({'type':'studio-initialized'});
     }else{
       $('body').trigger({'type':'studio-not-active'});
@@ -95,6 +96,19 @@
       .addClass('ajax-enabled');
   };
 
+  function initUsedChutierInCompo(){
+    console.log('initUsedChutierInCompo');
+    $('.chutier-link.on-compo', '#studio-ui .chutier_ui').removeClass('on-compo');
+    var nid;
+    $('.audio-link', _$composer).each(function(index, el) {
+      nid = $(el).attr('nid');
+      console.log('compo item', nid);
+      $('.chutier-link[target_id="'+nid+'"]', '#studio-ui .chutier_ui').addClass('on-compo');
+    });
+
+    //audio-link
+  };
+
   //   ___                    ___
   //  / _ \ _ __  ___ _ _    / __|___ _ __  _ __  ___
   // | (_) | '_ \/ -_) ' \  | (__/ _ \ '  \| '_ \/ _ \
@@ -111,7 +125,7 @@
     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');
+    _$composer.addClass('ajax-loading');
     $.getJSON(path, {})
       .done(function(data){
         onOpenCompoDone(data, $link);
@@ -121,16 +135,17 @@
       });
   };
   function onOpenCompoDone(data, $link){
-    //console.log('onActionToCompoDone',data);
+    console.log('onOpenCompoDone',data);
     $('.composition-link').removeClass('is-active');
     $link.removeClass('ajax-loading').addClass('is-active');
-    if($('.composition', $composer).length){
-      $('.composition', $composer).replaceWith(data.compo);
+    if($('.composition', _$composer).length){
+      $('.composition', _$composer).replaceWith(data.compo);
     }else{
-      $('header', $composer).after(data.compo);
+      $('header', _$composer).after(data.compo);
     }
-    $composer.removeClass('ajax-loading');
+    _$composer.removeClass('ajax-loading');
     initDragAndDropUI();
+    initUsedChutierInCompo();
     $('body').trigger({
       'type':'on-studio-compo-opened'
     });
@@ -233,7 +248,7 @@
       if($('.composition-link').length){
         openCompo($('.composition-link').eq(0));
       }else{
-        $('.composition', $composer).html();
+        $('.composition', _$composer).html();
       }
     }else{
       console.warn(data.message);
@@ -342,7 +357,7 @@
       containment:$('#studio-ui'),
       scroll:false,
       helper:function(e){
-        // we reproduce here the irem structure of destination sortable elements
+        // we reproduce here the item structure of destination sortable elements
         // var $audio_link = $('.audio-link',this);
         return $('<div>').addClass('field__item')
           .append(
@@ -374,6 +389,7 @@
       documents[i] = $(this).attr('nid');
     });
     // console.log(documents);
+    initUsedChutierInCompo();
     recordCompoList(cid, documents);
   };
   function recordCompoList(cid, docs){

+ 16 - 16
web/modules/custom/edlp_studio/includes/edlp_chutier_ui.inc

@@ -41,12 +41,17 @@ function template_preprocess_edlp_chutier_ui(&$vars){
     $remove_url = Chutier::getActionsUrl($node->id(), $vars['uid']);
 
     // build the link
-    $vars['documents']['#items'][] = array(
+    array_unshift($vars['documents']['#items'], array(
       '#type' => 'container',
-      'entrees' => array(
-        '#type' => 'container',
-        '#attributes'=>['class'=>['entrees']],
-        '#markup'=>$entrees,
+      'remove_link' => array(
+        '#title' => t("Chutier."),
+        '#type' => 'link',
+        '#url' => $remove_url,
+        '#options'=>array(
+          'attributes' => array(
+            'data-drupal-link-system-path' => $remove_url->getInternalPath()
+          ),
+        ),
       ),
       'link'=>array(
         '#title' => $trunc_title,
@@ -64,17 +69,12 @@ function template_preprocess_edlp_chutier_ui(&$vars){
           ),
         ),
       ),
-      'remove_link' => array(
-        '#title' => t("Chutier."),
-        '#type' => 'link',
-        '#url' => $remove_url,
-        '#options'=>array(
-          'attributes' => array(
-            'data-drupal-link-system-path' => $remove_url->getInternalPath()
-          ),
-        ),
-      ),
-    );
+      'entrees' => array(
+        '#type' => 'container',
+        '#attributes'=>['class'=>['entrees']],
+        '#markup'=>$entrees,
+      )
+    ));
   }
 
 }

+ 1 - 0
web/themes/custom/edlptheme/assets/dist/img/favori-oncompo.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 3.1749999 3.1750001"><path style="isolation:auto;mix-blend-mode:normal" d="M0 0h3.175v3.175H0z" color="#000" overflow="visible" fill="none"/><path d="M2.576.16c.029 0 .057.007.083.018a.207.207 0 0 1 .098.077.197.197 0 0 1 .038.117v2.431a.197.197 0 0 1-.038.117.207.207 0 0 1-.098.077.212.212 0 0 1-.083.016.224.224 0 0 1-.157-.06l-.831-.8-.832.8a.225.225 0 0 1-.34-.033.203.203 0 0 1-.036-.117V.372A.204.204 0 0 1 .516.178.209.209 0 0 1 .6.16z" style="line-height:20px;-inkscape-font-specification:'Crimson, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;text-align:start" font-weight="400" font-family="#dc143c" letter-spacing="0" word-spacing="0" fill="#f80000"/></svg>

File diff suppressed because it is too large
+ 0 - 0
web/themes/custom/edlptheme/assets/dist/styles/app.min.css


+ 69 - 0
web/themes/custom/edlptheme/assets/img/favori-oncompo.svg

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="12"
+   height="12"
+   viewBox="0 0 3.1749999 3.1750001"
+   version="1.1"
+   id="svg14944"
+   inkscape:version="0.92.4 5da689c313, 2019-01-14"
+   sodipodi:docname="favori-oncompo.svg">
+  <defs
+     id="defs14938" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="31.678384"
+     inkscape:cx="-5.1506961"
+     inkscape:cy="5.0420999"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     units="px"
+     inkscape:window-width="1920"
+     inkscape:window-height="1145"
+     inkscape:window-x="0"
+     inkscape:window-y="28"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata14941">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Calque 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-293.82497)">
+    <path
+       style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.05833328;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+       d="m 0,293.82497 h 3.175 v 3.175 H 0 Z"
+       id="rect15501"
+       inkscape:connector-curvature="0" />
+    <path
+       d="m 2.57591,293.98564 c 0.028933,0 0.0566,0.006 0.083,0.017 0.041533,0.0163 0.074233,0.0421 0.0981,0.0773 0.025133,0.0352 0.0377,0.0742 0.0377,0.11694 v 2.43129 c 0,0.0427 -0.012567,0.0817 -0.0377,0.11694 -0.023933,0.0352 -0.056633,0.061 -0.0981,0.0773 -0.023933,0.0101 -0.0516,0.0151 -0.083,0.0151 -0.060333,0 -0.1125167,-0.0201 -0.15655,-0.0604 l -0.83181,-0.79974 -0.83181001,0.79974 c -0.0452667,0.0415 -0.09745,0.0622 -0.15655,0.0622 -0.0289333,0 -0.0566,-0.006 -0.083,-0.017 -0.0415333,-0.0163 -0.0748667,-0.0421 -0.1,-0.0773 -0.0239333,-0.0351 -0.0359,-0.0741 -0.0359,-0.11685 v -2.43129 c 0,-0.0427 0.0119667,-0.0817 0.0359,-0.11694 0.0251333,-0.0352 0.0584667,-0.061 0.1,-0.0773 0.0264,-0.0113 0.0540667,-0.017 0.083,-0.017 z"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:20px;font-family:Crimson;-inkscape-font-specification:'Crimson, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#f80000;fill-opacity:1;stroke:none;stroke-width:0.42250523"
+       id="path11601"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccssccscccsccsscccc" />
+  </g>
+</svg>

+ 19 - 8
web/themes/custom/edlptheme/assets/styles/app.scss

@@ -1220,9 +1220,15 @@ main[role="main"]{
         margin:0; padding:0;
         line-height: 1.2;
       }
+      ul{
+        display: grid;
+        grid-template-columns: repeat( auto-fit, minmax(200px, 1fr) );
+      }
       li{
-        display: inline-block; vertical-align: top;
-        width:49%; margin-bottom: 0.5em;
+        // grid-auto-flow: row;
+        // display: inline-block; vertical-align: top;
+        // width:32%;
+        margin-bottom: 0.3em;
         white-space: nowrap;
         >div{
           display:inline-block;
@@ -1231,8 +1237,14 @@ main[role="main"]{
             cursor:grab;
           }
         }
-        .entrees{
-          @include entree-micro-square;
+        .chutier-icon{
+          display: inline-block;
+          width:0.7em; height:0.7em;
+          margin-right: 0.3em;
+          opacity: 0.8;
+          &.on-compo{
+            background-image: url(../img/favori-oncompo.svg);
+          }
         }
         a.audio-link{
           // text-transform: capitalize;
@@ -1240,10 +1252,9 @@ main[role="main"]{
           margin-right: 0.5em;
           white-space: normal;
         }
-        .chutier-icon{
-          display: inline-block;
-          width:0.7em; height:0.7em;
-          opacity: 0.8;
+        .entrees{
+          display:inline-block;
+          @include entree-micro-square;
         }
       }
 

Some files were not shown because too many files changed in this diff