pass arguments to results components
authornowmad@nowmads-macbook-pro.local
Thu, 10 Dec 2015 16:49:43 +0100
changeset 41 b6815b3d46bd
parent 40 9887379e627f
child 42 7d091abf82fd
pass arguments to results components
cms/app-client/app/controllers/results.js
cms/app-client/app/templates/results.hbs
cms/app-client/tests/unit/controllers/results-test.js
cms/app-client/tests/unit/routes/results-test.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/controllers/results.js	Thu Dec 10 16:49:43 2015 +0100
@@ -0,0 +1,17 @@
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+  queryParams: ['location'],
+  location: null,
+  filteredSounds: Ember.computed('location', 'model', function() {
+    var location = this.get('location');
+    console.log("model ? ", this.get('model'));
+    var sounds = this.get('model');
+
+    if (location) {
+      return sounds.filterBy('location', location);
+    } else {
+      return sounds;
+    }
+  })
+});
--- a/cms/app-client/app/templates/results.hbs	Thu Dec 10 16:47:51 2015 +0100
+++ b/cms/app-client/app/templates/results.hbs	Thu Dec 10 16:49:43 2015 +0100
@@ -1,4 +1,9 @@
 <h2>This is the results</h2>
 <div class="corpus-app-content">
   RESULTS
+  {{#each model as |item| }}
+    <p>
+      <strong>{{ item.name }}</strong>
+    </p>
+  {{/each}}
 </div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/tests/unit/controllers/results-test.js	Thu Dec 10 16:49:43 2015 +0100
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:results', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+  var controller = this.subject();
+  assert.ok(controller);
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/tests/unit/routes/results-test.js	Thu Dec 10 16:49:43 2015 +0100
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:results', 'Unit | Route | results', {
+  // Specify the other units that are required for this test.
+  // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+  var route = this.subject();
+  assert.ok(route);
+});