diff --git a/app/pods/components/scientific-name/template.hbs b/app/pods/components/scientific-name/template.hbs index 0c517d2..1f3609e 100644 --- a/app/pods/components/scientific-name/template.hbs +++ b/app/pods/components/scientific-name/template.hbs @@ -1 +1 @@ -{{strain.species.speciesName}} (strain {{strain.strainName}}) +{{strain.species.speciesName}} (strain {{strain-name strain=strain}}) diff --git a/app/pods/components/species-details/template.hbs b/app/pods/components/species-details/template.hbs index 0071880..756a6a0 100644 --- a/app/pods/components/species-details/template.hbs +++ b/app/pods/components/species-details/template.hbs @@ -5,7 +5,7 @@ {{#if isEditing}} {{input value=species.speciesName}} {{else}} - {{species.speciesName}} + {{species.speciesName}} {{/if}} {{display-errors a=species.errors.speciesName}} @@ -18,7 +18,7 @@ {{#each species.strains as |strain index|}} {{if index ","}} {{#link-to 'strains.show' strain.id}} - {{strain.strainName}} + {{strain-name strain=strain}} {{/link-to}} {{/each}} {{#unless species.isNew}} diff --git a/app/pods/components/species-index-row/template.hbs b/app/pods/components/species-index-row/template.hbs index 3038aa9..e3455a7 100644 --- a/app/pods/components/species-index-row/template.hbs +++ b/app/pods/components/species-index-row/template.hbs @@ -9,7 +9,7 @@ {{#each data.strains as |strain index|}} {{if index ","}} {{#link-to 'strains.show' strain.id}} - {{strain.strainName}} + {{strain-name strain=strain}} {{/link-to}} {{/each}} diff --git a/app/pods/components/strain-details/template.hbs b/app/pods/components/strain-details/template.hbs index c49d5f4..f2d648f 100644 --- a/app/pods/components/strain-details/template.hbs +++ b/app/pods/components/strain-details/template.hbs @@ -5,7 +5,7 @@ {{#if isEditing}} {{input value=strain.strainName}} {{else}} - {{strain.strainName}} + {{strain.strainName}} {{/if}} {{display-errors a=strain.errors.strainName}} diff --git a/app/pods/components/strain-index-row/template.hbs b/app/pods/components/strain-index-row/template.hbs index acd0c58..4d64b0b 100644 --- a/app/pods/components/strain-index-row/template.hbs +++ b/app/pods/components/strain-index-row/template.hbs @@ -1,5 +1,5 @@ - {{#link-to 'strains.show' data.id}} + {{#link-to 'strains.show' data.id classBinding="data.typeStrain:type-strain"}} {{scientific-name strain=data}} {{/link-to}} diff --git a/app/pods/components/strain-name/component.js b/app/pods/components/strain-name/component.js new file mode 100644 index 0000000..ced0374 --- /dev/null +++ b/app/pods/components/strain-name/component.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + tagName: 'span', +}); diff --git a/app/pods/components/strain-name/template.hbs b/app/pods/components/strain-name/template.hbs new file mode 100644 index 0000000..3082ce7 --- /dev/null +++ b/app/pods/components/strain-name/template.hbs @@ -0,0 +1 @@ +{{strain.strainName}}{{{if strain.typeStrain 'T'}}} diff --git a/app/styles/app.css b/app/styles/app.css index 61a0502..b5d48ca 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -10,6 +10,10 @@ background-color: #FFFCE2; } +.type-strain { + color: #5CA934; +} + /* BEGIN https://github.com/tobiasahlin/SpinKit */ .spinner { width: 40px; diff --git a/tests/unit/pods/components/strain-name/component-test.js b/tests/unit/pods/components/strain-name/component-test.js new file mode 100644 index 0000000..3874bf8 --- /dev/null +++ b/tests/unit/pods/components/strain-name/component-test.js @@ -0,0 +1,19 @@ +import { moduleForComponent, test } from 'ember-qunit'; + +moduleForComponent('strain-name', 'Unit | Component | strain name', { + // Specify the other units that are required for this test + // needs: ['component:foo', 'helper:bar'], + unit: true +}); + +test('it renders', function(assert) { + assert.expect(2); + + // Creates the component instance + var component = this.subject(); + assert.equal(component._state, 'preRender'); + + // Renders the component to the page + this.render(); + assert.equal(component._state, 'inDOM'); +});