Sortable table component
This commit is contained in:
parent
e623d52f34
commit
6ba5cf2322
23 changed files with 225 additions and 74 deletions
|
@ -1,5 +0,0 @@
|
|||
import SortableController from '../../controllers/sortable';
|
||||
|
||||
export default SortableController.extend({
|
||||
sortBy: 'characteristicName',
|
||||
});
|
|
@ -4,5 +4,14 @@ import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixi
|
|||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function() {
|
||||
return this.store.findAll('characteristic');
|
||||
}
|
||||
},
|
||||
setupController: function(controller, model) {
|
||||
var tableAttrs = [
|
||||
{ name: 'Name', attr: 'characteristicName' },
|
||||
{ name: 'Type', attr: 'characteristicType' }
|
||||
];
|
||||
controller.set('model', model);
|
||||
controller.set('tableAttrs', tableAttrs);
|
||||
controller.set('row', 'characteristic-index-row');
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
<h2>{{genus-name}} Characteristics</h2>
|
||||
<h3>Total characteristics: {{controller.length}}</h3>
|
||||
<h3>Total characteristics: {{model.length}}</h3>
|
||||
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th {{action "setSortBy" "characteristicName"}}>Name</th>
|
||||
<th {{action "setSortBy" "characteristicType"}}>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each characteristic in controller}}
|
||||
<tr>
|
||||
<td>{{characteristic.characteristicName}}</td>
|
||||
<td>{{characteristic.characteristicType}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{sortable-table content=model tableAttrs=tableAttrs row=row}}
|
||||
|
|
Reference in a new issue