Remove globals initializer

Fixes #62
This commit is contained in:
Matthew Dillon 2015-11-17 06:43:33 -07:00
parent 04d05f9795
commit 99309e0e91
7 changed files with 28 additions and 47 deletions

View file

@ -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
};

View file

@ -1,9 +1,13 @@
import DS from 'ember-data';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
import Ember from 'ember';
const { inject: { service } } = Ember;
const { RESTAdapter } = DS;
export default RESTAdapter.extend(DataAdapterMixin, {
globals: service(),
authorizer: 'authorizer:application',
namespace: function() {

View file

@ -1,8 +1,14 @@
import Ember from 'ember';
export default Ember.Component.extend({
const { Component, computed, inject: { service } } = Ember;
export default Component.extend({
globals: service(),
tagName: 'em',
genus: function() {
genus: computed('globals.genus', function() {
return this.get('globals.genus').capitalize();
}.property().readOnly(),
}),
});

View file

@ -1,3 +1,7 @@
import Ember from 'ember';
export default Ember.Component.extend({});
const { Component, inject: { service } } = Ember;
export default Component.extend({
globals: service(),
});

View file

@ -4,6 +4,7 @@ const { Component, computed, inject: { service } } = Ember;
export default Component.extend({
session: service(),
globals: service(),
strains: null,
characteristics: null,

9
app/services/globals.js Normal file
View 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,
});

View file

@ -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);
});