update merge from master
This commit is contained in:
commit
f295082592
88 changed files with 771 additions and 675 deletions
4
app/pods/protected/about/route.js
Normal file
4
app/pods/protected/about/route.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin);
|
3
app/pods/protected/about/template.hbs
Normal file
3
app/pods/protected/about/template.hbs
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div class="about">
|
||||
<p>This is some information about clostridium.info</p>
|
||||
</div>
|
6
app/pods/protected/characteristics/controller.js
Normal file
6
app/pods/protected/characteristics/controller.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sortParams: ['characteristicTypeName', 'sortOrder'],
|
||||
sortedCharacteristics: Ember.computed.sort('model', 'sortParams'),
|
||||
});
|
9
app/pods/protected/characteristics/route.js
Normal file
9
app/pods/protected/characteristics/route.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function() {
|
||||
return this.store.findAll('characteristic');
|
||||
},
|
||||
|
||||
});
|
21
app/pods/protected/characteristics/template.hbs
Normal file
21
app/pods/protected/characteristics/template.hbs
Normal file
|
@ -0,0 +1,21 @@
|
|||
<h2>{{genus-name}} Characteristics</h2>
|
||||
<h3>Total characteristics: {{model.length}}</h3>
|
||||
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Sort Order</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each sortedCharacteristics as |row|}}
|
||||
<tr>
|
||||
<td>{{row.characteristicName}}</td>
|
||||
<td>{{row.characteristicTypeName}}</td>
|
||||
<td>{{row.sortOrder}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
14
app/pods/protected/compare/controller.js
Normal file
14
app/pods/protected/compare/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
search: function() {
|
||||
let query = {
|
||||
strain_ids: this.get('selectedStrains'),
|
||||
characteristic_ids: this.get('selectedCharacteristics'),
|
||||
};
|
||||
|
||||
this.transitionToRoute('protected.compare.results', {queryParams: query});
|
||||
}
|
||||
}
|
||||
});
|
50
app/pods/protected/compare/results/controller.js
Normal file
50
app/pods/protected/compare/results/controller.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
queryParams: ['strain_ids', 'characteristic_ids'],
|
||||
|
||||
strains: function() {
|
||||
let strains = [];
|
||||
let strain_ids = this.get('strain_ids').split(',');
|
||||
strain_ids.forEach((id) => {
|
||||
strains.push(this.store.peekRecord('strain', id));
|
||||
})
|
||||
return strains;
|
||||
}.property('strain_ids'),
|
||||
|
||||
characteristics: function() {
|
||||
let characteristics = [];
|
||||
let characteristic_ids = this.get('characteristic_ids').split(',');
|
||||
characteristic_ids.forEach((id) => {
|
||||
characteristics.push(this.store.peekRecord('characteristic', id));
|
||||
})
|
||||
return characteristics;
|
||||
}.property('characteristic_ids'),
|
||||
|
||||
// Set up data table matrix
|
||||
data: function() {
|
||||
let characteristics = this.get('characteristics');
|
||||
let strains = this.get('strains');
|
||||
let measurements = this.get('model');
|
||||
let data = Ember.A();
|
||||
|
||||
characteristics.forEach((characteristic) => {
|
||||
let row = {
|
||||
characteristic: characteristic.get('characteristicName'),
|
||||
};
|
||||
|
||||
strains.forEach((strain) => {
|
||||
let meas = measurements.filterBy('strain.id', strain.get('id'))
|
||||
.filterBy('characteristic.id', characteristic.get('id'));
|
||||
if (!Ember.isEmpty(meas)) {
|
||||
row[strain.get('id')] = meas[0].get('value');
|
||||
} else {
|
||||
row[strain.get('id')] = '';
|
||||
}
|
||||
});
|
||||
data.pushObject(row);
|
||||
});
|
||||
return data;
|
||||
}.property('characteristics', 'strains'),
|
||||
|
||||
});
|
11
app/pods/protected/compare/results/route.js
Normal file
11
app/pods/protected/compare/results/route.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function(params) {
|
||||
let compare = this.controllerFor('protected.compare');
|
||||
compare.set('selectedStrains', params.strain_ids);
|
||||
compare.set('selectedCharacteristics', params.characteristic_ids);
|
||||
return this.store.query('measurement', params);
|
||||
},
|
||||
|
||||
});
|
26
app/pods/protected/compare/results/template.hbs
Normal file
26
app/pods/protected/compare/results/template.hbs
Normal file
|
@ -0,0 +1,26 @@
|
|||
<div class="overflow-div">
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Characteristic</th>
|
||||
{{#each strains as |strain|}}
|
||||
<th>
|
||||
{{#link-to 'protected.strains.show' strain.id classBinding="data.typeStrain:type-strain"}}
|
||||
{{strain.fullNameMU}}
|
||||
{{/link-to}}
|
||||
</th>
|
||||
{{/each}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data as |row|}}
|
||||
<tr>
|
||||
<td>{{row.characteristic}}</td>
|
||||
{{#each strains as |strain|}}
|
||||
<td>{{get-property row strain.id}}</td>
|
||||
{{/each}}
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
13
app/pods/protected/compare/route.js
Normal file
13
app/pods/protected/compare/route.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function() {
|
||||
return this.store.findAll('characteristic');
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
controller.set('characteristics', this.store.peekAll('characteristic'));
|
||||
controller.set('strains', this.store.peekAll('strain'));
|
||||
},
|
||||
|
||||
});
|
41
app/pods/protected/compare/template.hbs
Normal file
41
app/pods/protected/compare/template.hbs
Normal file
|
@ -0,0 +1,41 @@
|
|||
<h2>{{genus-name}} - Compare Strains</h2>
|
||||
|
||||
<div class="span-1">
|
||||
<fieldset>
|
||||
<form>
|
||||
<ul>
|
||||
<li>
|
||||
<label>Strains</label>
|
||||
{{
|
||||
select-2
|
||||
multiple=true
|
||||
content=strains
|
||||
value=selectedStrains
|
||||
optionValuePath="id"
|
||||
optionLabelPath="fullNameMU"
|
||||
placeholder="Select one or more strains"
|
||||
}}
|
||||
</li>
|
||||
<li>
|
||||
<label>Characteristics</label>
|
||||
{{
|
||||
select-2
|
||||
multiple=true
|
||||
content=characteristics
|
||||
value=selectedCharacteristics
|
||||
optionValuePath="id"
|
||||
optionLabelPath="characteristicName"
|
||||
placeholder="Select one or more characteristics"
|
||||
}}
|
||||
</li>
|
||||
<li>
|
||||
<a class="action button-gray smaller right" {{action 'search'}}>
|
||||
Search
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
{{outlet}}
|
9
app/pods/protected/index/route.js
Normal file
9
app/pods/protected/index/route.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
this.transitionTo('protected.compare');
|
||||
}
|
||||
});
|
1
app/pods/protected/index/template.hbs
Normal file
1
app/pods/protected/index/template.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
Welcome
|
4
app/pods/protected/measurements/route.js
Normal file
4
app/pods/protected/measurements/route.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {});
|
3
app/pods/protected/measurements/template.hbs
Normal file
3
app/pods/protected/measurements/template.hbs
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h2>{{genus-name}} Measurements</h2>
|
||||
|
||||
Be back soon
|
12
app/pods/protected/route.js
Normal file
12
app/pods/protected/route.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
import parseBase64 from '../../utils/parse-base64';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function() {
|
||||
let token = this.get('session.secure.token');
|
||||
let user = parseBase64(token);
|
||||
return this.store.find('user', user.sub);
|
||||
},
|
||||
|
||||
});
|
29
app/pods/protected/species/edit/controller.js
Normal file
29
app/pods/protected/species/edit/controller.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
save: function() {
|
||||
let species = this.get('model');
|
||||
|
||||
if (species.get('isDirty')) {
|
||||
species.save().then((species) => {
|
||||
this.transitionToRoute('protected.species.show', species);
|
||||
}, (err) => {
|
||||
this.get('flashMessages').error(err.responseJSON.error);
|
||||
});
|
||||
} else {
|
||||
this.transitionToRoute('protected.species.show', species);
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
let species = this.get('model');
|
||||
|
||||
species.get('errors').clear();
|
||||
species.rollback();
|
||||
|
||||
this.transitionToRoute('protected.species.show', species);
|
||||
},
|
||||
|
||||
},
|
||||
});
|
11
app/pods/protected/species/edit/route.js
Normal file
11
app/pods/protected/species/edit/route.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
afterModel: function(species) {
|
||||
if (!species.get('canEdit')) {
|
||||
this.transitionTo('species.show', species.get('id'));
|
||||
}
|
||||
},
|
||||
|
||||
});
|
6
app/pods/protected/species/edit/template.hbs
Normal file
6
app/pods/protected/species/edit/template.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{
|
||||
forms/species-form
|
||||
species=model
|
||||
save="save"
|
||||
cancel="cancel"
|
||||
}}
|
11
app/pods/protected/species/index/controller.js
Normal file
11
app/pods/protected/species/index/controller.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sortParams: ['speciesName', 'strainCount'],
|
||||
sortedSpecies: Ember.computed.sort('model', 'sortParams'),
|
||||
|
||||
metaData: function() {
|
||||
return Ember.copy(this.store.metadataFor('species'));
|
||||
}.property('model.isLoaded').readOnly(),
|
||||
|
||||
});
|
7
app/pods/protected/species/index/route.js
Normal file
7
app/pods/protected/species/index/route.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function() {
|
||||
return this.store.findAll('species');
|
||||
}
|
||||
});
|
34
app/pods/protected/species/index/template.hbs
Normal file
34
app/pods/protected/species/index/template.hbs
Normal file
|
@ -0,0 +1,34 @@
|
|||
<h2>{{genus-name}} Species</h2>
|
||||
<h3>Total species: {{model.length}}</h3>
|
||||
|
||||
{{add-button label="Add Species" link="protected.species.new" canAdd=metaData.canAdd}}
|
||||
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Strains</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each sortedSpecies as |species|}}
|
||||
<tr>
|
||||
<td>
|
||||
<em>
|
||||
{{#link-to 'protected.species.show' species}}
|
||||
{{species.speciesName}}
|
||||
{{/link-to}}
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
{{#each species.strains as |strain index|}}
|
||||
{{if index ","}}
|
||||
{{#link-to 'protected.strains.show' strain.id}}
|
||||
{{{strain.strainNameMU}}}
|
||||
{{/link-to}}
|
||||
{{/each}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
25
app/pods/protected/species/new/controller.js
Normal file
25
app/pods/protected/species/new/controller.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
save: function() {
|
||||
let species = this.get('model');
|
||||
|
||||
if (species.get('isDirty')) {
|
||||
species.save().then((species) => {
|
||||
this.transitionToRoute('protected.species.show', species.get('id'));
|
||||
}, (err) => {
|
||||
this.get('flashMessages').error(err.responseJSON.error);
|
||||
});
|
||||
} else {
|
||||
species.deleteRecord();
|
||||
this.transitionToRoute('protected.species.index');
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
this.transitionToRoute('protected.species.index');
|
||||
},
|
||||
|
||||
},
|
||||
});
|
27
app/pods/protected/species/new/route.js
Normal file
27
app/pods/protected/species/new/route.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
if (this.get('session.currentUser.role') === 'R') {
|
||||
this.transitionTo('species.index');
|
||||
}
|
||||
},
|
||||
|
||||
model: function() {
|
||||
return this.store.createRecord('species');
|
||||
},
|
||||
|
||||
actions: {
|
||||
willTransition: function(/*transition*/) {
|
||||
let controller = this.get('controller');
|
||||
let species = controller.get('model');
|
||||
|
||||
if (species.get('isNew')) {
|
||||
species.deleteRecord();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
});
|
6
app/pods/protected/species/new/template.hbs
Normal file
6
app/pods/protected/species/new/template.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{
|
||||
forms/species-form
|
||||
species=model
|
||||
save="save"
|
||||
cancel="cancel"
|
||||
}}
|
9
app/pods/protected/species/show/route.js
Normal file
9
app/pods/protected/species/show/route.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function(params) {
|
||||
return this.store.findRecord('species', params.species_id, { reload: true });
|
||||
},
|
||||
|
||||
});
|
65
app/pods/protected/species/show/template.hbs
Normal file
65
app/pods/protected/species/show/template.hbs
Normal file
|
@ -0,0 +1,65 @@
|
|||
<div class="grid-1">
|
||||
<div class="span-1">
|
||||
<fieldset class="flakes-information-box {{if isEditing 'is-editing'}}">
|
||||
<legend>
|
||||
Species <em>{{model.speciesName}}</em>
|
||||
</legend>
|
||||
|
||||
{{! ROW 1 }}
|
||||
<div class="grid-2 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Strains</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
{{#each model.strains as |strain index|}}
|
||||
<li>
|
||||
{{#link-to 'protected.strains.show' strain.id}}
|
||||
{{{strain.strainNameMU}}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Type Species?</dt>
|
||||
<dd>
|
||||
{{if model.typeSpecies 'Yes' 'No'}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{! ROW 2 }}
|
||||
<div class="grid-1 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Etymology</dt>
|
||||
<dd>
|
||||
{{model.etymology}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{! ROW 3 }}
|
||||
<div class="grid-3 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Record Created</dt>
|
||||
<dd>{{null-time model.createdAt 'LL'}}</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Record Updated</dt>
|
||||
<dd>{{null-time model.updatedAt 'LL'}}</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Record Deleted</dt>
|
||||
<dd>{{null-time model.deletedAt 'LL'}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
{{#if model.canEdit}}
|
||||
<br>
|
||||
{{#link-to 'protected.species.edit' model class="button-gray smaller"}}
|
||||
Edit
|
||||
{{/link-to}}
|
||||
{{/if}}
|
30
app/pods/protected/strains/edit/controller.js
Normal file
30
app/pods/protected/strains/edit/controller.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
save: function() {
|
||||
let strain = this.get('strain');
|
||||
|
||||
if (strain.get('isDirty')) {
|
||||
strain.save().then((strain) => {
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
}, (err) => {
|
||||
this.get('flashMessages').error(err.responseJSON.error);
|
||||
});
|
||||
} else {
|
||||
strain.deleteRecord();
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
let strain = this.get('protected.strain');
|
||||
|
||||
strain.get('errors').clear();
|
||||
strain.rollback();
|
||||
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
},
|
||||
|
||||
},
|
||||
});
|
22
app/pods/protected/strains/edit/route.js
Normal file
22
app/pods/protected/strains/edit/route.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function(params) {
|
||||
return Ember.RSVP.hash({
|
||||
strain: this.store.find('strain', params.strain_id),
|
||||
species: this.store.findAll('species'), // Need for dropdown
|
||||
});
|
||||
},
|
||||
|
||||
afterModel: function(models) {
|
||||
if (!models.strain.get('canEdit')) {
|
||||
this.transitionTo('strains.show', models.strain.get('id'));
|
||||
}
|
||||
},
|
||||
|
||||
setupController: function(controller, models) {
|
||||
controller.setProperties(models);
|
||||
},
|
||||
|
||||
});
|
7
app/pods/protected/strains/edit/template.hbs
Normal file
7
app/pods/protected/strains/edit/template.hbs
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{
|
||||
forms/strain-form
|
||||
strain=strain
|
||||
species=species
|
||||
save="save"
|
||||
cancel="cancel"
|
||||
}}
|
11
app/pods/protected/strains/index/controller.js
Normal file
11
app/pods/protected/strains/index/controller.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sortParams: ['fullNameMU', 'totalMeasurements'],
|
||||
sortedStrains: Ember.computed.sort('model', 'sortParams'),
|
||||
|
||||
metaData: function() {
|
||||
return Ember.copy(this.store.metadataFor('strain'));
|
||||
}.property('model.isLoaded').readOnly(),
|
||||
|
||||
});
|
8
app/pods/protected/strains/index/route.js
Normal file
8
app/pods/protected/strains/index/route.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function() {
|
||||
return this.store.findAll('strain');
|
||||
},
|
||||
});
|
27
app/pods/protected/strains/index/template.hbs
Normal file
27
app/pods/protected/strains/index/template.hbs
Normal file
|
@ -0,0 +1,27 @@
|
|||
<h2>{{genus-name}} Strains</h2>
|
||||
<h3>Total strains: {{model.length}}</h3>
|
||||
|
||||
{{add-button label="Add Strain" link="protected.strains.new" canAdd=metaData.canAdd}}
|
||||
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Species</th>
|
||||
<th>Total Measurements</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each sortedStrains as |row|}}
|
||||
<tr>
|
||||
<td>
|
||||
{{#link-to 'protected.strains.show' row.id classBinding="data.typeStrain:type-strain"}}
|
||||
{{row.fullNameMU}}
|
||||
{{/link-to}}
|
||||
</td>
|
||||
<td>
|
||||
{{row.totalMeasurements}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
24
app/pods/protected/strains/new/controller.js
Normal file
24
app/pods/protected/strains/new/controller.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
save: function() {
|
||||
let strain = this.get('strain');
|
||||
|
||||
if (strain.get('isDirty')) {
|
||||
strain.save().then((strain) => {
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
}, (err) => {
|
||||
this.get('flashMessages').error(err.responseJSON.error);
|
||||
});
|
||||
} else {
|
||||
this.transitionToRoute('protected.strains.index');
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
this.transitionToRoute('protected.strains.index');
|
||||
},
|
||||
|
||||
},
|
||||
});
|
34
app/pods/protected/strains/new/route.js
Normal file
34
app/pods/protected/strains/new/route.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
if (this.get('session.currentUser.role') === 'R') {
|
||||
this.transitionTo('strains.index');
|
||||
}
|
||||
},
|
||||
|
||||
model: function() {
|
||||
return Ember.RSVP.hash({
|
||||
strain: this.store.createRecord('strain'),
|
||||
species: this.store.findAll('species'), // Need for dropdown
|
||||
});
|
||||
},
|
||||
|
||||
setupController: function(controller, models) {
|
||||
controller.setProperties(models);
|
||||
},
|
||||
|
||||
actions: {
|
||||
willTransition: function(/*transition*/) {
|
||||
let controller = this.get('controller');
|
||||
let strain = controller.get('strain');
|
||||
|
||||
if (strain.get('isNew')) {
|
||||
strain.deleteRecord();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
});
|
7
app/pods/protected/strains/new/template.hbs
Normal file
7
app/pods/protected/strains/new/template.hbs
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{
|
||||
forms/strain-form
|
||||
strain=strain
|
||||
species=species
|
||||
save="save"
|
||||
cancel="cancel"
|
||||
}}
|
9
app/pods/protected/strains/show/route.js
Normal file
9
app/pods/protected/strains/show/route.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model: function(params) {
|
||||
return this.store.findRecord('strain', params.strain_id, { reload: true });
|
||||
},
|
||||
|
||||
});
|
89
app/pods/protected/strains/show/template.hbs
Normal file
89
app/pods/protected/strains/show/template.hbs
Normal file
|
@ -0,0 +1,89 @@
|
|||
<div class="span-1">
|
||||
<fieldset class="flakes-information-box {{if isEditing 'is-editing'}}">
|
||||
<legend>
|
||||
Strain {{model.strainNameMU}}
|
||||
</legend>
|
||||
|
||||
{{! ROW 1 }}
|
||||
<div class="grid-2 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Species</dt>
|
||||
<dd>
|
||||
{{#link-to 'protected.species.show' model.species.id}}
|
||||
<em>{{model.species.speciesNameMU}}</em>
|
||||
{{/link-to}}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Type Strain?</dt>
|
||||
<dd>
|
||||
{{if model.typeStrain 'Yes' 'No'}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{! ROW 2 }}
|
||||
<div class="grid-3 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Accession Numbers</dt>
|
||||
<dd>
|
||||
{{model.accessionNumbers}}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Genbank</dt>
|
||||
<dd>
|
||||
{{genbank-url genbank=model.genbank}}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Whole Genome Sequence</dt>
|
||||
<dd>
|
||||
{{model.wholeGenomeSequence}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{! ROW 3 }}
|
||||
<div class="grid-1 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Isolated From</dt>
|
||||
<dd>
|
||||
{{model.isolatedFrom}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{! ROW 4 }}
|
||||
<div class="grid-1 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Notes</dt>
|
||||
<dd>
|
||||
{{model.notes}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{{! ROW 5 }}
|
||||
<div class="grid-3 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Record Created</dt>
|
||||
<dd>{{null-time model.createdAt 'LL'}}</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Record Updated</dt>
|
||||
<dd>{{null-time model.updatedAt 'LL'}}</dd>
|
||||
</dl>
|
||||
<dl class="span-1">
|
||||
<dt>Record Deleted</dt>
|
||||
<dd>{{null-time model.deletedAt 'LL'}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{#if model.canEdit}}
|
||||
<br>
|
||||
{{#link-to 'protected.strains.edit' model.id class="button-gray smaller"}}
|
||||
Edit
|
||||
{{/link-to}}
|
||||
{{/if}}
|
3
app/pods/protected/template.hbs
Normal file
3
app/pods/protected/template.hbs
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{#x-application invalidateSession="invalidateSession"}}
|
||||
{{outlet}}
|
||||
{{/x-application}}
|
Reference in a new issue