aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/templates/layout
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/templates/layout')
-rw-r--r--shardweb/lib/templates/layout/app.html.eex101
1 files changed, 43 insertions, 58 deletions
diff --git a/shardweb/lib/templates/layout/app.html.eex b/shardweb/lib/templates/layout/app.html.eex
index f49c8e6..067ad57 100644
--- a/shardweb/lib/templates/layout/app.html.eex
+++ b/shardweb/lib/templates/layout/app.html.eex
@@ -52,79 +52,52 @@
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-envelope"></i> <b class="caret"></b></a>
+ <% sur = privchat_with_unread(@conn) %>
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ <i class="fa fa-envelope"></i>
+ <%= if sur != [] do %>
+ <span class="badge badge-notify"><%= Enum.count sur %></span>
+ <% end %>
+ <b class="caret"></b>
+ </a>
<ul class="dropdown-menu message-dropdown">
+ <%= for {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, pid} <- sur do %>
<li class="message-preview">
- <a href="#">
- <div class="media">
- <span class="pull-left">
- <img class="media-object" src="http://placehold.it/50x50" alt="">
- </span>
- <div class="media-body">
- <h5 class="media-heading"><strong>John Smith</strong>
- </h5>
- <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
- <p>Lorem ipsum dolor sit amet, consectetur...</p>
- </div>
- </div>
- </a>
- </li>
- <li class="message-preview">
- <a href="#">
+ <a href="<%= chat_path(@conn, :privchat, str_of_pk_list(@conn, pk_list)) %>">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
- <h5 class="media-heading"><strong>John Smith</strong>
+ <h5 class="media-heading"><strong><%= nicks_of_pk_list(@conn, pk_list) %></strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
- <p>Lorem ipsum dolor sit amet, consectetur...</p>
+ <p><%= chat_shard_last_msg(pid) %></p>
</div>
</div>
</a>
</li>
- <li class="message-preview">
- <a href="#">
- <div class="media">
- <span class="pull-left">
- <img class="media-object" src="http://placehold.it/50x50" alt="">
- </span>
- <div class="media-body">
- <h5 class="media-heading"><strong>John Smith</strong>
- </h5>
- <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
- <p>Lorem ipsum dolor sit amet, consectetur...</p>
- </div>
- </div>
- </a>
- </li>
- <li class="message-footer">
- <a href="#">Read All New Messages</a>
- </li>
+ <% end %>
+ <li class="message-footer">
+ <a href="<%= identity_path(@conn, :list) %>"><i class="fa fa-users"></i> People</a>
+ </li>
</ul>
</li>
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell"></i> <b class="caret"></b></a>
+ <% cur = chat_with_unread(@conn) %>
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ <i class="fa fa-bell"></i>
+ <%= if cur != [] do %>
+ <span class="badge badge-notify"><%= Enum.count cur %></span>
+ <% end %>
+ <b class="caret"></b>
+ </a>
<ul class="dropdown-menu alert-dropdown">
+ <%= for {_, %SApp.Chat.Manifest{channel: chan}, _} <- cur do %>
<li>
- <a href="#">Alert Name <span class="label label-default">Alert Badge</span></a>
- </li>
- <li>
- <a href="#">Alert Name <span class="label label-primary">Alert Badge</span></a>
- </li>
- <li>
- <a href="#">Alert Name <span class="label label-success">Alert Badge</span></a>
- </li>
- <li>
- <a href="#">Alert Name <span class="label label-info">Alert Badge</span></a>
- </li>
- <li>
- <a href="#">Alert Name <span class="label label-warning">Alert Badge</span></a>
- </li>
- <li>
- <a href="#">Alert Name <span class="label label-danger">Alert Badge</span></a>
+ <a href="<%= chat_path(@conn, :chat, chan) %>">#<%= chan %></a>
</li>
+ <% end %>
<li class="divider"></li>
<li>
<a href="#">View All</a>
@@ -161,9 +134,15 @@
<ul id="demo" class="<%= if not (@view_module == ShardWeb.ChatView and @view_template == "chat.html" and @public) do "collapse" else "" end %>">
- <%= for {id, %SApp.Chat.Manifest{channel: name}, _} <- shard_list() do %>
+ <%= for {id, %SApp.Chat.Manifest{channel: name}, pid} <- shard_list() do %>
<li class="<%= if @shard == id do "custom_active" else "" end %>">
- <a href="<%= chat_path(@conn, :chat, name) %>">#<%= name %></a>
+ <a href="<%= chat_path(@conn, :chat, name) %>">
+ <%= if GenServer.call(pid, :has_unread) != nil do %>
+ <span class="have_unread">#<%= name %></span>
+ <% else %>
+ #<%= name %>
+ <% end %>
+ </a>
</li>
<% end %>
<li>
@@ -177,9 +156,15 @@
<a href="<%= identity_path(@conn, :list) %>"><i class="fa fa-fw fa-users"></i> People<i class="fa fa-fw fa-caret-down"></i></a>
<%= if (@view_module == ShardWeb.IdentityView and @view_template == "list.html") or (@view_module == ShardWeb.ChatView and @view_template == "chat.html" and not @public) do %>
<ul>
- <%= for {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, _} <- shard_list() do %>
+ <%= for {id, %SApp.Chat.PrivChat.Manifest{pk_list: pk_list}, pid} <- shard_list() do %>
<li class="<%= if id == @shard do "custom_active" else "" end %>">
- <a href="<%= chat_path(@conn, :privchat, str_of_pk_list(@conn, pk_list)) %>"><%= nicks_of_pk_list(@conn, pk_list) %></a>
+ <a href="<%= chat_path(@conn, :privchat, str_of_pk_list(@conn, pk_list)) %>">
+ <%= if GenServer.call(pid, :has_unread) != nil do %>
+ <span class="have_unread"><%= nicks_of_pk_list(@conn, pk_list) %></span>
+ <% else %>
+ <%= nicks_of_pk_list(@conn, pk_list) %>
+ <% end %>
+ </a>
</li>
<% end %>
</ul>