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