cms/app-client/app/controllers/application.js
changeset 95 f7ab931581af
parent 94 62984937a062
child 126 e87a340711a4
--- a/cms/app-client/app/controllers/application.js	Thu Jan 21 21:07:02 2016 +0100
+++ b/cms/app-client/app/controllers/application.js	Fri Jan 22 10:35:52 2016 +0100
@@ -1,13 +1,13 @@
 import Ember from 'ember';
 
 export default Ember.Controller.extend({
-  queryParams: ['location', 'langue', 'discours', 'date', 'thematique', 'detailId'],
+  queryParams: ['location', 'langue', 'discours', 'date', 'thematique', 'detail'],
   location: null,
   langue: null,
   discours: null,
   date: [],
   thematique: null,
-  detailId: null,
+  detail: null,
 
   currentId: null,
   currentItem: Ember.computed('currentId', function() {
@@ -18,8 +18,8 @@
     }
     return this.store.findRecord('document', this.get('currentId'));
   }),
-  modalItem: Ember.computed('detailId', function() {
-    return this.store.findRecord('document', this.get('detailId'));
+  modalItem: Ember.computed('detail', function() {
+    return this.store.findRecord('document', this.get('detail'));
   }),
   filteredDocuments: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
     var location = this.get('location');
@@ -82,19 +82,20 @@
     play: function(item){
       this.set("currentId", item.id);
     },
-    details: function(item){
-      if (Ember.$("#"+item.id).hasClass("details")){
-          Ember.$("#"+item.id).toggleClass("details", false);
+    showMore: function(item){
+      if (Ember.$("#"+item.id).hasClass("show-more")){
+          Ember.$("#"+item.id).toggleClass("show-more", false);
       } else{
-        Ember.$(".result-item").toggleClass("details", false);
-        Ember.$("#"+item.id).toggleClass("details", true);
+        Ember.$(".result-item").toggleClass("show-more", false);
+        Ember.$("#"+item.id).toggleClass("show-more", true);
       }
     },
     toggleModal: function(item){
       if (typeof(item) !== 'undefined'){
-        this.set("detailId", item.id);
+        this.set("detail", item.id);
+      } else {
+        this.set("detail", null);
       }
-      this.set("detailId", null);
     }
   }
 });