aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/shard_web
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-10-11 20:14:47 +0200
committerAlex Auvolat <alex@adnab.me>2018-10-11 20:14:54 +0200
commit6dcc2eefc3c8db0cadd7300536527dbd1905fa48 (patch)
tree3eb00337e1dd7bc47680b9fa16ec721eb216f4a9 /shardweb/lib/shard_web
parent123fbcf6abcfe61ef65cc82f1d22843dde722b23 (diff)
downloadshard-6dcc2eefc3c8db0cadd7300536527dbd1905fa48.tar.gz
shard-6dcc2eefc3c8db0cadd7300536527dbd1905fa48.zip
Template changes
Diffstat (limited to 'shardweb/lib/shard_web')
-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
7 files changed, 115 insertions, 86 deletions
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