2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-08-19 14:55:40 +03:00
|
|
|
|
|
|
|
export default Ember.Controller.extend(Ember.PromiseProxyMixin, {
|
2015-01-04 22:45:30 +03:00
|
|
|
init: function () {
|
|
|
|
var promise;
|
|
|
|
|
2015-09-03 14:06:50 +03:00
|
|
|
promise = this.store.query('setting', {type: 'blog,theme'}).then(function (settings) {
|
2015-01-04 22:45:30 +03:00
|
|
|
return settings.get('firstObject');
|
|
|
|
});
|
|
|
|
|
|
|
|
this.set('promise', promise);
|
|
|
|
},
|
|
|
|
|
|
|
|
setting: Ember.computed.alias('content'),
|
|
|
|
|
|
|
|
labs: Ember.computed('isSettled', 'setting.labs', function () {
|
|
|
|
var value = {};
|
|
|
|
|
|
|
|
if (this.get('isFulfilled')) {
|
|
|
|
try {
|
|
|
|
value = JSON.parse(this.get('setting.labs') || {});
|
|
|
|
} catch (err) {
|
|
|
|
value = {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
})
|
|
|
|
});
|