Refactor users/index

This commit is contained in:
Matthew Dillon 2015-11-05 17:48:58 -07:00
parent 2d7d22f847
commit e6510992dc
5 changed files with 49 additions and 33 deletions

View file

@ -1,7 +1,9 @@
import Ember from 'ember';
export default Ember.Route.extend({
currentUser: Ember.inject.service('session-account'),
const { Route, inject: { service } } = Ember;
export default Route.extend({
currentUser: service('session-account'),
beforeModel: function(transition) {
this._super(transition);

View file

@ -1,33 +1,6 @@
<h2>{{genus-name}} Users</h2>
<h3 id="total-users">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>
{{
protected/users/index/users-table
users=model
}}

View file

@ -0,0 +1,7 @@
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
users: null,
});

View file

@ -0,0 +1,33 @@
<h3 id="total-users">Total users: {{users.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 users as |user|}}
<tr>
<td>
{{#link-to 'protected.users.show' user}}
{{user.name}}
{{/link-to}}
</td>
<td>
{{user.email}}
</td>
<td>
{{user.fullRole}}
</td>
<td>
{{null-time user.createdAt 'LL'}}
</td>
</tr>
{{/each}}
</tbody>
</table>

View file

@ -0,0 +1 @@
{{loading-panel}}