Add measurement count & speciesName to strain

This commit is contained in:
Matthew Dillon 2015-03-19 11:08:15 -08:00
parent ddc306ef29
commit 86b3fb46d7
4 changed files with 32 additions and 14 deletions

View file

@ -2,6 +2,7 @@ import DS from 'ember-data';
export default DS.Model.extend({ export default DS.Model.extend({
measurements: DS.hasMany('measurements', { async: true }), measurements: DS.hasMany('measurements', { async: true }),
speciesName: DS.attr('string'),
strainName: DS.attr('string'), strainName: DS.attr('string'),
strainType: DS.attr('string'), strainType: DS.attr('string'),
etymology: DS.attr('string'), etymology: DS.attr('string'),
@ -10,5 +11,6 @@ export default DS.Model.extend({
isolatedFrom: DS.attr('string'), isolatedFrom: DS.attr('string'),
createdAt: DS.attr('date'), createdAt: DS.attr('date'),
updatedAt: DS.attr('date'), updatedAt: DS.attr('date'),
deletedAt: DS.attr('date') deletedAt: DS.attr('date'),
totalMeasurements: DS.attr('number')
}); });

View file

@ -12,7 +12,7 @@
{{#each strain in model}} {{#each strain in model}}
<tr> <tr>
<td>{{link-to strain.strainName 'measurements' strain}}</td> <td>{{link-to strain.strainName 'measurements' strain}}</td>
<td></td> <td>{{strain.totalMeasurements}}</td>
</tr> </tr>
{{/each}} {{/each}}
</tbody> </tbody>

View file

@ -2,29 +2,41 @@
<div class="span-1"> <div class="span-1">
<fieldset class="flakes-information-box"> <fieldset class="flakes-information-box">
<legend>{{model.strainName}}</legend> <legend>{{model.strainName}}</legend>
{{! ROW 1 }}
<div class="grid-4"> <div class="grid-4">
<dl class="span-1"> <dl class="span-2">
<dt>Species</dt>
<dd>{{model.speciesName}}</dd>
</dl>
<dl class="span-2">
<dt>Type</dt> <dt>Type</dt>
<dd>{{model.strainType}}</dd> <dd>{{model.strainType}}</dd>
</dl> </dl>
<dl class="span-1"> </div>
<dt>Etymology</dt> {{! ROW 2 }}
<dd>{{model.etymology}}</dd> <div class="grid-4">
</dl> <dl class="span-2">
<dl class="span-1">
<dt>Accession Banks</dt> <dt>Accession Banks</dt>
<dd>{{model.accessionBanks}}</dd> <dd>{{model.accessionBanks}}</dd>
</dl> </dl>
<dl class="span-1"> <dl class="span-2">
<dt>Genbank</dt> <dt>Genbank</dt>
<dd>{{model.genbankEmblDdb}}</dd> <dd>{{model.genbankEmblDdb}}</dd>
</dl> </dl>
</div> </div>
{{! ROW 3 }}
<div class="grid-4"> <div class="grid-4">
<dl class="span-1"> <dl class="span-2">
<dt>Etymology</dt>
<dd>{{model.etymology}}</dd>
</dl>
<dl class="span-2">
<dt>Isolated From</dt> <dt>Isolated From</dt>
<dd>{{model.isolatedFrom}}</dd> <dd>{{model.isolatedFrom}}</dd>
</dl> </dl>
</div>
{{! ROW 4 }}
<div class="grid-4">
<dl class="span-1"> <dl class="span-1">
<dt>Record Created</dt> <dt>Record Created</dt>
<dd>{{null-time model.createdAt 'LL'}}</dd> <dd>{{null-time model.createdAt 'LL'}}</dd>

View file

@ -5,7 +5,7 @@ module.exports = function(app) {
var STRAINS = [ var STRAINS = [
{ {
id: 1, id: 1,
species: 1, speciesName: "Species One",
strainName: "Strain One", strainName: "Strain One",
strainType: "Test Type", strainType: "Test Type",
etymology: "Test Etymology", etymology: "Test Etymology",
@ -16,10 +16,11 @@ module.exports = function(app) {
createdAt: "0001-01-01T00:00:00Z", createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z", updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null, deletedAt: null,
totalMeasurements: 5,
}, },
{ {
id: 2, id: 2,
species: 2, speciesName: "Species Two",
strainName: "Strain Two", strainName: "Strain Two",
strainType: "Test Type", strainType: "Test Type",
etymology: "Test Etymology", etymology: "Test Etymology",
@ -30,10 +31,11 @@ module.exports = function(app) {
createdAt: "0001-01-01T00:00:00Z", createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z", updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null, deletedAt: null,
totalMeasurements: 5,
}, },
{ {
id: 3, id: 3,
species: 3, speciesName: "Species Three",
strainName: "Strain Three", strainName: "Strain Three",
strainType: "Test Type", strainType: "Test Type",
etymology: "Test Etymology", etymology: "Test Etymology",
@ -44,10 +46,11 @@ module.exports = function(app) {
createdAt: "0001-01-01T00:00:00Z", createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z", updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null, deletedAt: null,
totalMeasurements: 0,
}, },
{ {
id: 4, id: 4,
species: 4, speciesName: "Species Four",
strainName: "Strain Four", strainName: "Strain Four",
strainType: "Test Type", strainType: "Test Type",
etymology: "Test Etymology", etymology: "Test Etymology",
@ -58,6 +61,7 @@ module.exports = function(app) {
createdAt: "0001-01-01T00:00:00Z", createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z", updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null, deletedAt: null,
totalMeasurements: 0,
} }
]; ];