Merge branch 'master' into clostridium
* master: ember 2 series Remove globals initializer
This commit is contained in:
commit
4aaa9cdfb9
8 changed files with 30 additions and 49 deletions
|
@ -1,20 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import config from '../config/environment';
|
|
||||||
|
|
||||||
var globals = Ember.Object.extend({
|
|
||||||
genus: config.APP.genus,
|
|
||||||
apiURL: config.apiURL,
|
|
||||||
});
|
|
||||||
|
|
||||||
export function initialize(container, application) {
|
|
||||||
application.register('service:globals', globals, {singleton: true});
|
|
||||||
application.inject('route', 'globals', 'service:globals');
|
|
||||||
application.inject('controller', 'globals', 'service:globals');
|
|
||||||
application.inject('component', 'globals', 'service:globals');
|
|
||||||
application.inject('adapter', 'globals', 'service:globals');
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'global-variables',
|
|
||||||
initialize: initialize
|
|
||||||
};
|
|
|
@ -1,9 +1,13 @@
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
|
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
const { inject: { service } } = Ember;
|
||||||
const { RESTAdapter } = DS;
|
const { RESTAdapter } = DS;
|
||||||
|
|
||||||
export default RESTAdapter.extend(DataAdapterMixin, {
|
export default RESTAdapter.extend(DataAdapterMixin, {
|
||||||
|
globals: service(),
|
||||||
|
|
||||||
authorizer: 'authorizer:application',
|
authorizer: 'authorizer:application',
|
||||||
|
|
||||||
namespace: function() {
|
namespace: function() {
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
const { Component, computed, inject: { service } } = Ember;
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
globals: service(),
|
||||||
|
|
||||||
tagName: 'em',
|
tagName: 'em',
|
||||||
genus: function() {
|
|
||||||
|
genus: computed('globals.genus', function() {
|
||||||
return this.get('globals.genus').capitalize();
|
return this.get('globals.genus').capitalize();
|
||||||
}.property().readOnly(),
|
}),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Component.extend({});
|
const { Component, inject: { service } } = Ember;
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
globals: service(),
|
||||||
|
});
|
||||||
|
|
|
@ -4,6 +4,7 @@ const { Component, computed, inject: { service } } = Ember;
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
session: service(),
|
session: service(),
|
||||||
|
globals: service(),
|
||||||
|
|
||||||
strains: null,
|
strains: null,
|
||||||
characteristics: null,
|
characteristics: null,
|
||||||
|
|
9
app/services/globals.js
Normal file
9
app/services/globals.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import config from '../config/environment';
|
||||||
|
|
||||||
|
const { Service } = Ember;
|
||||||
|
|
||||||
|
export default Service.extend({
|
||||||
|
genus: config.APP.genus,
|
||||||
|
apiURL: config.apiURL,
|
||||||
|
});
|
|
@ -2,10 +2,10 @@
|
||||||
"name": "clostridiumdotinfo",
|
"name": "clostridiumdotinfo",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "~2.1.1",
|
"jquery": "~2.1.1",
|
||||||
"ember": "1.13.10",
|
"ember": "~2.1.0",
|
||||||
"ember-cli-shims": "0.0.6",
|
"ember-cli-shims": "0.0.6",
|
||||||
"ember-cli-test-loader": "0.2.1",
|
"ember-cli-test-loader": "0.2.1",
|
||||||
"ember-data": "1.13.15",
|
"ember-data": "~2.1.0",
|
||||||
"ember-load-initializers": "0.1.7",
|
"ember-load-initializers": "0.1.7",
|
||||||
"ember-qunit": "0.4.16",
|
"ember-qunit": "0.4.16",
|
||||||
"ember-qunit-notifications": "~0.1.0",
|
"ember-qunit-notifications": "~0.1.0",
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import { initialize } from '../../../initializers/global-variables';
|
|
||||||
import { module, test } from 'qunit';
|
|
||||||
|
|
||||||
var container, application;
|
|
||||||
|
|
||||||
module('Unit | Initializer | global variables', {
|
|
||||||
beforeEach: function() {
|
|
||||||
Ember.run(function() {
|
|
||||||
application = Ember.Application.create();
|
|
||||||
container = application.__container__;
|
|
||||||
application.deferReadiness();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Replace this with your real tests.
|
|
||||||
test('it works', function(assert) {
|
|
||||||
initialize(container, application);
|
|
||||||
|
|
||||||
// you would normally confirm the results of the initializer here
|
|
||||||
assert.ok(true);
|
|
||||||
});
|
|
Reference in a new issue