From 665c33be11fa14b26c1aeaf965dcaea4c6ac44c5 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 27 Mar 2018 16:41:36 +0200 Subject: [PATCH] [liv.popup-controller] added 'popup.create' popup [vue.auth.menu] added link to open popup 'channel.create' --- webpack/lib/channel-controller.js | 4 ++++ webpack/lib/popup-controller.js | 16 ++++++++-------- webpack/page/noauth/register.js | 2 -- webpack/vue/auth/channel.vue | 2 +- webpack/vue/auth/menu.vue | 2 +- webpack/vue/auth/wrapper.vue | 27 +++++++++++++++++++++------ 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/webpack/lib/channel-controller.js b/webpack/lib/channel-controller.js index faba422..0d97e87 100644 --- a/webpack/lib/channel-controller.js +++ b/webpack/lib/channel-controller.js @@ -28,6 +28,10 @@ export default class ChannelController{ * ---------------------------------------------------------*/ nav(channel_id=null){ + + if( channel_id == -2 ) + return gs.get.popup.show('channel.create'); + console.log(`channel.nav(${channel_id})`); /* (1) Get channel data */ diff --git a/webpack/lib/popup-controller.js b/webpack/lib/popup-controller.js index c4a5a0b..2fe95a3 100644 --- a/webpack/lib/popup-controller.js +++ b/webpack/lib/popup-controller.js @@ -29,14 +29,14 @@ export default class PopupController{ reset(){ this.data.type = 'text'; this.data.name = ''; }, submit(){ gs.get.room.create(this.data.type, this.data.name) && this.parent.hide(); } }); - // this.croom = { - - // active: false, - // type: 'text', - // name: '', - - - // }; this.reset.push(this.croom.reset); + /* (2) Create a new Channel */ + this.register('channel.create', { + data: { + name: '' + }, + reset(){ this.data.name = ''; }, + submit(){ gs.get.channel.create(this.data.name) && this.parent.hide(); } + }); } diff --git a/webpack/page/noauth/register.js b/webpack/page/noauth/register.js index b1837c9..39e7a21 100644 --- a/webpack/page/noauth/register.js +++ b/webpack/page/noauth/register.js @@ -126,8 +126,6 @@ gs.get.register.func.register = function(){ /* (3) API bindings */ api.call('POST /user', { username: username, password: password }, function(rs){ - console.log(rs); - // manage error if( rs.error !== 0 || rs.uid == null || rs.token == null ) return gs.get.router.push('register'); diff --git a/webpack/vue/auth/channel.vue b/webpack/vue/auth/channel.vue index ee482aa..75732c2 100644 --- a/webpack/vue/auth/channel.vue +++ b/webpack/vue/auth/channel.vue @@ -22,7 +22,7 @@
- +
diff --git a/webpack/vue/auth/menu.vue b/webpack/vue/auth/menu.vue index 871578c..4fafa23 100644 --- a/webpack/vue/auth/menu.vue +++ b/webpack/vue/auth/menu.vue @@ -8,7 +8,7 @@ - + + + +