Fix playlist filtering
authorChloe Laisne <chloe.laisne@gmail.com>
Thu, 23 Jun 2016 17:09:32 +0200
changeset 200 a441c40f9c5e
parent 199 b7c691c6179d
child 201 9ae2cf79d167
Fix playlist filtering Minor design changes
cms/app-client/app/components/playlist-component.js
cms/app-client/app/components/visu-carto.js
cms/app-client/app/controllers/application.js
cms/app-client/app/styles/app.scss
cms/app-client/app/styles/components/playlist-component.scss
cms/app-client/app/styles/tabs/carto.scss
cms/app-client/app/styles/tabs/langues.scss
cms/app-client/app/templates/application.hbs
cms/app-client/app/templates/components/playlist-component.hbs
--- a/cms/app-client/app/components/playlist-component.js	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/components/playlist-component.js	Thu Jun 23 17:09:32 2016 +0200
@@ -2,6 +2,39 @@
 
 export default Ember.Component.extend({
 
-	classNames: ['playlist-component']
+	classNames: ['playlist-component'],
+
+	filter: Ember.inject.service(),
+
+	documents: Ember.computed('model', 'filter.location', 'filter.language', 'filter.discourse', 'filter.date', 'filter.theme', function() {
+        var documents = this.get('model');
+        if (this.get('filter.date').length > 0) {
+            var copy = documents;
+            documents.map(function(document) {
+                if (this.get('filter.date').indexOf(document.get('created')) === -1){
+                    copy = copy.without(document);
+                }
+            });
+            documents = copy;
+        }
+        if (this.get('filter.discourse')) {
+            documents = documents.filterBy('type', this.get('filter.discourse'));
+        }
+        if (this.get('filter.language')) {
+            documents = documents.filterBy('language', this.get('filter.language'));
+        }
+        if (this.get('filter.location')) {
+            documents = documents.filterBy('spatial', this.get('filter.location'));
+        }
+        if (this.get('filter.theme')) {
+            documents = documents.filterBy('thematique', this.get('filter.theme'));
+        }
+        return documents;
+    }),
+
+	didRender: function() {
+		this._super(...arguments);
+		this.$().find('ul').height(Ember.$('.corpus-app-wrapper').outerHeight() - (Ember.$('.filter-component').outerHeight() + this.$().find('h2').outerHeight()));
+	}
 
 });
--- a/cms/app-client/app/components/visu-carto.js	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/components/visu-carto.js	Thu Jun 23 17:09:32 2016 +0200
@@ -8,6 +8,8 @@
   didInsertElement: function(){
     var _this = this;
 
+    this.$('#mapdiv').height(Ember.$('.corpus-app-container').height());
+
     var franceDataProvider = {
         mapVar: AmCharts.maps.france2016Low,
         getAreasFromMap:true,
--- a/cms/app-client/app/controllers/application.js	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/controllers/application.js	Thu Jun 23 17:09:32 2016 +0200
@@ -56,39 +56,6 @@
         return this.store.findRecord('document', this.get('detail'));
     }),
 
-    filteredDocuments: Ember.computed('filter.location', 'filter.langue', 'filter.discours', 'filter.date', 'filter.thematique', 'model', function() {
-        var location = this.get('location');
-        var langue = this.get('langue');
-        var discours = this.get('discours');
-        var date = this.get('date');
-        var thematique = this.get('thematique');
-
-        var documents = this.get('model');
-
-        if (location) {
-            documents = documents.filterBy('spatial', location);
-        }
-        if (langue) {
-            documents = documents.filterBy('language', langue);
-        }
-        if (discours) {
-            documents = documents.filterBy('type', discours);
-        }
-        if (date.length > 0) {
-            var temp = documents;
-            documents.map(function(elt){
-                if (date.indexOf(elt.get('created')) === -1){
-                    temp = temp.without(elt);
-                }
-            });
-            documents = temp;
-        }
-        if (thematique) {
-            documents = documents.filterBy('thematique', thematique);
-        }
-        return documents;
-    }),
-
     actions: {
 
         deleteTag: function(key, value){
--- a/cms/app-client/app/styles/app.scss	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/styles/app.scss	Thu Jun 23 17:09:32 2016 +0200
@@ -10,7 +10,7 @@
 #corpus-app {
     border: 1px solid;
     width: 1108px;
-    height: 600px;
+    overflow: hidden;
     display: block;
     margin-left: auto;
     margin-right: auto;
@@ -44,8 +44,6 @@
 }
 
 .corpus-app-container {
-    background-color: #becfd4;
-    padding: 0 20px;
     color: #687a84;
     box-sizing: border-box;
 }
@@ -54,8 +52,23 @@
     padding: 20px;
 }
 
+body.tabs-thematiques .corpus-app-container {
+    padding: 0px 20px;
+}
+
+body.tabs-langues .corpus-app-container {
+    padding: 0px;
+}
+
+body.tabs-carto .corpus-app-container,
+body.tabs-chrono .corpus-app-container,
+body.tabs-thematiques .corpus-app-container {
+    background-color: #becfd4;
+}
+
 .corpus-app-wrapper {
     background-color: #253946;
+    box-shadow: -4px 0px 8px -4px #59626b;
 }
 
 .corpus-app-container,
--- a/cms/app-client/app/styles/components/playlist-component.scss	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/styles/components/playlist-component.scss	Thu Jun 23 17:09:32 2016 +0200
@@ -14,6 +14,7 @@
     margin: 0;
     padding: 0;
     font-size: 0px;
+    overflow-y: scroll;
 }
 
 .playlist-component ul li {
--- a/cms/app-client/app/styles/tabs/carto.scss	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/styles/tabs/carto.scss	Thu Jun 23 17:09:32 2016 +0200
@@ -1,4 +1,3 @@
 #mapdiv{
   width: 100%;
-  height: 600px;
 }
--- a/cms/app-client/app/styles/tabs/langues.scss	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/styles/tabs/langues.scss	Thu Jun 23 17:09:32 2016 +0200
@@ -22,11 +22,7 @@
 }
 
 .grandparent rect {
-    fill: green;
-}
-
-.grandparent:hover rect {
-    fill: lightgreen;
+    fill: #becfd4;
 }
 
 .children rect.parent,
--- a/cms/app-client/app/templates/application.hbs	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/templates/application.hbs	Thu Jun 23 17:09:32 2016 +0200
@@ -19,7 +19,7 @@
     
     {{filter-component}}
     
-    {{playlist-component filteredDocuments=filteredDocuments}}
+    {{playlist-component model=model}}
 
   </div>
 
--- a/cms/app-client/app/templates/components/playlist-component.hbs	Thu Jun 23 11:35:26 2016 +0200
+++ b/cms/app-client/app/templates/components/playlist-component.hbs	Thu Jun 23 17:09:32 2016 +0200
@@ -1,13 +1,13 @@
 <h2>Résultats</h2>
 <ul>
-    {{#each filteredDocuments as |item| }}
-    <li id="{{item.id}}">
+    {{#each documents as |document| }}
+    <li id="{{document.id}}">
         <div class="tools">
-            <span class="play playing-indicator" {{action 'play' item}}>&#9654;</span>
-            <button{{action 'openNotice' item}}>Notice</button>
+            <span class="play playing-indicator" {{action 'play' document}}>&#9654;</span>
+            <button{{action 'openNotice' document}}>Notice</button>
         </div>
-        <span class="title">{{ item.title }}</span>
-        {{doc-language url=item.language class="language"}}
+        <span class="title">{{ document.title }}</span>
+        {{doc-language url=document.language class="language"}}
     </li>
     {{/each}}
 </ul>
\ No newline at end of file