aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/templates
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/templates')
-rw-r--r--shardweb/lib/templates/chat/chat.html.eex6
-rw-r--r--shardweb/lib/templates/identity/list.html.eex5
-rw-r--r--shardweb/lib/templates/identity/view.html.eex25
-rw-r--r--shardweb/lib/templates/layout/app.html.eex101
-rw-r--r--shardweb/lib/templates/page/peer_list.html.eex7
5 files changed, 81 insertions, 63 deletions
diff --git a/shardweb/lib/templates/chat/chat.html.eex b/shardweb/lib/templates/chat/chat.html.eex
index 8a43acf..45609d8 100644
--- a/shardweb/lib/templates/chat/chat.html.eex
+++ b/shardweb/lib/templates/chat/chat.html.eex
@@ -18,14 +18,14 @@
<i class="fa fa-comments"></i> Chat rooms
</li>
<li class="active">
- <i class="fa fa-comments"></i> #<%= @chan %>
+ <i class="fa fa-users"></i> #<%= @chan %>
</li>
<% else %>
<li>
- <i class="fa fa-user"></i> Private chat
+ <i class="fa fa-comments"></i> Private chat
</li>
<li class="active">
- <i class="fa fa-comments"></i> <%= @nicks %>
+ <i class="fa fa-user"></i> <%= @nicks %>
</li>
<% end %>
</ol>
diff --git a/shardweb/lib/templates/identity/list.html.eex b/shardweb/lib/templates/identity/list.html.eex
index 007af3d..6437f9c 100644
--- a/shardweb/lib/templates/identity/list.html.eex
+++ b/shardweb/lib/templates/identity/list.html.eex
@@ -31,7 +31,10 @@
<% end %>
</td>
<td>
- <%= if manifest.pk != @pk do %>
+ <a class="btn btn-xs btn-info" href="<%= identity_path(@conn, :view, manifest.pk |> Base.encode16) %>"><i class="fa fa-info"></i></a>
+ <%= if manifest.pk == @pk do %>
+ <a class="btn btn-xs btn-warning" href="<%= identity_path(@conn, :self) %>"><i class="fa fa-edit"></i> Edit</a>
+ <% else %>
<a class="btn btn-xs btn-primary" href="<%= chat_path(@conn, :privchat, manifest.pk |> Base.encode16) %>"><i class="fa fa-comments"></i> PM</a>
<% end %>
</td>
diff --git a/shardweb/lib/templates/identity/view.html.eex b/shardweb/lib/templates/identity/view.html.eex
new file mode 100644
index 0000000..8bb8ca2
--- /dev/null
+++ b/shardweb/lib/templates/identity/view.html.eex
@@ -0,0 +1,25 @@
+<!-- Page Heading -->
+<div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ <%= @view_nick %> <small><%= @view_pk |> Base.encode16 %></small>
+ </h1>
+ <ol class="breadcrumb">
+ <li>
+ <i class="fa fa-users"></i> People
+ </li>
+ <li class="active">
+ <i class="fa fa-user"></i> <%= @view_nick %>
+ </li>
+ </ol>
+ </div>
+</div>
+<!-- /.row -->
+
+<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
+
+<pre>
+ <%= inspect((GenServer.call(@pid, :get_info)), pretty: true, width: 40) %>
+</pre>
+
+
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>
diff --git a/shardweb/lib/templates/page/peer_list.html.eex b/shardweb/lib/templates/page/peer_list.html.eex
index f385528..ff6479f 100644
--- a/shardweb/lib/templates/page/peer_list.html.eex
+++ b/shardweb/lib/templates/page/peer_list.html.eex
@@ -30,7 +30,12 @@
<td>
<%= case auth do %>
<% nil -> %>(anonymous)
- <% %SNet.Auth{his_pk: his_pk} -> %> <%= Shard.Keys.pk_display(his_pk) %>
+ <% %SNet.Auth{his_pk: his_pk} -> %>
+ <i class="fa fa-user"></i>
+ <%= SApp.Identity.get_nick(his_pk) %>
+ <a href="<%= identity_path(@conn, :view, his_pk|>Base.encode16) %>">
+ <small><%= Shard.Keys.pk_display(his_pk) %></small>
+ </a>
<% end %>
</td>
<td><%= :inet_parse.ntoa(ip) %></td>