aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shardweb/assets/css/app.css5
-rw-r--r--shardweb/lib/shard_web/templates/identity/view.html.eex21
-rw-r--r--shardweb/lib/shard_web/templates/layout/app.html.eex95
-rw-r--r--shardweb/lib/shard_web/templates/layout/flashes.html.eex24
-rw-r--r--shardweb/lib/shard_web/templates/page/index.html.eex21
-rw-r--r--shardweb/lib/shard_web/templates/room/show.html.eex32
-rw-r--r--shardweb/lib/shard_web/views/layout_view.ex4
-rw-r--r--shardweb/lib/shard_web/views/room_view.ex4
8 files changed, 120 insertions, 86 deletions
diff --git a/shardweb/assets/css/app.css b/shardweb/assets/css/app.css
index 21d59de..0676867 100644
--- a/shardweb/assets/css/app.css
+++ b/shardweb/assets/css/app.css
@@ -1 +1,6 @@
/* This file is for your main application css. */
+
+.custom_active {
+ color: #fff;
+ background-color: #080808;
+}
diff --git a/shardweb/lib/shard_web/templates/identity/view.html.eex b/shardweb/lib/shard_web/templates/identity/view.html.eex
index 7252f7c..5e57e02 100644
--- a/shardweb/lib/shard_web/templates/identity/view.html.eex
+++ b/shardweb/lib/shard_web/templates/identity/view.html.eex
@@ -1,4 +1,23 @@
-<h4>Identity</h4>
+<!-- Page Heading -->
+<div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ <%= @nick %> <small><%= @pk |> Base.encode16 %></small>
+ </h1>
+ <ol class="breadcrumb">
+ <li>
+ <i class="fa fa-users"></i> My identities
+ </li>
+ <li class="active">
+ <i class="fa fa-user"></i> <%= @nick %>
+ </li>
+ </ol>
+ </div>
+</div>
+<!-- /.row -->
+
+<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
+
<%= form_for @conn, identity_path(@conn, :update), [class: "form-horizontal"], fn f -> %>
<div class="form-group">
diff --git a/shardweb/lib/shard_web/templates/layout/app.html.eex b/shardweb/lib/shard_web/templates/layout/app.html.eex
index bd405e7..e0cb9dc 100644
--- a/shardweb/lib/shard_web/templates/layout/app.html.eex
+++ b/shardweb/lib/shard_web/templates/layout/app.html.eex
@@ -132,18 +132,18 @@
</ul>
</li>
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> John Smith <b class="caret"></b></a>
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> <%= @nick %> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
- <a href="#"><i class="fa fa-fw fa-user"></i> Profile</a>
+ <a href="<%= identity_path(@conn, :view) %>"><i class="fa fa-fw fa-user"></i> Profile</a>
</li>
+ <li class="divider"></li>
<li>
<a href="#"><i class="fa fa-fw fa-envelope"></i> Inbox</a>
</li>
<li>
<a href="#"><i class="fa fa-fw fa-gear"></i> Settings</a>
</li>
- <li class="divider"></li>
<li>
<a href="#"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
</li>
@@ -153,40 +153,34 @@
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
- <li class="active">
- <a href="<%= page_path(@conn, :index) %>"><i class="fa fa-fw fa-dashboard"></i> Peer list</a>
- </li>
- <li>
- <a href="<%= room_path(@conn, :show, "lobby") %>"><i class="fa fa-fw fa-bar-chart-o"></i> Chat</a>
- </li>
- <li>
- <a href="<%= identity_path(@conn, :view) %>"><i class="fa fa-fw fa-table"></i> [<%= @nick %>]</a>
+ <li class="<%= if @view_module == ShardWeb.IdentityView do "active" else "" end %>">
+ <a href="<%= identity_path(@conn, :view) %>"><i class="fa fa-fw fa-user"></i> <%= @nick %></a>
</li>
- <li>
- <a href="forms.html"><i class="fa fa-fw fa-edit"></i> Forms</a>
- </li>
- <li>
- <a href="bootstrap-elements.html"><i class="fa fa-fw fa-desktop"></i> Bootstrap Elements</a>
- </li>
- <li>
- <a href="bootstrap-grid.html"><i class="fa fa-fw fa-wrench"></i> Bootstrap Grid</a>
- </li>
- <li>
- <a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-arrows-v"></i> Dropdown <i class="fa fa-fw fa-caret-down"></i></a>
- <ul id="demo" class="collapse">
- <li>
- <a href="#">Dropdown Item</a>
- </li>
- <li>
- <a href="#">Dropdown Item</a>
+ <li class="<%= if @view_module == ShardWeb.RoomView do "active" else "" end %>">
+ <a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-comments"></i> Chat rooms <i class="fa fa-fw fa-caret-down"></i></a>
+ <ul id="demo" class="<%= if @view_module != ShardWeb.RoomView do "collapse" else "" end %>">
+
+
+ <%= for {_, %SApp.Chat.Manifest{channel: name}, _} <- shard_list() do %>
+ <li class="<%= if @view_module == ShardWeb.RoomView and @room == name do "custom_active" else "" end %>">
+ <a href="<%= room_path(@conn, :show, name) %>">#<%= name %></a>
</li>
+ <% end %>
+ <li>
+ <a href="#" onclick="if(new_room=prompt('Enter name of room to join, without preceding # sign:'))window.location.href='/room/'+new_room;">Join room</a>
+ </li>
+
+
</ul>
</li>
+ <li class="<%= if @view_module == ShardWeb.PageView and @view_template == "index.html" do "active" else "" end %>">
+ <a href="<%= page_path(@conn, :index) %>"><i class="fa fa-fw fa-globe"></i> Peer list</a>
+ </li>
<li>
- <a href="blank-page.html"><i class="fa fa-fw fa-file"></i> Blank Page</a>
+ <a href="#"><i class="fa fa-fw fa-gear"></i> Settings</a>
</li>
<li>
- <a href="index-rtl.html"><i class="fa fa-fw fa-dashboard"></i> RTL Dashboard</a>
+ <a href="#"><i class="fa fa-fw fa-dashboard"></i> Dashboard</a>
</li>
</ul>
</div>
@@ -197,48 +191,9 @@
<div class="container-fluid">
- <!-- Page Heading -->
- <div class="row">
- <div class="col-lg-12">
- <h1 class="page-header">
- Dashboard <small>Statistics Overview</small>
- </h1>
- <ol class="breadcrumb">
- <li class="active">
- <i class="fa fa-dashboard"></i> Dashboard
- </li>
- </ol>
- </div>
- </div>
- <!-- /.row -->
-
- <%= if get_flash(@conn, :info) do %>
- <div class="row">
- <div class="col-lg-12">
- <div class="alert alert-info alert-dismissable">
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
- <i class="fa fa-info-circle"></i> <%= get_flash(@conn, :info) %>
- </div>
- </div>
- </div>
- <% end %>
- <!-- /.row -->
- <%= if get_flash(@conn, :error) do %>
- <div class="row">
- <div class="col-lg-12">
- <div class="alert alert-warning alert-dismissable">
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
- <i class="fa fa-info-circle"></i> <%= get_flash(@conn, :error) %>
- </div>
- </div>
- </div>
- <% end %>
- <!-- /.row -->
- <main role="main">
- <%= render @view_module, @view_template, assigns %>
- </main>
+ <%= render @view_module, @view_template, assigns %>
</div>
<!-- /.container-fluid -->
diff --git a/shardweb/lib/shard_web/templates/layout/flashes.html.eex b/shardweb/lib/shard_web/templates/layout/flashes.html.eex
new file mode 100644
index 0000000..5371f43
--- /dev/null
+++ b/shardweb/lib/shard_web/templates/layout/flashes.html.eex
@@ -0,0 +1,24 @@
+
+ <%= if get_flash(@conn, :info) do %>
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="alert alert-info alert-dismissable">
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
+ <i class="fa fa-info-circle"></i> <%= get_flash(@conn, :info) %>
+ </div>
+ </div>
+ </div>
+ <% end %>
+ <!-- /.row -->
+
+ <%= if get_flash(@conn, :error) do %>
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="alert alert-warning alert-dismissable">
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
+ <i class="fa fa-info-circle"></i> <%= get_flash(@conn, :error) %>
+ </div>
+ </div>
+ </div>
+ <% end %>
+ <!-- /.row -->
diff --git a/shardweb/lib/shard_web/templates/page/index.html.eex b/shardweb/lib/shard_web/templates/page/index.html.eex
index 7f4452f..f385528 100644
--- a/shardweb/lib/shard_web/templates/page/index.html.eex
+++ b/shardweb/lib/shard_web/templates/page/index.html.eex
@@ -1,4 +1,23 @@
-<h4>Peer list</h4>
+<!-- Page Heading -->
+<div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ Peer list
+
+ </h1>
+ <ol class="breadcrumb">
+ <li>
+ <i class="fa fa-dashboard"></i> Dashboard
+ </li>
+ <li class="active">
+ <i class="fa fa-globe"></i> Peer list
+ </li>
+ </ol>
+ </div>
+</div>
+<!-- /.row -->
+
+<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
<table class="table table-striped">
<tr>
diff --git a/shardweb/lib/shard_web/templates/room/show.html.eex b/shardweb/lib/shard_web/templates/room/show.html.eex
index e7b1166..75960b4 100644
--- a/shardweb/lib/shard_web/templates/room/show.html.eex
+++ b/shardweb/lib/shard_web/templates/room/show.html.eex
@@ -1,13 +1,25 @@
- <ul class="nav nav-tabs">
- <%= for {_, %SApp.Chat.Manifest{channel: name}, _} <- shard_list() do %>
- <li class="<%= if name == @room do "active" else "" end %>">
- <a href="<%= room_path(@conn, :show, name) %>">#<%= name %></a>
- </li>
- <% end %>
- <li>
- <a href="#" onclick="if(new_room=prompt('Enter name of room to join, without preceding # sign:'))window.location.href='/room/'+new_room;">Join room</a>
- </li>
- </ul>
+<!-- Page Heading -->
+<div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ #<%= @room %>
+
+ </h1>
+ <ol class="breadcrumb">
+ <li>
+ <i class="fa fa-comments"></i> Chat rooms
+ </li>
+ <li class="active">
+ <i class="fa fa-comments"></i> #<%= @room %>
+ </li>
+ </ol>
+ </div>
+</div>
+<!-- /.row -->
+
+<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
+
+
<!-- The list of messages will appear here: -->
<ul id='msg-list' class='row' style='list-style: none; min-height:400px; padding: 10px; max-height: 400px; overflow: scroll'></ul>
diff --git a/shardweb/lib/shard_web/views/layout_view.ex b/shardweb/lib/shard_web/views/layout_view.ex
index 4012c38..2b12323 100644
--- a/shardweb/lib/shard_web/views/layout_view.ex
+++ b/shardweb/lib/shard_web/views/layout_view.ex
@@ -1,3 +1,7 @@
defmodule ShardWeb.LayoutView do
use ShardWeb, :view
+
+ def shard_list do
+ Shard.Manager.list_shards
+ end
end
diff --git a/shardweb/lib/shard_web/views/room_view.ex b/shardweb/lib/shard_web/views/room_view.ex
index 7ec961b..ebc2a60 100644
--- a/shardweb/lib/shard_web/views/room_view.ex
+++ b/shardweb/lib/shard_web/views/room_view.ex
@@ -1,7 +1,3 @@
defmodule ShardWeb.RoomView do
use ShardWeb, :view
-
- def shard_list do
- Shard.Manager.list_shards
- end
end