Refresh user count on channel activity

This commit is contained in:
Mattias Erming 2014-06-09 21:39:19 +02:00
parent ad03879a34
commit 7a509e6a1a
3 changed files with 42 additions and 44 deletions

View File

@ -210,11 +210,12 @@ button {
top: 0; top: 0;
} }
#chat .show-more { #chat .show-more {
background: #fff;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
color: #bec5d0; color: #bec5d0;
font: 12px Lato, sans-serif; font: 12px Lato, sans-serif;
line-height: 1.8em; line-height: 40px;
padding: 10px 0; height: 40px;
text-align: center; text-align: center;
text-transform: uppercase; text-transform: uppercase;
width: 100%; width: 100%;
@ -225,9 +226,6 @@ button {
} }
#chat .show-more:disabled { #chat .show-more:disabled {
display: none; display: none;
/*color: #bec5d0;
opacity: .4;
text-decoration: line-through;*/
} }
#chat .messages { #chat .messages {
display: table; display: table;
@ -300,7 +298,7 @@ button {
#chat .active .sidebar { #chat .active .sidebar {
display: block; display: block;
} }
#chat .meta { #chat .sidebar .meta {
border: 1px solid #eee; border: 1px solid #eee;
border-width: 0 0 1px 1px; border-width: 0 0 1px 1px;
color: #ccc; color: #ccc;
@ -308,11 +306,11 @@ button {
padding: 25px 0 0 21px; padding: 25px 0 0 21px;
width: 100%; width: 100%;
} }
#chat .meta h1 { #chat .sidebar .meta h1 {
color: #222; color: #222;
font-size: 15px; font-size: 15px;
} }
#chat .meta .type { #chat .sidebar .meta .type {
text-transform: capitalize; text-transform: capitalize;
} }
#chat .users { #chat .users {
@ -356,15 +354,15 @@ button {
@media (max-width: 768px) { @media (max-width: 768px) {
#viewport.lt { #viewport.lt {
-webkit-transform: translate3d(240px, 0, 0); -webkit-transform: translate3d(220px, 0, 0);
transform: translate3d(240px, 0, 0); transform: translate3d(220px, 0, 0);
} }
#viewport.rt { #viewport.rt {
-webkit-transform: translate3d(-180px, 0, 0); -webkit-transform: translate3d(-160px, 0, 0);
transform: translate3d(-180px, 0, 0); transform: translate3d(-160px, 0, 0);
} }
#sidebar { #sidebar {
margin-left: -240px; margin-left: -220px;
} }
#main { #main {
left: 0; left: 0;
@ -385,7 +383,7 @@ button {
right: 0; right: 0;
} }
#chat .sidebar { #chat .sidebar {
margin-right: -180px; margin-right: -160px;
} }
#chat .messages { #chat .messages {
display: block; display: block;

View File

@ -57,21 +57,7 @@
{{#each windows}} {{#each windows}}
<div id="window-{{id}}" class="window {{type}}" data-id="{{id}}"> <div id="window-{{id}}" class="window {{type}}" data-id="{{id}}">
<div class="sidebar"> <div class="sidebar">
<div class="meta"> {{partial "meta"}}
<h1>
{{name}}
</h1>
{{#if users}}
<div class="count">
{{users.length}}
users
</div>
{{else}}
<div class="type">
{{type}}
</div>
{{/if}}
</div>
<ul class="users"> <ul class="users">
{{partial "users"}} {{partial "users"}}
</ul> </ul>
@ -87,6 +73,18 @@
<header class="header"> <header class="header">
<button class="lt"></button> <button class="lt"></button>
<button class="rt"></button> <button class="rt"></button>
{{partial "meta"}}
</header>
<form class="form" data-target="{{id}}">
<input class="submit" tabindex="-1" type="submit" >
<input class="input">
</form>
</div>
{{/each}}
</script>
<script type="text/html" class="meta">
<div class="meta">
<h1> <h1>
{{name}} {{name}}
</h1> </h1>
@ -100,13 +98,7 @@
{{type}} {{type}}
</span> </span>
{{/if}} {{/if}}
</header>
<form class="form" data-target="{{id}}">
<input class="submit" tabindex="-1" type="submit" >
<input class="input">
</form>
</div> </div>
{{/each}}
</script> </script>
<script type="text/html" class="users"> <script type="text/html" class="users">

View File

@ -118,9 +118,17 @@ $(function() {
break; break;
case "users": case "users":
$("#window-" + data.id) var target = $("#window-" + data.id);
var json = {
name: target.find("h1").html(),
users: data.users
};
target.find(".meta")
.replaceWith(render("meta", json))
.end()
.find(".users") .find(".users")
.html(render("users", {users: data.users})); .html(render("users", json))
.end();
break; break;
} }
} }