Restructuring forms

This commit is contained in:
Matthew Dillon 2015-09-04 10:30:36 -07:00
parent e58d01f999
commit f59de829ee
8 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,5 @@
{{
forms/strain-form
protected/strains/strain-form
strain=strain
species=species
save="save"

View file

@ -1,5 +1,5 @@
{{
forms/strain-form
protected/strains/strain-form
strain=strain
species=species
save="save"

View file

@ -0,0 +1,17 @@
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
save: function() {
// Need to override the string id for some reason
let strain = this.get('strain');
let id = strain.get('species.id');
strain.set('species.id', +id);
this.sendAction('save');
},
cancel: function() {
this.sendAction('cancel');
},
}
});

View file

@ -0,0 +1,61 @@
<form class="grid-form" {{action 'save' on='submit'}}>
<fieldset>
<legend><em>{{strain.strainName}}</em></legend>
<div data-row-span="2">
<div data-field-span="1">
<label>Strain Name</label>
{{input value=strain.strainName}}
</div>
<div data-field-span="1">
<label>Type Strain?</label>
{{input type="checkbox" checked=strain.typeStrain}} {{if strain.typeStrain 'Yes' 'No'}}
</div>
</div>
<div data-row-span="2">
<div data-field-span="2">
<label>Species</label>
{{
select-2
content=species
optionLabelPath="speciesName"
value=strain.species
}}
</div>
</div>
<div data-row-span="2">
<div data-field-span="2">
<label>Isolated From</label>
{{text-editor value=strain.isolatedFrom}}
</div>
</div>
<div data-row-span="3">
<div data-field-span="1">
<label>Accession Numbers</label>
{{input value=strain.accessionNumbers}}
</div>
<div data-field-span="1">
<label>GenBank</label>
{{input value=strain.genbank}}
</div>
<div data-field-span="1">
<label>Whole Genome Sequence</label>
{{input value=strain.wholeGenomeSequence}}
</div>
</div>
<div data-row-span="2">
<div data-field-span="2">
<label>Notes</label>
{{text-editor value=strain.notes}}
</div>
</div>
</fieldset>
<br>
<a class="button-red smaller" {{action 'cancel'}}>
Cancel
</a>
{{#if strain.hasDirtyAttributes}}
<button type="submit" class="button-green smaller">
Save
</button>
{{/if}}
</form>