From 723942ff735612f5505e0fab95680f4b83bdb98d Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 24 Oct 2016 20:21:08 -0400 Subject: [PATCH 1/4] Loading groups dynamically, work in progress --- app/controllers/index.js | 1 + app/templates/index.hbs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/index.js b/app/controllers/index.js index 2c63813..5480943 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -11,6 +11,7 @@ export default Ember.Controller.extend({ } }); + function suitableScreenHeight() { return Math.max(Ember.$(window).height() - 40, 320); } diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 382d9e2..19370cd 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -21,6 +21,9 @@
Want to know more about our church? Check out some of the groups within our church that may interest you. + {{#each g in model.group}} +

HELLO={{group.slug}}

+ {{/each}}
From 9080356b12ff7ed5d42a93d17f6fc01b6bea6c92 Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 24 Oct 2016 20:22:41 -0400 Subject: [PATCH 2/4] Load groups dynamically ; work in progress --- app/routes/index.js | 11 +++++++++++ tests/unit/routes/index-test.js | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 app/routes/index.js create mode 100644 tests/unit/routes/index-test.js diff --git a/app/routes/index.js b/app/routes/index.js new file mode 100644 index 0000000..90718c8 --- /dev/null +++ b/app/routes/index.js @@ -0,0 +1,11 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function() { + return this.store.query('group', { + 'filter[id]': 1 + }).then((groups) => { + return groups.objectAt(0); + }); + } +}); diff --git a/tests/unit/routes/index-test.js b/tests/unit/routes/index-test.js new file mode 100644 index 0000000..5d0f50d --- /dev/null +++ b/tests/unit/routes/index-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:index', 'Unit | Route | index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + let route = this.subject(); + assert.ok(route); +}); From d63aff23ea0834fed2e7a7c334f794d84f4dee58 Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 24 Oct 2016 21:50:06 -0400 Subject: [PATCH 3/4] Displays groups dynamically --- app/routes/index.js | 6 +----- app/styles/pages/index.scss | 6 ++++++ app/templates/index.hbs | 42 ++++++++++++++++++------------------- mirage/scenarios/default.js | 1 + 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/app/routes/index.js b/app/routes/index.js index 90718c8..4112f3f 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -2,10 +2,6 @@ import Ember from 'ember'; export default Ember.Route.extend({ model: function() { - return this.store.query('group', { - 'filter[id]': 1 - }).then((groups) => { - return groups.objectAt(0); - }); + return this.get('store').findAll("group"); } }); diff --git a/app/styles/pages/index.scss b/app/styles/pages/index.scss index 7068e20..c3f8fe5 100644 --- a/app/styles/pages/index.scss +++ b/app/styles/pages/index.scss @@ -40,6 +40,12 @@ .group { text-align: center; margin-top: $padding-l; + margin-bottom: $padding-xl; + + .profile-picture { + width: 200px; + height: 200px; + } .description { margin-top: $padding-m; diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 19370cd..8954298 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -21,37 +21,35 @@
Want to know more about our church? Check out some of the groups within our church that may interest you. - {{#each g in model.group}} -

HELLO={{group.slug}}

- {{/each}}
-
- {{#link-to "group.index" "childrens-church"}} - + {{#each model as |group|}} +
+ {{#link-to "group.index" group.slug}} + {{/link-to}}
- {{#link-to "group.index" "childrens-church"}} - Children's Church + {{#link-to "group.index" group.slug}} + {{group.name}} {{/link-to}}
-
- {{#link-to "group.index" "english-service"}} - - - {{/link-to}} + {{/each}} +
+
- {{#link-to "group.index" "english-service"}} - English Service - {{/link-to}} + Coming Soon...
diff --git a/mirage/scenarios/default.js b/mirage/scenarios/default.js index 3a14c15..5ccb51b 100644 --- a/mirage/scenarios/default.js +++ b/mirage/scenarios/default.js @@ -22,6 +22,7 @@ export default function(server) { } server.createList("post", 40, { group: englishService }); + server.createList("group", 1); server.create("user", { email: "test@example.com", name: "Test User" }); } From 3fd5a77ca4ada790ffb7b57fcd89934374107c3f Mon Sep 17 00:00:00 2001 From: Amos Chan Date: Mon, 28 Nov 2016 19:47:23 -0500 Subject: [PATCH 4/4] Use 0.2.0 of mirage --- app/controllers/index.js | 1 - package.json | 2 +- tests/unit/routes/index-test.js | 11 ----------- 3 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 tests/unit/routes/index-test.js diff --git a/app/controllers/index.js b/app/controllers/index.js index 5480943..2c63813 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -11,7 +11,6 @@ export default Ember.Controller.extend({ } }); - function suitableScreenHeight() { return Math.max(Ember.$(window).height() - 40, 320); } diff --git a/package.json b/package.json index c91f9af..e2ce0a8 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "ember-cli-htmlbars-inline-precompile": "^0.3.1", "ember-cli-inject-live-reload": "^1.3.1", "ember-cli-jsonapi-pagination": "0.0.2", - "ember-cli-mirage": "^0.2.0", + "ember-cli-mirage": "0.2.0", "ember-cli-moment-shim": "1.0.0", "ember-cli-page-object": "^1.1.0", "ember-cli-pretender": "0.3.1", diff --git a/tests/unit/routes/index-test.js b/tests/unit/routes/index-test.js deleted file mode 100644 index 5d0f50d..0000000 --- a/tests/unit/routes/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('route:index', 'Unit | Route | index', { - // Specify the other units that are required for this test. - // needs: ['controller:foo'] -}); - -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); -});