Merge branch 'master' into clostridium

* master:
  ember 2 series
  Remove globals initializer
This commit is contained in:
Matthew Dillon 2015-11-17 08:13:07 -07:00
commit 4aaa9cdfb9
8 changed files with 30 additions and 49 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

@ -2,10 +2,10 @@
"name": "clostridiumdotinfo",
"dependencies": {
"jquery": "~2.1.1",
"ember": "1.13.10",
"ember": "~2.1.0",
"ember-cli-shims": "0.0.6",
"ember-cli-test-loader": "0.2.1",
"ember-data": "1.13.15",
"ember-data": "~2.1.0",
"ember-load-initializers": "0.1.7",
"ember-qunit": "0.4.16",
"ember-qunit-notifications": "~0.1.0",

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