This commit is contained in:
xdrm-brackets 2018-03-28 15:54:19 +02:00
parent 912bf003b3
commit 665edead89
4 changed files with 31 additions and 8 deletions

View File

@ -11,16 +11,33 @@ export default class ContentController{
---------------------------------------------------------*/ ---------------------------------------------------------*/
get cid(){ return gs.get.channel.current; } get cid(){ return gs.get.channel.current; }
get cbuf(){
/* (1) Ignore: if no channel */
if( gs.get.channel.list == null || gs.get.channel.list.length === 0 )
return {};
/* (2) Search for current channel */
for( let c of gs.get.channel.list ){
// Return if channel found //
if( c.id === this.cid )
return c;
}
/* (3) If nothing found */
return {};
}
/* (3) Room ID binding /* (3) Room ID binding
* *
---------------------------------------------------------*/ ---------------------------------------------------------*/
get rid(){ return gs.get.room.text.current; } get rid(){ return gs.get.room.text.current; }
/* (4) Room buffer binding
*
---------------------------------------------------------*/
get rbuf(){ get rbuf(){
/* (1) Ignore: if no rooms empty */ /* (1) Ignore: if no rooms empty */

View File

@ -182,9 +182,13 @@ export default class RoomController{
if( rs.error !== 0 || rs.channel == null ) if( rs.error !== 0 || rs.channel == null )
return; return;
/* (2) Dump data */ /* (2) Dump rooms data */
this.dump(rs.channel.room); this.dump(rs.channel.room);
/* (3) Store channel users */
gs.get.content.cbuf.users = rs.channel.users;
}.bind(this), auth.token); }.bind(this), auth.token);
} }

View File

@ -173,6 +173,8 @@
cursor: pointer; cursor: pointer;
transition: opacity .2s ease-in-out; transition: opacity .2s ease-in-out;
background: url() center center no-repeat;
background-size: cover;
&:hover{ &:hover{
opacity: .8; opacity: .8;

View File

@ -11,10 +11,10 @@
<section class='message-stack'> <section class='message-stack'>
<div class='message' v-for='m in gs.content.messages'> <div class='message' v-for='m in gs.content.messages'>
<div class='icon'></div> <div class='icon' :style='`background-image: url("https://picsum.photos/150/?random&nonce=${m.uid}");`'></div>
<span class='meta'> <span class='meta'>
<span class='author'>{{ gs.content.user(m.uid).name || 'inconnu' }}</span> <span class='author'>{{ gs.content.user(m.uid).username || `guest ${m.uid}` }}</span>
<span class='date' >{{ new Date(m.ts*1000).toLocaleString('fr') || 'inconnu' }}</span> <span class='date' >{{ m.ts || 'inconnu' }}</span>
</span> </span>
<span class='text'>{{ m.msg }}</span> <span class='text'>{{ m.msg }}</span>
</div> </div>