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:
		
							parent
							
								
									2cca773f57
								
							
						
					
					
						commit
						33e7b92a8c
					
				
					 19 changed files with 100 additions and 137 deletions
				
			
		
							
								
								
									
										6
									
								
								app/pods/characteristics/controller.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/pods/characteristics/controller.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Controller.extend({
 | 
			
		||||
  sortParams: ['characteristicType.characteristicTypeName', 'characteristicName'],
 | 
			
		||||
  sortedCharacteristics: Ember.computed.sort('characteristics', 'sortParams'),
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +0,0 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Component.extend({
 | 
			
		||||
  tagName: 'tr',
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +0,0 @@
 | 
			
		|||
<td>
 | 
			
		||||
  {{data.characteristicName}}
 | 
			
		||||
</td>
 | 
			
		||||
<td>
 | 
			
		||||
  {{data.characteristicType.characteristicTypeName}}
 | 
			
		||||
</td>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,13 +0,0 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Component.extend({
 | 
			
		||||
  tagName: 'th',
 | 
			
		||||
  upArrow: '▲',
 | 
			
		||||
  downArrow: '▼',
 | 
			
		||||
 | 
			
		||||
  actions: {
 | 
			
		||||
    sortBy: function(sortProperty, ascending) {
 | 
			
		||||
      this.sendAction('action', sortProperty, ascending);
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -1,3 +0,0 @@
 | 
			
		|||
{{title}}
 | 
			
		||||
<span {{action 'sortBy' sortProperty true}}>{{{upArrow}}}</span>
 | 
			
		||||
<span {{action 'sortBy' sortProperty false}}>{{{downArrow}}}</span>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,14 +0,0 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Component.extend(Ember.SortableMixin, {
 | 
			
		||||
  tagName: 'table',
 | 
			
		||||
  classNames: ['flakes-table'],
 | 
			
		||||
  sortProperties: [],
 | 
			
		||||
 | 
			
		||||
  actions: {
 | 
			
		||||
    sortBy: function(property, ascending) {
 | 
			
		||||
      this.set('sortAscending', ascending);
 | 
			
		||||
      this.set('sortProperties', [property]);
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -1,13 +0,0 @@
 | 
			
		|||
<thead>
 | 
			
		||||
  <tr>
 | 
			
		||||
    {{#each tableAttrs as |a|}}
 | 
			
		||||
      {{sortable-table-header title=a.name sortProperty=a.attr action="sortBy"}}
 | 
			
		||||
    {{/each}}
 | 
			
		||||
  </tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
  {{#each arrangedContent as |item|}}
 | 
			
		||||
    {{component row data=item}}
 | 
			
		||||
  {{/each}}
 | 
			
		||||
</tbody>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +0,0 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Component.extend({
 | 
			
		||||
  tagName: 'tr',
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -1,15 +0,0 @@
 | 
			
		|||
<td>
 | 
			
		||||
  <em>
 | 
			
		||||
    {{#link-to 'species.show' data}}
 | 
			
		||||
      {{data.speciesName}}
 | 
			
		||||
    {{/link-to}}
 | 
			
		||||
  </em>
 | 
			
		||||
</td>
 | 
			
		||||
<td>
 | 
			
		||||
  {{#each data.strains as |strain index|}}
 | 
			
		||||
    {{if index ","}}
 | 
			
		||||
    {{#link-to 'strains.show' strain.id}}
 | 
			
		||||
      {{{strain.strainNameMU}}}
 | 
			
		||||
    {{/link-to}}
 | 
			
		||||
  {{/each}}
 | 
			
		||||
</td>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +0,0 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Component.extend({
 | 
			
		||||
  tagName: 'tr',
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -1,8 +0,0 @@
 | 
			
		|||
<td>
 | 
			
		||||
  {{#link-to 'strains.show' data.id classBinding="data.typeStrain:type-strain"}}
 | 
			
		||||
    {{data.fullNameMU}}
 | 
			
		||||
  {{/link-to}}
 | 
			
		||||
</td>
 | 
			
		||||
<td>
 | 
			
		||||
  {{data.totalMeasurements}}
 | 
			
		||||
</td>
 | 
			
		||||
							
								
								
									
										6
									
								
								app/pods/species/index/controller.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/pods/species/index/controller.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Controller.extend({
 | 
			
		||||
  sortParams: ['speciesName', 'strainCount'],
 | 
			
		||||
  sortedSpecies: Ember.computed.sort('species', 'sortParams'),
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -3,16 +3,12 @@ import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixi
 | 
			
		|||
 | 
			
		||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
 | 
			
		||||
  model: function() {
 | 
			
		||||
    return this.store.findAll('species');
 | 
			
		||||
    return Ember.RSVP.hash({
 | 
			
		||||
      species: this.store.findAll('species'),
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setupController: function(controller, model) {
 | 
			
		||||
    var tableAttrs = [
 | 
			
		||||
      { name: 'Name', attr: 'speciesName' },
 | 
			
		||||
      { name: 'Strains', attr: 'totalStrains' }
 | 
			
		||||
    ];
 | 
			
		||||
    controller.set('model', model);
 | 
			
		||||
    controller.set('tableAttrs', tableAttrs);
 | 
			
		||||
    controller.set('row', 'species-index-row');
 | 
			
		||||
    controller.set('sort', ['sortOrder']);
 | 
			
		||||
    controller.setProperties(model);
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,34 @@
 | 
			
		|||
<h2>{{genus-name}} Species</h2>
 | 
			
		||||
<h3>Total species: {{model.length}}</h3>
 | 
			
		||||
<h3>Total species: {{species.length}}</h3>
 | 
			
		||||
 | 
			
		||||
{{add-button label="Add Species" link="species.new"}}
 | 
			
		||||
 | 
			
		||||
{{
 | 
			
		||||
  sortable-table
 | 
			
		||||
  content=model
 | 
			
		||||
  tableAttrs=tableAttrs
 | 
			
		||||
  row=row
 | 
			
		||||
  sortProperties=sort
 | 
			
		||||
}}
 | 
			
		||||
<table class="flakes-table">
 | 
			
		||||
  <thead>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th>Name</th>
 | 
			
		||||
      <th>Strains</th>
 | 
			
		||||
    </tr>
 | 
			
		||||
  </thead>
 | 
			
		||||
  <tbody>
 | 
			
		||||
    {{#each sortedSpecies as |row|}}
 | 
			
		||||
      <tr>
 | 
			
		||||
        <td>
 | 
			
		||||
          <em>
 | 
			
		||||
            {{#link-to 'species.show' row}}
 | 
			
		||||
              {{row.speciesName}}
 | 
			
		||||
            {{/link-to}}
 | 
			
		||||
          </em>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
          {{#each row.strains as |strain index|}}
 | 
			
		||||
            {{if index ","}}
 | 
			
		||||
            {{#link-to 'strains.show' strain.id}}
 | 
			
		||||
              {{{strain.strainNameMU}}}
 | 
			
		||||
            {{/link-to}}
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
  </tbody>
 | 
			
		||||
</table>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								app/pods/strains/index/controller.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/pods/strains/index/controller.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Controller.extend({
 | 
			
		||||
  sortParams: ['fullNameMU', 'totalMeasurements'],
 | 
			
		||||
  sortedStrains: Ember.computed.sort('strains', 'sortParams'),
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -3,16 +3,12 @@ import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixi
 | 
			
		|||
 | 
			
		||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
 | 
			
		||||
  model: function() {
 | 
			
		||||
    return this.store.findAll('strain');
 | 
			
		||||
    return Ember.RSVP.hash({
 | 
			
		||||
      strains: this.store.findAll('strain'),
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setupController: function(controller, model) {
 | 
			
		||||
    var tableAttrs = [
 | 
			
		||||
      { name: 'Name', attr: 'fullNameMU' },
 | 
			
		||||
      { name: 'Total Measurements', attr: 'totalMeasurements' }
 | 
			
		||||
    ];
 | 
			
		||||
    controller.set('model', model);
 | 
			
		||||
    controller.set('tableAttrs', tableAttrs);
 | 
			
		||||
    controller.set('row', 'strain-index-row');
 | 
			
		||||
    controller.set('sort', ['sortOrder']);
 | 
			
		||||
    controller.setProperties(model);
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,27 @@
 | 
			
		|||
<h2>{{genus-name}} Strains</h2>
 | 
			
		||||
<h3>Total strains: {{model.length}}</h3>
 | 
			
		||||
<h3>Total strains: {{strains.length}}</h3>
 | 
			
		||||
 | 
			
		||||
{{add-button label="Add Strain" link="strains.new"}}
 | 
			
		||||
 | 
			
		||||
{{
 | 
			
		||||
  sortable-table
 | 
			
		||||
  content=model
 | 
			
		||||
  tableAttrs=tableAttrs
 | 
			
		||||
  row=row
 | 
			
		||||
  sortProperties=sort
 | 
			
		||||
}}
 | 
			
		||||
<table class="flakes-table">
 | 
			
		||||
  <thead>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th>Species</th>
 | 
			
		||||
      <th>Total Measurements</th>
 | 
			
		||||
    </tr>
 | 
			
		||||
  </thead>
 | 
			
		||||
  <tbody>
 | 
			
		||||
    {{#each sortedStrains as |row|}}
 | 
			
		||||
      <tr>
 | 
			
		||||
        <td>
 | 
			
		||||
          {{#link-to 'strains.show' row.id classBinding="data.typeStrain:type-strain"}}
 | 
			
		||||
            {{row.fullNameMU}}
 | 
			
		||||
          {{/link-to}}
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
          {{row.totalMeasurements}}
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
  </tbody>
 | 
			
		||||
</table>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue