Compare commits
67 commits
master
...
clostridiu
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4f4b5d8a4d | ||
![]() |
b3c646cb18 | ||
![]() |
26dcecaa05 | ||
![]() |
d2c1609e86 | ||
![]() |
935a3511de | ||
![]() |
732e8482a5 | ||
![]() |
d6d9c92ef6 | ||
![]() |
ab964bbca1 | ||
![]() |
7c503876ac | ||
![]() |
acb17480ec | ||
![]() |
019031dd58 | ||
![]() |
838588da54 | ||
![]() |
74e901380e | ||
![]() |
2aa432376f | ||
![]() |
4aaa9cdfb9 | ||
![]() |
0815e4c4c9 | ||
![]() |
d93f4a3152 | ||
![]() |
aa4ca05897 | ||
![]() |
09650e0f1b | ||
![]() |
6574f4986c | ||
![]() |
27c2788bd2 | ||
![]() |
8730b6659f | ||
![]() |
dc5b54cfbf | ||
![]() |
0a039e57c4 | ||
![]() |
6bdbacf978 | ||
![]() |
d674d07951 | ||
![]() |
6509f63f00 | ||
![]() |
6810c209d8 | ||
![]() |
6a8a4c1a36 | ||
![]() |
80bd608045 | ||
![]() |
fd9157007a | ||
![]() |
c17abc6829 | ||
38daf6ea5b | |||
7665452f72 | |||
13f8c5afcc | |||
![]() |
f6a175980a | ||
![]() |
075585c54f | ||
![]() |
c505afd0fe | ||
![]() |
421831b5a6 | ||
![]() |
096e2dca20 | ||
![]() |
418b294634 | ||
![]() |
56888c7fba | ||
![]() |
f4939a962e | ||
![]() |
53650c7808 | ||
![]() |
1ce84c7269 | ||
![]() |
9696313568 | ||
![]() |
4d7cc5fc56 | ||
![]() |
765bc45ce7 | ||
![]() |
b5a260615b | ||
![]() |
8c3bf30ace | ||
![]() |
c996dd5374 | ||
![]() |
cbac28e040 | ||
![]() |
cca97e7542 | ||
![]() |
14a678092e | ||
![]() |
0ab0cf5a6a | ||
![]() |
f295082592 | ||
![]() |
8ab97c00e1 | ||
![]() |
9e8b02ac90 | ||
![]() |
3436989a89 | ||
![]() |
583d7ca0db | ||
![]() |
38894d94e7 | ||
![]() |
ae7f3bdafa | ||
![]() |
4bbf931853 | ||
![]() |
9aed858982 | ||
![]() |
622cd0faaf | ||
![]() |
236a622505 | ||
![]() |
6d04a8a6c8 |
27 changed files with 114 additions and 13305 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,4 +15,3 @@
|
|||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
testem.log
|
||||
.firebase
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# hymenobacterdotinfo
|
||||
# clostridiumdotinfo
|
||||
|
||||
This ember application is an interface for the [bactdb](https://github.com/thermokarst/bactdb).
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>hymenobacter.info</title>
|
||||
<title>clostridium.info</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="initial-scale=1.0, maximum-scale=10.0, minimum-scale=1.0, user-scalable=yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
@ -12,7 +12,7 @@
|
|||
{{content-for 'head'}}
|
||||
|
||||
<link rel="stylesheet" href="assets/vendor.css">
|
||||
<link rel="stylesheet" href="assets/hymenobacterdotinfo.css">
|
||||
<link rel="stylesheet" href="assets/clostridiumdotinfo.css">
|
||||
|
||||
{{content-for 'head-footer'}}
|
||||
</head>
|
||||
|
@ -20,7 +20,7 @@
|
|||
{{content-for 'body'}}
|
||||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/hymenobacterdotinfo.js"></script>
|
||||
<script src="assets/clostridiumdotinfo.js"></script>
|
||||
|
||||
{{content-for 'body-footer'}}
|
||||
</body>
|
||||
|
|
|
@ -7,7 +7,7 @@ export default function() {
|
|||
|
||||
export function testConfig() {
|
||||
this.urlPrefix = 'https://bactdb-test.herokuapp.com';
|
||||
this.namespace = '/api/hymenobacter';
|
||||
this.namespace = '/api/clostridium';
|
||||
this.timing = 0;
|
||||
|
||||
this.get('/users');
|
||||
|
|
|
@ -8,10 +8,7 @@ export default Mixin.create({
|
|||
actions: {
|
||||
delete: function() {
|
||||
this.get('model').destroyRecord().then(() => {
|
||||
// Instead of unloading the entire store, we keep the loaded user models
|
||||
['species', 'strain', 'characteristic', 'measurement'].map((model) => {
|
||||
this.get('store').unloadAll(model);
|
||||
});
|
||||
this.get('store').unloadAll();
|
||||
this.transitionToRoute(this.get('transitionRoute'));
|
||||
});
|
||||
},
|
||||
|
|
|
@ -10,7 +10,3 @@
|
|||
<div>
|
||||
{{link-to 'Forget your password?' 'users.requestlockouthelp'}}
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
Just checking things out? Log in with email <code>read-only</code> and password <code>bacteria</code>!
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<div class="about">
|
||||
<p>This is some information about hymenobacter.info</p>
|
||||
<p>This is some information about clostridium.info</p>
|
||||
</div>
|
||||
|
|
|
@ -1,61 +1,36 @@
|
|||
import Ember from 'ember';
|
||||
import SaveModel from '../../../../mixins/save-model';
|
||||
import ajaxError from '../../../../utils/ajax-error';
|
||||
|
||||
const { Controller, RSVP, inject: { service } } = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
ajaxError: service('ajax-error'),
|
||||
const { Controller } = Ember;
|
||||
|
||||
export default Controller.extend(SaveModel, {
|
||||
// Required for SaveModel mixin
|
||||
fallbackRouteSave: 'protected.strains.show',
|
||||
fallbackRouteCancel: 'protected.strains.show',
|
||||
|
||||
actions: {
|
||||
save: function(properties, deleteQueue, updateQueue) {
|
||||
let promises = [];
|
||||
properties.measurements.forEach((measurement) => {
|
||||
if (measurement.get('isNew')) {
|
||||
promises.push(measurement.save());
|
||||
}
|
||||
});
|
||||
|
||||
updateQueue.forEach((measurement) => {
|
||||
promises.push(measurement.save());
|
||||
});
|
||||
|
||||
deleteQueue.forEach((measurement) => {
|
||||
promises.push(measurement.destroyRecord());
|
||||
});
|
||||
|
||||
const model = this.get('model');
|
||||
const fallbackRoute = this.get('fallbackRouteSave');
|
||||
|
||||
RSVP.all(promises).then(() => {
|
||||
// Can't call _super inside promise, have to reproduce save-model
|
||||
// mixin here :-(
|
||||
model.setProperties(properties);
|
||||
model.save().then((model) => {
|
||||
this.get('flashMessages').clearMessages();
|
||||
this.transitionToRoute(fallbackRoute, model);
|
||||
});
|
||||
}, (errors) => {
|
||||
this.get('ajaxError').alert(errors);
|
||||
addCharacteristic: function() {
|
||||
return this.store.createRecord('measurement', {
|
||||
characteristic: this.store.createRecord('characteristic', { sortOrder: -999 }),
|
||||
});
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
const model = this.get('model');
|
||||
saveMeasurement: function(measurement, properties) {
|
||||
measurement.setProperties(properties);
|
||||
measurement.save().then(() => {
|
||||
this.get('flashMessages').clearMessages();
|
||||
}, () => {
|
||||
ajaxError(measurement.get('errors'), this.get('flashMessages'));
|
||||
});
|
||||
},
|
||||
|
||||
model.get('errors').clear();
|
||||
model.rollbackAttributes();
|
||||
|
||||
if (model.get('isNew')) {
|
||||
this.transitionToRoute(this.get('fallbackRouteCancel'));
|
||||
} else {
|
||||
this.transitionToRoute(this.get('fallbackRouteCancel'), model);
|
||||
deleteMeasurement: function(measurement) {
|
||||
const characteristic = measurement.get('characteristic');
|
||||
if (characteristic.get('isNew')) {
|
||||
characteristic.destroyRecord();
|
||||
}
|
||||
},
|
||||
|
||||
addMeasurement: function() {
|
||||
return this.store.createRecord('measurement');
|
||||
measurement.destroyRecord();
|
||||
},
|
||||
|
||||
},
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
protected/strains/strain-form
|
||||
strain=model
|
||||
speciesList=speciesList
|
||||
add-measurement=(action "addMeasurement")
|
||||
add-characteristic=(action "addCharacteristic")
|
||||
allCharacteristics=allCharacteristics
|
||||
save-measurement=(action "saveMeasurement")
|
||||
delete-measurement=(action "deleteMeasurement")
|
||||
on-save=(action "save")
|
||||
on-cancel=(action "cancel")
|
||||
}}
|
||||
|
|
|
@ -10,8 +10,6 @@ export default Component.extend({
|
|||
allCharacteristics: null,
|
||||
measurement: null,
|
||||
isDirty: null,
|
||||
isNew: false,
|
||||
isQueued: false,
|
||||
|
||||
// Actions
|
||||
"save-measurement": null,
|
||||
|
@ -24,23 +22,11 @@ export default Component.extend({
|
|||
notes: null,
|
||||
|
||||
resetOnInit: Ember.on('init', function() {
|
||||
this._resetProperties();
|
||||
}),
|
||||
|
||||
_resetProperties: function() {
|
||||
this.get('propertiesList').forEach((field) => {
|
||||
const valueInMeasurement = this.get('measurement').get(field);
|
||||
this.set(field, valueInMeasurement);
|
||||
});
|
||||
// Read-only attributes
|
||||
this.set('isNew', this.get('measurement.isNew'));
|
||||
if (this.get('isNew') && !this.get('isQueued')) {
|
||||
this.set('isEditing', true);
|
||||
} else {
|
||||
this.set('isEditing', false);
|
||||
}
|
||||
this.set('isDirty', false);
|
||||
},
|
||||
}),
|
||||
|
||||
updateField: function(property, value) {
|
||||
this.set(property, value);
|
||||
|
@ -54,22 +40,12 @@ export default Component.extend({
|
|||
|
||||
actions: {
|
||||
edit: function() {
|
||||
this.set('isEditing', true);
|
||||
this.toggleProperty('isEditing');
|
||||
},
|
||||
|
||||
save: function() {
|
||||
this.attrs['save-measurement'](this.get('measurement'), this.getProperties(this.get('propertiesList')));
|
||||
this.set('isQueued', true);
|
||||
this._resetProperties();
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
if (this.get('isNew')) {
|
||||
this.attrs['delete-measurement'](this.get('measurement'));
|
||||
} else {
|
||||
this._resetProperties();
|
||||
this.set('isEditing', false);
|
||||
}
|
||||
this.toggleProperty('isEditing');
|
||||
},
|
||||
|
||||
delete: function() {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{{loading-panel}}
|
|
@ -1,7 +1,5 @@
|
|||
{{#if isEditing}}
|
||||
<td>
|
||||
{{{characteristic.characteristicTypeName}}}
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<select onchange={{action "characteristicDidChange" value="target.value"}}>
|
||||
{{#each allCharacteristics as |characteristicChoice|}}
|
||||
|
@ -17,13 +15,14 @@
|
|||
</td>
|
||||
{{#if canEdit}}
|
||||
<td>
|
||||
<button class="button-gray smaller" {{action 'cancel'}}>
|
||||
{{#if isDirty}}
|
||||
<button class="button-green smaller" {{action 'save'}}>
|
||||
Save
|
||||
</button>
|
||||
{{else}}
|
||||
<button class="button-gray smaller" {{action 'save'}}>
|
||||
Cancel
|
||||
</button>
|
||||
{{#if isDirty}}
|
||||
<button class="button-green smaller" {{action 'save'}}>
|
||||
Save
|
||||
</button>
|
||||
{{/if}}
|
||||
</td>
|
||||
{{/if}}
|
||||
|
|
|
@ -5,13 +5,13 @@ const { sort } = computed;
|
|||
|
||||
export default Component.extend({
|
||||
// Passed in
|
||||
measurements: null,
|
||||
strain: null,
|
||||
allCharacteristics: null,
|
||||
canEdit: false,
|
||||
canAdd: false,
|
||||
|
||||
// Actions
|
||||
"add-measurement": null,
|
||||
"add-characteristic": null,
|
||||
"save-measurement": null,
|
||||
"delete-measurement": null,
|
||||
|
||||
|
@ -19,11 +19,15 @@ export default Component.extend({
|
|||
sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'],
|
||||
sortAsc: true,
|
||||
paramsChanged: false,
|
||||
sortedMeasurements: sort('measurements', 'sortParams'),
|
||||
sortedMeasurements: sort('strain.measurements', 'sortParams'),
|
||||
measurementsPresent: computed('strain.measurements', function() {
|
||||
return this.get('strain.measurements.length') > 0;
|
||||
}),
|
||||
|
||||
actions: {
|
||||
addMeasurement: function() {
|
||||
return this.attrs['add-measurement']();
|
||||
addCharacteristic: function() {
|
||||
const newChar = this.attrs['add-characteristic']();
|
||||
this.get('strain.measurements').addObject(newChar);
|
||||
},
|
||||
|
||||
changeSortParam: function(col) {
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
{{#if canAdd}}
|
||||
<br>
|
||||
<button class="button-green smaller" {{action "addMeasurement"}}>
|
||||
Add measurement
|
||||
<button class="button-green smaller" {{action "addCharacteristic"}}>
|
||||
Add characteristic
|
||||
</button>
|
||||
<br><br>
|
||||
{{/if}}
|
||||
|
||||
{{#if paramsChanged}}
|
||||
<button class="button-gray smaller" {{action 'resetSortParam'}}>
|
||||
Reset sort
|
||||
</button>
|
||||
{{/if}}
|
||||
{{#if measurementsPresent}}
|
||||
{{#if paramsChanged}}
|
||||
<button class="button-gray smaller" {{action 'resetSortParam'}}>
|
||||
Reset sort
|
||||
</button>
|
||||
{{/if}}
|
||||
<table class="flakes-table">
|
||||
<colgroup>
|
||||
{{#if canEdit}}
|
||||
|
@ -47,10 +48,9 @@
|
|||
allCharacteristics=allCharacteristics
|
||||
canEdit=canEdit
|
||||
}}
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan="5">No Measurements on Record</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
No measurements on record.
|
||||
{{/if}}
|
||||
|
|
|
@ -71,11 +71,11 @@
|
|||
{{! ROW 5 }}
|
||||
<div class="grid-1 gutter-20">
|
||||
<dl class="span-1">
|
||||
<dt>Characteristic Measurements</dt>
|
||||
<dt>Characteristics</dt>
|
||||
<dd>
|
||||
{{
|
||||
protected/strains/measurements-table
|
||||
measurements=strain.measurements
|
||||
strain=strain
|
||||
canEdit=false
|
||||
canAdd=false
|
||||
}}
|
||||
|
|
|
@ -9,22 +9,22 @@ export default Component.extend(SetupMetaData, {
|
|||
isNew: null,
|
||||
isDirty: false,
|
||||
speciesList: null,
|
||||
allCharacteristics: [],
|
||||
updateQueue: [],
|
||||
deleteQueue: [],
|
||||
allCharacteristics: null,
|
||||
|
||||
// Actions
|
||||
"on-save": null,
|
||||
"on-cancel": null,
|
||||
"on-update": null,
|
||||
"add-measurements": null,
|
||||
"add-characteristic": null,
|
||||
"save-measurement": null,
|
||||
"delete-measurement": null,
|
||||
|
||||
// CPs
|
||||
sortParams: ['sortOrder'],
|
||||
sortedSpeciesList: sort('speciesList', 'sortParams'),
|
||||
|
||||
// Property mapping
|
||||
propertiesList: ['strainName', 'typeStrain', 'species', 'isolatedFrom', 'accessionNumbers', 'genbank', 'wholeGenomeSequence', 'notes', 'measurements'],
|
||||
propertiesList: ['strainName', 'typeStrain', 'species', 'isolatedFrom', 'accessionNumbers', 'genbank', 'wholeGenomeSequence', 'notes'],
|
||||
strainName: null,
|
||||
typeStrain: null,
|
||||
species: null,
|
||||
|
@ -33,55 +33,15 @@ export default Component.extend(SetupMetaData, {
|
|||
genbank: null,
|
||||
wholeGenomeSequence: null,
|
||||
notes: null,
|
||||
measurements: [],
|
||||
|
||||
// Dropdown menu
|
||||
characteristics: [],
|
||||
charSortParams: ['characteristicTypeName', 'sortOrder', 'characteristicName'],
|
||||
sortedCharacteristics: sort('characteristics', 'charSortParams'),
|
||||
setupCharacteristics: Ember.on('init', function() {
|
||||
const tempArray = this._resetArray(this.get('allCharacteristics'));
|
||||
this.set('characteristics', tempArray);
|
||||
}),
|
||||
|
||||
resetOnInit: Ember.on('init', function() {
|
||||
this._resetProperties();
|
||||
}),
|
||||
|
||||
_resetArray: function(arr) {
|
||||
let tempArray = [];
|
||||
arr.forEach((val) => {
|
||||
if (!val.get('isNew')) {
|
||||
tempArray.push(val);
|
||||
}
|
||||
});
|
||||
return tempArray;
|
||||
},
|
||||
|
||||
_resetProperties: function() {
|
||||
// Still some coupling going on here because of adding strain to measurement
|
||||
this.get('measurements').forEach((val) => {
|
||||
if (val.get('hasDirtyAttributes')) {
|
||||
val.rollbackAttributes();
|
||||
}
|
||||
if (val.get('isNew')) {
|
||||
this.get('strain.measurements').removeObject(val);
|
||||
}
|
||||
});
|
||||
this.get('propertiesList').forEach((field) => {
|
||||
const valueInStrain = this.get('strain').get(field);
|
||||
if (field === 'measurements') {
|
||||
const tempArray = this._resetArray(valueInStrain);
|
||||
this.set(field, tempArray);
|
||||
} else {
|
||||
this.set(field, valueInStrain);
|
||||
}
|
||||
this.set(field, valueInStrain);
|
||||
});
|
||||
this.set('updateQueue', []);
|
||||
this.set('deleteQueue', []);
|
||||
// Read-only attributes
|
||||
this.set('isNew', this.get('strain.isNew'));
|
||||
},
|
||||
}),
|
||||
|
||||
updateField: function(property, value) {
|
||||
this.set(property, value);
|
||||
|
@ -95,32 +55,23 @@ export default Component.extend(SetupMetaData, {
|
|||
|
||||
actions: {
|
||||
save: function() {
|
||||
return this.attrs['on-save'](this.getProperties(this.get('propertiesList')), this.get('deleteQueue'), this.get('updateQueue'));
|
||||
return this.attrs['on-save'](this.getProperties(this.get('propertiesList')));
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
this._resetProperties();
|
||||
return this.attrs['on-cancel']();
|
||||
},
|
||||
|
||||
addMeasurement: function() {
|
||||
const measurement = this.attrs['add-measurement']();
|
||||
this.get('measurements').pushObject(measurement);
|
||||
addCharacteristic: function() {
|
||||
return this.attrs['add-characteristic']();
|
||||
},
|
||||
|
||||
saveMeasurement: function(measurement, properties) {
|
||||
measurement.setProperties(properties);
|
||||
measurement.set('strain', this.get('strain'));
|
||||
if (!measurement.get('isNew')) {
|
||||
this.get('updateQueue').pushObject(measurement);
|
||||
}
|
||||
this.set('isDirty', true);
|
||||
return this.attrs['save-measurement'](measurement, properties);
|
||||
},
|
||||
|
||||
deleteMeasurement: function(measurement) {
|
||||
this.get('deleteQueue').pushObject(measurement);
|
||||
this.get('measurements').removeObject(measurement);
|
||||
this.set('isDirty', true);
|
||||
return this.attrs['delete-measurement'](measurement);
|
||||
},
|
||||
|
||||
strainNameDidChange: function(value) {
|
||||
|
@ -153,7 +104,7 @@ export default Component.extend(SetupMetaData, {
|
|||
},
|
||||
|
||||
notesDidChange: function(value) {
|
||||
this.updateField('notes', value);
|
||||
this.updateField('strain.notes', value);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -61,9 +61,9 @@
|
|||
<div>
|
||||
{{
|
||||
protected/strains/measurements-table
|
||||
measurements=measurements
|
||||
add-measurement=(action "addMeasurement")
|
||||
allCharacteristics=sortedCharacteristics
|
||||
strain=strain
|
||||
add-characteristic=(action "addCharacteristic")
|
||||
allCharacteristics=allCharacteristics
|
||||
save-measurement=(action "saveMeasurement")
|
||||
delete-measurement=(action "deleteMeasurement")
|
||||
canEdit=strain.canEdit
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
import ajaxErrorNew from '../../../../utils/ajax-error-new';
|
||||
|
||||
const { Controller, inject: { service } } = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
session: service(),
|
||||
ajax: service(),
|
||||
ajaxError: service('ajax-error'),
|
||||
currentUser: service('session-account'),
|
||||
|
||||
actions: {
|
||||
|
@ -15,13 +15,12 @@ export default Controller.extend({
|
|||
this.get('ajax').post('/users/password', { data: data }).then(() => {
|
||||
this.transitionToRoute('protected.users.show', id);
|
||||
this.get('flashMessages').information('Your password has been changed.');
|
||||
}, (errors) => {
|
||||
this.get('ajaxError').alert(errors);
|
||||
}, (error) => {
|
||||
ajaxErrorNew(error, this.get('flashMessages'));
|
||||
});
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
this.get('flashMessages').clearMessages();
|
||||
this.transitionToRoute('protected.users.show', this.get('currentUser.account.id'));
|
||||
},
|
||||
},
|
||||
|
|
|
@ -5,41 +5,24 @@ const { RESTSerializer } = DS;
|
|||
const { isNone } = Ember;
|
||||
|
||||
export default RESTSerializer.extend({
|
||||
serializeBelongsTo: function(snapshot, json, relationship) {
|
||||
const key = relationship.key;
|
||||
if (this._canSerialize(key)) {
|
||||
const belongsToId = snapshot.belongsTo(key, { id: true });
|
||||
let payloadKey = this._getMappedKey(key, snapshot.type);
|
||||
if (payloadKey === key && this.keyForRelationship) {
|
||||
payloadKey = this.keyForRelationship(key, "belongsTo", "serialize");
|
||||
}
|
||||
if (isNone(belongsToId)) {
|
||||
json[payloadKey] = null;
|
||||
} else {
|
||||
json[payloadKey] = +belongsToId;
|
||||
}
|
||||
isNewSerializerAPI: true,
|
||||
|
||||
if (relationship.options.polymorphic) {
|
||||
this.serializePolymorphicType(snapshot, json, relationship);
|
||||
}
|
||||
}
|
||||
serializeBelongsTo: function(snapshot, json, relationship) {
|
||||
let key = relationship.key;
|
||||
const belongsTo = snapshot.belongsTo(key);
|
||||
key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;
|
||||
json[key] = isNone(belongsTo) ? belongsTo : +belongsTo.record.id;
|
||||
},
|
||||
|
||||
serializeHasMany: function(snapshot, json, relationship) {
|
||||
const key = relationship.key;
|
||||
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
|
||||
const hasMany = snapshot.hasMany(key, { ids: true });
|
||||
if (hasMany !== undefined) {
|
||||
let payloadKey = this._getMappedKey(key, snapshot.type);
|
||||
if (payloadKey === key && this.keyForRelationship) {
|
||||
payloadKey = this.keyForRelationship(key, "hasMany", "serialize");
|
||||
}
|
||||
json[payloadKey] = [];
|
||||
hasMany.forEach((item) => {
|
||||
json[payloadKey].push(+item);
|
||||
});
|
||||
}
|
||||
}
|
||||
let key = relationship.key;
|
||||
const hasMany = snapshot.hasMany(key);
|
||||
key = this.keyForRelationship ? this.keyForRelationship(key, "hasMany", "serialize") : key;
|
||||
|
||||
json[key] = [];
|
||||
hasMany.forEach((item) => {
|
||||
json[key].push(+item.id);
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Service, inject: { service } } = Ember;
|
||||
|
||||
export default Service.extend({
|
||||
flashMessages: service(),
|
||||
|
||||
alert: function(error) {
|
||||
const flash = this.get('flashMessages');
|
||||
|
||||
flash.clearMessages();
|
||||
window.scrollTo(0,0);
|
||||
error.errors.forEach((error) => {
|
||||
console.error(error);
|
||||
const source = error.source.pointer.split('/');
|
||||
flash.error(`${source[source.length-1].replace(/([A-Z])/g, ' $1').capitalize()} - ${error.detail}`);
|
||||
});
|
||||
}
|
||||
});
|
7
app/utils/ajax-error-new.js
Normal file
7
app/utils/ajax-error-new.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
export default function ajaxErrorNew(error, flash) {
|
||||
flash.clearMessages();
|
||||
error.errors.forEach((error) => {
|
||||
const source = error.source.pointer.split('/');
|
||||
flash.error(`${source[source.length-1].replace(/([A-Z])/g, ' $1').capitalize()} - ${error.detail}`);
|
||||
});
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "hymenobacterdotinfo",
|
||||
"name": "clostridiumdotinfo",
|
||||
"dependencies": {
|
||||
"jquery": "~2.1.1",
|
||||
"ember": "~2.2.0",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module.exports = function(environment) {
|
||||
var ENV = {
|
||||
modulePrefix: 'hymenobacterdotinfo',
|
||||
modulePrefix: 'clostridiumdotinfo',
|
||||
environment: environment,
|
||||
baseURL: '/',
|
||||
locationType: 'auto',
|
||||
|
@ -12,9 +12,9 @@ module.exports = function(environment) {
|
|||
}
|
||||
},
|
||||
APP: {
|
||||
genus: 'hymenobacter',
|
||||
genus: 'clostridium',
|
||||
},
|
||||
podModulePrefix: 'hymenobacterdotinfo/pods',
|
||||
podModulePrefix: 'clostridiumdotinfo/pods',
|
||||
flashMessageDefaults: {
|
||||
sticky: true,
|
||||
type: 'error',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"firebase": "hymenobacter-test",
|
||||
"firebase": "clostridium-test",
|
||||
"public": "./dist",
|
||||
"ignore": [
|
||||
"firebase.json",
|
||||
|
|
13051
package-lock.json
generated
13051
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "hymenobacterdotinfo",
|
||||
"name": "clostridiumdotinfo",
|
||||
"version": "0.0.0",
|
||||
"description": "Small description for hymenobacterdotinfo goes here",
|
||||
"description": "Small description for clostridiumdotinfo goes here",
|
||||
"private": true,
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
|
@ -10,11 +10,7 @@
|
|||
"scripts": {
|
||||
"build": "ember build",
|
||||
"start": "ember server",
|
||||
"test": "ember test",
|
||||
"bower": "bower",
|
||||
"ember": "ember",
|
||||
"firebase": "firebase",
|
||||
"deployProd": "firebase deploy -e prod"
|
||||
"test": "ember test"
|
||||
},
|
||||
"repository": "",
|
||||
"engines": {
|
||||
|
@ -44,9 +40,5 @@
|
|||
"ember-export-application-global": "^1.0.4",
|
||||
"ember-one-way-input": "0.1.3",
|
||||
"ember-simple-auth": "1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"bower": "^1.8.8",
|
||||
"firebase-tools": "^7.12.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Hymenobacterdotinfo Tests</title>
|
||||
<title>clostridiumdotinfo Tests</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
{{content-for 'test-head'}}
|
||||
|
||||
<link rel="stylesheet" href="assets/vendor.css">
|
||||
<link rel="stylesheet" href="assets/hymenobacterdotinfo.css">
|
||||
<link rel="stylesheet" href="assets/clostridiumdotinfo.css">
|
||||
<link rel="stylesheet" href="assets/test-support.css">
|
||||
|
||||
{{content-for 'head-footer'}}
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/test-support.js"></script>
|
||||
<script src="assets/hymenobacterdotinfo.js"></script>
|
||||
<script src="assets/clostridiumdotinfo.js"></script>
|
||||
<script src="testem.js" integrity=""></script>
|
||||
<script src="assets/tests.js"></script>
|
||||
<script src="assets/test-loader.js"></script>
|
||||
|
|
Reference in a new issue