diff --git a/app/models/measurement.js b/app/models/measurement.js new file mode 100644 index 0000000..671480b --- /dev/null +++ b/app/models/measurement.js @@ -0,0 +1,15 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + strain: DS.belongsTo('strain'), + characteristic: DS.attr('string'), + textMeasurementType: DS.attr('string'), + txtValue: DS.attr('string'), + numValue: DS.attr('number'), + confidenceInterval: DS.attr('number'), + unitType: DS.attr('string'), + notes: DS.attr('string'), + testMethod: DS.attr('string'), + createdAt: DS.attr('date'), + updatedAt: DS.attr('date') +}); diff --git a/app/models/strain.js b/app/models/strain.js index 3bd7de2..cbde6ed 100644 --- a/app/models/strain.js +++ b/app/models/strain.js @@ -1,6 +1,7 @@ import DS from 'ember-data'; export default DS.Model.extend({ + measurements: DS.hasMany('measurements', { async: true }), strainName: DS.attr('string'), strainType: DS.attr('string'), etymology: DS.attr('string'), diff --git a/app/router.js b/app/router.js index 4f8d6ef..9a11680 100644 --- a/app/router.js +++ b/app/router.js @@ -9,7 +9,9 @@ Router.map(function() { this.route('login'); this.route('about'); this.resource('strains', function() { - this.route('show', { path: ':strain_id' }); + this.route('show', { path: ':strain_id' }, function() { + this.resource('measurements', function() {}); + }); }); }); diff --git a/app/routes/measurements.js b/app/routes/measurements.js new file mode 100644 index 0000000..26d9f31 --- /dev/null +++ b/app/routes/measurements.js @@ -0,0 +1,4 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ +}); diff --git a/app/routes/measurements/index.js b/app/routes/measurements/index.js new file mode 100644 index 0000000..fdf177a --- /dev/null +++ b/app/routes/measurements/index.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function() { + return this.modelFor('strains/show').get('measurements'); + } +}); diff --git a/app/styles/app.css b/app/styles/app.css index e69de29..f160708 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -0,0 +1,3 @@ +.measurements-container { + padding: 2em 0em 0em 0em; +} diff --git a/app/templates/measurements.hbs b/app/templates/measurements.hbs new file mode 100644 index 0000000..c24cd68 --- /dev/null +++ b/app/templates/measurements.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/app/templates/measurements/index.hbs b/app/templates/measurements/index.hbs new file mode 100644 index 0000000..c20b937 --- /dev/null +++ b/app/templates/measurements/index.hbs @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + {{#each measurement in model}} + + + + + + + + + + + {{/each}} + +
CharacteristicText Meas. TypeText ValueNum. ValueConfidence Int.UnitNotesTest Method
{{measurement.characteristic}}{{measurement.textMeasurementType}}{{measurement.txtValue}}{{measurement.numValue}}{{measurement.confidenceInterval}}{{measurement.unitType}}{{measurement.notes}}{{measurement.testMethod}}
diff --git a/app/templates/strains/index.hbs b/app/templates/strains/index.hbs index 55a9bd2..6351378 100644 --- a/app/templates/strains/index.hbs +++ b/app/templates/strains/index.hbs @@ -11,7 +11,7 @@ {{#each strain in model}} - {{link-to strain.strainName 'strains.show' strain}} + {{link-to strain.strainName 'measurements' strain}} {{/each}} diff --git a/app/templates/strains/show.hbs b/app/templates/strains/show.hbs index 3f25fdd..35085a3 100644 --- a/app/templates/strains/show.hbs +++ b/app/templates/strains/show.hbs @@ -38,3 +38,6 @@ +
+ {{outlet}} +
diff --git a/tests/unit/models/measurement-test.js b/tests/unit/models/measurement-test.js new file mode 100644 index 0000000..e2bed8e --- /dev/null +++ b/tests/unit/models/measurement-test.js @@ -0,0 +1,15 @@ +import { + moduleForModel, + test +} from 'ember-qunit'; + +moduleForModel('measurement', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('it exists', function(assert) { + var model = this.subject(); + // var store = this.store(); + assert.ok(!!model); +}); diff --git a/tests/unit/routes/measurements-test.js b/tests/unit/routes/measurements-test.js new file mode 100644 index 0000000..53395b7 --- /dev/null +++ b/tests/unit/routes/measurements-test.js @@ -0,0 +1,14 @@ +import { + moduleFor, + test +} from 'ember-qunit'; + +moduleFor('route:measurements', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +}); diff --git a/tests/unit/routes/measurements/index-test.js b/tests/unit/routes/measurements/index-test.js new file mode 100644 index 0000000..ce045c0 --- /dev/null +++ b/tests/unit/routes/measurements/index-test.js @@ -0,0 +1,14 @@ +import { + moduleFor, + test +} from 'ember-qunit'; + +moduleFor('route:measurements/index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + var route = this.subject(); + assert.ok(route); +});