Working on users
This commit is contained in:
parent
be8a842c67
commit
425dd689ae
7 changed files with 117 additions and 5 deletions
|
@ -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');
|
||||
},
|
||||
|
|
|
@ -1,3 +1,33 @@
|
|||
{{#each model as |user|}}
|
||||
{{user.email}}<br>
|
||||
{{/each}}
|
||||
<h2>{{genus-name}} Users</h2>
|
||||
<h3>Total users: {{model.length}}</h3>
|
||||
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Role</th>
|
||||
<th>Date Registered</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each model as |row|}}
|
||||
<tr>
|
||||
<td>
|
||||
{{#link-to 'protected.users.show' row}}
|
||||
{{row.name}}
|
||||
{{/link-to}}
|
||||
</td>
|
||||
<td>
|
||||
{{row.email}}
|
||||
</td>
|
||||
<td>
|
||||
{{row.fullRole}}
|
||||
</td>
|
||||
<td>
|
||||
{{null-time row.createdAt 'LL'}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Reference in a new issue