2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2015-08-19 12:55:40 +01:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
const {Controller, PromiseProxyMixin, computed} = Ember;
|
|
|
|
const {alias} = computed;
|
2015-01-04 19:45:30 +00:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
export default Controller.extend(PromiseProxyMixin, {
|
2015-01-04 19:45:30 +00:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
setting: alias('content'),
|
2015-01-04 19:45:30 +00:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
labs: computed('isSettled', 'setting.labs', function () {
|
|
|
|
let value = {};
|
2015-01-04 19:45:30 +00:00
|
|
|
|
|
|
|
if (this.get('isFulfilled')) {
|
|
|
|
try {
|
|
|
|
value = JSON.parse(this.get('setting.labs') || {});
|
|
|
|
} catch (err) {
|
|
|
|
value = {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
2015-10-23 11:03:38 +02:00
|
|
|
}),
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
publicAPI: computed('config.publicAPI', 'labs.publicAPI', function () {
|
2015-10-23 11:03:38 +02:00
|
|
|
return this.get('config.publicAPI') || this.get('labs.publicAPI');
|
2015-10-28 11:36:45 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
init() {
|
2015-11-15 11:06:49 +00:00
|
|
|
this._super(...arguments);
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
let promise = this.store.query('setting', {type: 'blog,theme'}).then((settings) => {
|
|
|
|
return settings.get('firstObject');
|
|
|
|
});
|
|
|
|
|
|
|
|
this.set('promise', promise);
|
|
|
|
}
|
2015-01-04 19:45:30 +00:00
|
|
|
});
|