From a6b9c87a69e8f2351ec9144008f7eade847585a4 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 2 May 2015 08:44:03 +0930 Subject: [PATCH] Use new config keys --- .../js/forum/src/components/welcome-hero.js | 20 +++++++------------ framework/core/js/lib/model.js | 4 ++-- framework/core/js/lib/session.js | 2 +- framework/core/js/lib/store.js | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/framework/core/js/forum/src/components/welcome-hero.js b/framework/core/js/forum/src/components/welcome-hero.js index 91c02524c..a8e56b4a1 100644 --- a/framework/core/js/forum/src/components/welcome-hero.js +++ b/framework/core/js/forum/src/components/welcome-hero.js @@ -4,27 +4,21 @@ export default class WelcomeHero extends Component { constructor(props) { super(props); - this.title = m.prop('Mithril Forum') - this.description = m.prop('Hello') - this.hidden = m.prop(localStorage.getItem('welcomeHidden')) + this.hidden = m.prop(localStorage.getItem('welcomeHidden')); } hide() { - localStorage.setItem('welcomeHidden', 'true') - this.hidden(true) + localStorage.setItem('welcomeHidden', 'true'); + this.hidden(true); } view() { - var root = m.prop() - var self = this; - return this.hidden() ? m('') : m('header.hero.welcome-hero', {config: root}, [ + return this.hidden() ? m('') : m('header.hero.welcome-hero', {config: this.element}, [ m('div.container', [ - m('button.close.btn.btn-icon.btn-link', {onclick: function() { - $(root()).slideUp(self.hide.bind(self)) - }}, m('i.fa.fa-times')), + m('button.close.btn.btn-icon.btn-link', {onclick: () => this.$().slideUp(this.hide.bind(this))}, m('i.fa.fa-times')), m('div.container-narrow', [ - m('h2', this.title()), - m('p', this.description()) + m('h2', app.config['welcome_title']), + m('div.subtitle', m.trust(app.config['welcome_message'])) ]) ]) ]) diff --git a/framework/core/js/lib/model.js b/framework/core/js/lib/model.js index 9dd901af4..7e294a16b 100644 --- a/framework/core/js/lib/model.js +++ b/framework/core/js/lib/model.js @@ -38,7 +38,7 @@ export default class Model { return m.request({ method: this.exists ? 'PUT' : 'POST', - url: app.config.apiURL+'/'+this.data().type+(this.exists ? '/'+this.data().id : ''), + url: app.config['api_url']+'/'+this.data().type+(this.exists ? '/'+this.data().id : ''), data: {data}, background: true, config: app.session.authorize.bind(app.session) @@ -53,7 +53,7 @@ export default class Model { return m.request({ method: 'DELETE', - url: app.config.apiURL+'/'+this.data().type+'/'+this.data().id, + url: app.config['api_url']+'/'+this.data().type+'/'+this.data().id, background: true, config: app.session.authorize.bind(app.session) }).then(() => this.exists = false); diff --git a/framework/core/js/lib/session.js b/framework/core/js/lib/session.js index d7c94b610..bdecab1f6 100644 --- a/framework/core/js/lib/session.js +++ b/framework/core/js/lib/session.js @@ -13,7 +13,7 @@ export default class Session extends mixin(class {}, evented) { var self = this; m.request({ method: 'POST', - url: app.config.baseURL+'/login', + url: app.config['base_url']+'/login', data: {identification, password}, background: true }).then(function(response) { diff --git a/framework/core/js/lib/store.js b/framework/core/js/lib/store.js index e2e10404b..1d2401008 100644 --- a/framework/core/js/lib/store.js +++ b/framework/core/js/lib/store.js @@ -39,7 +39,7 @@ export default class Store { } return m.request({ method: 'GET', - url: app.config.apiURL+'/'+endpoint, + url: app.config['api_url']+'/'+endpoint, data: params, background: true, config: app.session.authorize.bind(app.session)