protected route

This commit is contained in:
Matthew Dillon 2015-07-10 09:29:12 -08:00
parent 72c957f8dc
commit eb1a8bb6e3
41 changed files with 56 additions and 43 deletions

View file

@ -0,0 +1,6 @@
import Ember from 'ember';
export default Ember.Controller.extend({
sortParams: ['characteristicType.characteristicTypeName', 'sortOrder'],
sortedCharacteristics: Ember.computed.sort('characteristics', 'sortParams'),
});

View file

@ -0,0 +1,15 @@
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function() {
return Ember.RSVP.hash({
characteristicTypes: this.store.findAll('characteristic-type'),
characteristics: this.store.findAll('characteristic'),
});
},
setupController: function(controller, models) {
controller.setProperties(models);
},
});

View file

@ -0,0 +1,21 @@
<h2>{{genus-name}} Characteristics</h2>
<h3>Total characteristics: {{characteristics.length}}</h3>
<table class="flakes-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Sort Order</th>
</tr>
</thead>
<tbody>
{{#each sortedCharacteristics as |row|}}
<tr>
<td>{{row.characteristicName}}</td>
<td>{{row.characteristicType.characteristicTypeName}}</td>
<td>{{row.sortOrder}}</td>
</tr>
{{/each}}
</tbody>
</table>