More species-strain detail
This commit is contained in:
		
							parent
							
								
									f3aaa4739d
								
							
						
					
					
						commit
						7260b95937
					
				
					 8 changed files with 46 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,10 @@ import Ember from 'ember';
 | 
			
		|||
 | 
			
		||||
export default Ember.Route.extend({
 | 
			
		||||
  model: function() {
 | 
			
		||||
    return this.store.createRecord('strain');
 | 
			
		||||
    return Ember.RSVP.hash({
 | 
			
		||||
      strain: this.store.createRecord('strain'),
 | 
			
		||||
      species: this.store.findAll('species')
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  actions: {
 | 
			
		||||
    cancelStrain: function() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,22 @@
 | 
			
		|||
 | 
			
		||||
    {{! ROW 1 }}
 | 
			
		||||
    <div class="grid-4">
 | 
			
		||||
      <dl class="span-4">
 | 
			
		||||
      <dl class="span-2">
 | 
			
		||||
        <dt>Strains</dt>
 | 
			
		||||
        <dd>
 | 
			
		||||
          {{#each strain in species.strains}}
 | 
			
		||||
            {{#link-to 'strains.show' strain.id}}
 | 
			
		||||
              {{strain.strainName}}
 | 
			
		||||
            {{/link-to}}
 | 
			
		||||
          {{/each}}
 | 
			
		||||
          {{#if (can "edit species" species)}}
 | 
			
		||||
            {{#link-to 'strains.new' class="button-gray smaller"}}
 | 
			
		||||
              Add Strain
 | 
			
		||||
            {{/link-to}}
 | 
			
		||||
          {{/if}}
 | 
			
		||||
        </dd>
 | 
			
		||||
      </dl>
 | 
			
		||||
      <dl class="span-2">
 | 
			
		||||
        <dt>Type Species?</dt>
 | 
			
		||||
        <dd>
 | 
			
		||||
          {{#if isEditing}}
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +72,7 @@
 | 
			
		|||
    </div>
 | 
			
		||||
 | 
			
		||||
    {{! ROW 4 }}
 | 
			
		||||
    {{#if (can "edit species" strain)}}
 | 
			
		||||
    {{#if (can "edit species" species)}}
 | 
			
		||||
      <div class="grid-4">
 | 
			
		||||
        <div class="span-1">
 | 
			
		||||
          {{! Does nothing ATM }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,9 @@
 | 
			
		|||
              selection=strain.species
 | 
			
		||||
            }}
 | 
			
		||||
          {{else}}
 | 
			
		||||
            <em>{{strain.species.speciesName}}</em>
 | 
			
		||||
            {{#link-to 'species.show' strain.species}}
 | 
			
		||||
              <em>{{strain.species.speciesName}}</em>
 | 
			
		||||
            {{/link-to}}
 | 
			
		||||
          {{/if}}
 | 
			
		||||
        </dd>
 | 
			
		||||
      </dl>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,13 @@
 | 
			
		|||
            {{species.speciesName}}
 | 
			
		||||
          {{/link-to}}
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>{{species.totalStrains}}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
          {{#each strain in species.strains}}
 | 
			
		||||
            {{#link-to 'strains.show' strain.id}}
 | 
			
		||||
              {{strain.strainName}}
 | 
			
		||||
            {{/link-to}}
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
  </tbody>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@
 | 
			
		|||
  <thead>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th {{action "setSortBy" "fullName"}}>Name</th>
 | 
			
		||||
      <th {{action "setSortBy" "totalMeasurements"}}>Measurements</th>
 | 
			
		||||
      <th {{action "setSortBy" "totalMeasurements"}}>Total Measurements</th>
 | 
			
		||||
    </tr>
 | 
			
		||||
  </thead>
 | 
			
		||||
  <tbody>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1,8 @@
 | 
			
		|||
{{strains/strain-details strain=model isEditing=true isNew=true action="cancelStrain"}}
 | 
			
		||||
{{
 | 
			
		||||
  strains/strain-details
 | 
			
		||||
  strain=model.strain
 | 
			
		||||
  species=model.species
 | 
			
		||||
  isEditing=true
 | 
			
		||||
  isNew=true
 | 
			
		||||
  action="cancelStrain"
 | 
			
		||||
}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue