Refactor characteristics/index

This commit is contained in:
Matthew Dillon 2015-11-05 13:31:49 -07:00
parent e6c6cac212
commit 9715aac1f5
5 changed files with 44 additions and 40 deletions

View file

@ -0,0 +1,12 @@
import Ember from 'ember';
import SetupMetaData from '../../../../../mixins/setup-metadata';
const { Component } = Ember;
export default Component.extend(SetupMetaData, {
characteristics: null,
sortParams: ['characteristicTypeName', 'sortOrder', 'characteristicName'],
sortedCharacteristics: Ember.computed.sort('characteristics', 'sortParams'),
});

View file

@ -0,0 +1,26 @@
<h3 id="total-characteristics">Total characteristics: {{characteristics.length}}</h3>
{{add-button label="Add Characteristic" link="protected.characteristics.new" canAdd=metaData.canAdd}}
<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>
{{#link-to 'protected.characteristics.show' row}}
{{row.characteristicName}}
{{/link-to}}
</td>
<td>{{row.characteristicTypeName}}</td>
<td>{{row.sortOrder}}</td>
</tr>
{{/each}}
</tbody>
</table>