Component cleanup (dropping sortable table)

+ remove `sortable-table`
+ remove `sortable-table-header`
+ remove `characteristic-index-row`
+ remove `species-index-row`
+ remove `strain-index-row`
This commit is contained in:
Matthew Dillon 2015-06-29 07:19:20 -08:00
parent 2cca773f57
commit 33e7b92a8c
19 changed files with 100 additions and 137 deletions

View file

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

View file

@ -8,14 +8,8 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
characteristics: this.store.findAll('characteristic'),
});
},
setupController: function(controller, models) {
var tableAttrs = [
{ name: 'Name', attr: 'characteristicName' },
{ name: 'Type', attr: 'characteristicType.characteristicTypeName' }
];
controller.set('model', models.characteristics);
controller.set('tableAttrs', tableAttrs);
controller.set('row', 'characteristic-index-row');
controller.set('sort', ['characteristicType.characteristicTypeName', 'sortOrder']);
controller.setProperties(models);
},
});

View file

@ -1,10 +1,19 @@
<h2>{{genus-name}} Characteristics</h2>
<h3>Total characteristics: {{model.length}}</h3>
<h3>Total characteristics: {{characteristics.length}}</h3>
{{
sortable-table
content=model
tableAttrs=tableAttrs
row=row
sortProperties=sort
}}
<table class="flakes-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody>
{{#each sortedCharacteristics as |row|}}
<tr>
<td>{{row.characteristicName}}</td>
<td>{{row.characteristicType.characteristicTypeName}}</td>
</tr>
{{/each}}
</tbody>
</table>