Permalink
Browse files

Add working users stub route, template, model

It works!
  • Loading branch information...
alisdair committed Jun 8, 2015
1 parent 418c71b commit 170a4ec4aa374e40f1632d4fd4570e6bfd547b61
@@ -0,0 +1,4 @@
import SlackAdapter from './slack';
export default SlackAdapter.extend({
});
@@ -13,7 +13,7 @@ function invalidTokenResponse(token) {
export default function() {
this.get('/slack/users.list', function(db, request) {
let response = invalidTokenResponse(request.params.token);
if (!Ember.isNone(response)) { return response; }
// if (!Ember.isNone(response)) { return response; }
return { ok: true, members: db.users };
});
@@ -0,0 +1,3 @@
export default function(server) {
server.createList('user', 10);
}
@@ -0,0 +1,10 @@
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr(),
deleted: DS.attr(),
realName: DS.attr(),
tz: DS.attr(),
tzLabel: DS.attr(),
tzOffset: DS.attr()
});
@@ -8,6 +8,7 @@ var Router = Ember.Router.extend({
Router.map(function() {
this.route('login');
this.route('authorize');
this.resource('users');
});
export default Router;
@@ -0,0 +1,7 @@
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.find('user');
}
});
@@ -0,0 +1,5 @@
<h1>{{model.length}} Users</h1>
{{#each model as |user|}}
<p>{{user.name}}: {{user.realName}}</p>
{{/each}}
@@ -1,3 +1,4 @@
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
moduleFor('adapter:slack', 'Unit | Adapter | slack');
@@ -0,0 +1,12 @@
import { moduleForModel, test } from 'ember-qunit';
moduleForModel('user', 'Unit | Model | user', {
// Specify the other units that are required for this test.
needs: []
});
test('it exists', function(assert) {
var model = this.subject();
// var store = this.store();
assert.ok(!!model);
});
@@ -0,0 +1,11 @@
import { moduleFor, test } from 'ember-qunit';
moduleFor('route:users', 'Unit | Route | users', {
// 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);
});

0 comments on commit 170a4ec

Please sign in to comment.