Use new config keys

This commit is contained in:
Toby Zerner 2015-05-02 08:44:03 +09:30
parent 94d8d3c80f
commit a6b9c87a69
4 changed files with 11 additions and 17 deletions

View File

@ -4,27 +4,21 @@ export default class WelcomeHero extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.title = m.prop('Mithril Forum') this.hidden = m.prop(localStorage.getItem('welcomeHidden'));
this.description = m.prop('Hello')
this.hidden = m.prop(localStorage.getItem('welcomeHidden'))
} }
hide() { hide() {
localStorage.setItem('welcomeHidden', 'true') localStorage.setItem('welcomeHidden', 'true');
this.hidden(true) this.hidden(true);
} }
view() { view() {
var root = m.prop() return this.hidden() ? m('') : m('header.hero.welcome-hero', {config: this.element}, [
var self = this;
return this.hidden() ? m('') : m('header.hero.welcome-hero', {config: root}, [
m('div.container', [ m('div.container', [
m('button.close.btn.btn-icon.btn-link', {onclick: function() { m('button.close.btn.btn-icon.btn-link', {onclick: () => this.$().slideUp(this.hide.bind(this))}, m('i.fa.fa-times')),
$(root()).slideUp(self.hide.bind(self))
}}, m('i.fa.fa-times')),
m('div.container-narrow', [ m('div.container-narrow', [
m('h2', this.title()), m('h2', app.config['welcome_title']),
m('p', this.description()) m('div.subtitle', m.trust(app.config['welcome_message']))
]) ])
]) ])
]) ])

View File

@ -38,7 +38,7 @@ export default class Model {
return m.request({ return m.request({
method: this.exists ? 'PUT' : 'POST', 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}, data: {data},
background: true, background: true,
config: app.session.authorize.bind(app.session) config: app.session.authorize.bind(app.session)
@ -53,7 +53,7 @@ export default class Model {
return m.request({ return m.request({
method: 'DELETE', 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, background: true,
config: app.session.authorize.bind(app.session) config: app.session.authorize.bind(app.session)
}).then(() => this.exists = false); }).then(() => this.exists = false);

View File

@ -13,7 +13,7 @@ export default class Session extends mixin(class {}, evented) {
var self = this; var self = this;
m.request({ m.request({
method: 'POST', method: 'POST',
url: app.config.baseURL+'/login', url: app.config['base_url']+'/login',
data: {identification, password}, data: {identification, password},
background: true background: true
}).then(function(response) { }).then(function(response) {

View File

@ -39,7 +39,7 @@ export default class Store {
} }
return m.request({ return m.request({
method: 'GET', method: 'GET',
url: app.config.apiURL+'/'+endpoint, url: app.config['api_url']+'/'+endpoint,
data: params, data: params,
background: true, background: true,
config: app.session.authorize.bind(app.session) config: app.session.authorize.bind(app.session)