diff --git a/app/models/user.js b/app/models/user.js
index 637a5f3..bb7c5fd 100644
--- a/app/models/user.js
+++ b/app/models/user.js
@@ -12,4 +12,17 @@ export default DS.Model.extend({
isAdmin: function() {
return this.get('role') === 'A';
}.property('role'),
+
+ fullRole: function() {
+ let role = this.get('role');
+ if (role === 'R') {
+ return 'Read-Only';
+ } else if (role === 'W') {
+ return 'Write';
+ } else if (role === 'A') {
+ return 'Admin';
+ } else {
+ return 'Error';
+ }
+ }.property('role'),
});
diff --git a/app/pods/components/x-application/template.hbs b/app/pods/components/x-application/template.hbs
index f26e0d3..e859890 100644
--- a/app/pods/components/x-application/template.hbs
+++ b/app/pods/components/x-application/template.hbs
@@ -24,7 +24,7 @@
{{/link-to}}
{{else}}
diff --git a/app/pods/protected/users/index/route.js b/app/pods/protected/users/index/route.js
index 81b9562..e8b6bc7 100644
--- a/app/pods/protected/users/index/route.js
+++ b/app/pods/protected/users/index/route.js
@@ -1,6 +1,15 @@
import Ember from 'ember';
export default Ember.Route.extend({
+ beforeModel: function(transition) {
+ this._super(transition);
+ this.get('session.currentUser').then((user) => {
+ if (!user.get('isAdmin')) {
+ this.transitionTo('protected.index');
+ }
+ });
+ },
+
model: function() {
return this.store.findAll('user');
},
diff --git a/app/pods/protected/users/index/template.hbs b/app/pods/protected/users/index/template.hbs
index f3239cb..adb5b55 100644
--- a/app/pods/protected/users/index/template.hbs
+++ b/app/pods/protected/users/index/template.hbs
@@ -1,3 +1,33 @@
-{{#each model as |user|}}
- {{user.email}}
-{{/each}}
+{{genus-name}} Users
+Total users: {{model.length}}
+
+
+
+
+ Name |
+ Email |
+ Role |
+ Date Registered |
+
+
+
+ {{#each model as |row|}}
+
+
+ {{#link-to 'protected.users.show' row}}
+ {{row.name}}
+ {{/link-to}}
+ |
+
+ {{row.email}}
+ |
+
+ {{row.fullRole}}
+ |
+
+ {{null-time row.createdAt 'LL'}}
+ |
+
+ {{/each}}
+
+
diff --git a/app/pods/protected/users/show/route.js b/app/pods/protected/users/show/route.js
new file mode 100644
index 0000000..bc22dc0
--- /dev/null
+++ b/app/pods/protected/users/show/route.js
@@ -0,0 +1,8 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ model: function(params) {
+ return this.store.findRecord('user', params.user_id, { reload: true });
+ },
+
+});
diff --git a/app/pods/protected/users/show/template.hbs b/app/pods/protected/users/show/template.hbs
new file mode 100644
index 0000000..de032f9
--- /dev/null
+++ b/app/pods/protected/users/show/template.hbs
@@ -0,0 +1,49 @@
+
+
+
+
+{{#link-to 'protected.users.show' model.id class="button-gray smaller"}}
+ Change Password (Does nothing at the moment)
+{{/link-to}}
+{{#if model.canEdit}}
+
+ {{#link-to 'protected.user.edit' model.id class="button-gray smaller"}}
+ Edit
+ {{/link-to}}
+{{/if}}
diff --git a/app/router.js b/app/router.js
index 6eb5409..5f48eec 100644
--- a/app/router.js
+++ b/app/router.js
@@ -19,7 +19,10 @@ Router.map(function() {
this.route('protected', { path: '/' }, function() {
this.route('about');
- this.route('users');
+ this.route('users', function() {
+ this.route('show', { path: ':user_id' });
+ this.route('edit', { path: ':user_id/edit' });
+ });
this.route('compare', function() {
this.route('results');