[liv.popup-controller] added 'popup.create' popup [vue.auth.menu] added link to open popup 'channel.create'

This commit is contained in:
xdrm-brackets 2018-03-27 16:41:36 +02:00
parent 73a8d1c219
commit 665c33be11
6 changed files with 35 additions and 18 deletions

View File

@ -28,6 +28,10 @@ export default class ChannelController{
* *
---------------------------------------------------------*/ ---------------------------------------------------------*/
nav(channel_id=null){ nav(channel_id=null){
if( channel_id == -2 )
return gs.get.popup.show('channel.create');
console.log(`channel.nav(${channel_id})`); console.log(`channel.nav(${channel_id})`);
/* (1) Get channel data */ /* (1) Get channel data */

View File

@ -29,14 +29,14 @@ export default class PopupController{
reset(){ this.data.type = 'text'; this.data.name = ''; }, reset(){ this.data.type = 'text'; this.data.name = ''; },
submit(){ gs.get.room.create(this.data.type, this.data.name) && this.parent.hide(); } submit(){ gs.get.room.create(this.data.type, this.data.name) && this.parent.hide(); }
}); });
// this.croom = { /* (2) Create a new Channel */
this.register('channel.create', {
// active: false, data: {
// type: 'text', name: ''
// name: '', },
reset(){ this.data.name = ''; },
submit(){ gs.get.channel.create(this.data.name) && this.parent.hide(); }
// }; this.reset.push(this.croom.reset); });
} }

View File

@ -126,8 +126,6 @@ gs.get.register.func.register = function(){
/* (3) API bindings */ /* (3) API bindings */
api.call('POST /user', { username: username, password: password }, function(rs){ api.call('POST /user', { username: username, password: password }, function(rs){
console.log(rs);
// manage error // manage error
if( rs.error !== 0 || rs.uid == null || rs.token == null ) if( rs.error !== 0 || rs.uid == null || rs.token == null )
return gs.get.router.push('register'); return gs.get.router.push('register');

View File

@ -22,7 +22,7 @@
</section> </section>
<section class='message-input'> <section class='message-input'>
<textarea :placeholder='`Message #${gs.room.get("text").name}`' @keydown='gs.content.auto_grow'></textarea> <textarea :placeholder='`Message #${gs.room.get(`text`).name}`' @keydown='gs.content.auto_grow'></textarea>
</section> </section>
</div> </div>

View File

@ -8,7 +8,7 @@
<!-- Channel List --> <!-- Channel List -->
<span v-for='c in gs.channel.list' <span v-for='c in gs.channel.list'
@click='c.link && gs.channel.nav(c.id);' @click='gs.channel.nav(c.id);'
:class='c.id == gs.channel.current ? `channel active` : `channel`' :class='c.id == gs.channel.current ? `channel active` : `channel`'
:data-sub='c.sub' :data-sub='c.sub'
:data-special='c.id == -1?1:0' :data-special='c.id == -1?1:0'

View File

@ -16,22 +16,37 @@
<!-- Pop-up Filter Background --> <!-- Pop-up Filter Background -->
<div id='popup-filter-background' v-show='gs.popup.filter' @click='gs.popup.hide()'></div> <div id='popup-filter-background' v-show='gs.popup.filter' @click='gs.popup.hide()'></div>
<!-- Pop-up --> <!-- Pop-up ROOM CREATE -->
<div class='popup' v-show='gs.popup.get(`room.create`).active'> <div class='popup' v-show='gs.popup.get(`room.create`).active'>
<span class='header'>Create {{ gs.popup.get(`room.create`).data.type }} channel</span> <span class='header'>Create {{ gs.popup.get(`room.create`).data.type }} channel</span>
<span class='body form'> <span class='body form'>
<label for='channel_name'>Channel Name</label> <label for='channel_name'>Room Name</label>
<input type='text' name='channel_name' v-model='gs.popup.get(`room.create`).data.name'> <input type='text' name='channel_name' v-model='gs.popup.get(`room.create`).data.name'>
<label for='channel_name'>Channel Type</label> <label for='channel_name'>Room Type</label>
<span class='select-box' @click='gs.popup.get(`room.create`).data.type=`text`' :data-selected='gs.popup.get(`room.create`).data.type==`text`?1:0' data-type='text'>Text Channel</span> <span class='select-box' @click='gs.popup.get(`room.create`).data.type=`text`' :data-selected='gs.popup.get(`room.create`).data.type==`text`?1:0' data-type='text'>Text Room</span>
<span class='select-box' @click='gs.popup.get(`room.create`).data.type=`voice`' :data-selected='gs.popup.get(`room.create`).data.type==`voice`?1:0' data-type='voice'>Voice Channel</span> <span class='select-box' @click='gs.popup.get(`room.create`).data.type=`voice`' :data-selected='gs.popup.get(`room.create`).data.type==`voice`?1:0' data-type='voice'>Voice Room</span>
</span> </span>
<span class='footer form'> <span class='footer form'>
<button @click='gs.popup.hide()'>Cancel</button> <button @click='gs.popup.hide()'>Cancel</button>
<button class='submit' @click='gs.popup.get(`room.create`).submit()'>Create Channel</button> <button class='submit' @click='gs.popup.get(`room.create`).submit()'>Create Room</button>
</span>
</div>
<!-- Pop-up CHANNEL CREATE -->
<div class='popup' v-show='gs.popup.get(`channel.create`).active'>
<span class='header'>Create {{ gs.popup.get(`channel.create`).data.type }} channel</span>
<span class='body form'>
<label for='channel_name'>Channel Name</label>
<input type='text' name='channel_name' v-model='gs.popup.get(`channel.create`).data.name'>
</span>
<span class='footer form'>
<button @click='gs.popup.hide()'>Cancel</button>
<button class='submit' @click='gs.popup.get(`channel.create`).submit()'>Create Channel</button>
</span> </span>
</div> </div>