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.eex4
-rw-r--r--shardweb/lib/templates/directory/view.html.eex75
-rw-r--r--shardweb/lib/templates/identity/view.html.eex3
-rw-r--r--shardweb/lib/templates/layout/app.html.eex8
-rw-r--r--shardweb/lib/templates/page/shard_list.html.eex8
5 files changed, 87 insertions, 11 deletions
diff --git a/shardweb/lib/templates/chat/chat.html.eex b/shardweb/lib/templates/chat/chat.html.eex
index 499e14d..947e4c3 100644
--- a/shardweb/lib/templates/chat/chat.html.eex
+++ b/shardweb/lib/templates/chat/chat.html.eex
@@ -4,11 +4,11 @@
<h1 class="page-header">
<%= if @public do %>
#<%= @chan %>
- <small>public chat room</small>
<% else %>
<%= @nicks %>
- <small>private chat</small>
<% end %>
+ <small class="shard_uri"><%= @manifest |> ShardURI.from_manifest %></small>
+
</h1>
<ol class="breadcrumb">
diff --git a/shardweb/lib/templates/directory/view.html.eex b/shardweb/lib/templates/directory/view.html.eex
index 43ded97..b4cbfaf 100644
--- a/shardweb/lib/templates/directory/view.html.eex
+++ b/shardweb/lib/templates/directory/view.html.eex
@@ -3,7 +3,7 @@
<div class="col-lg-12">
<h1 class="page-header">
<%= @name %>
- <small>directory contents</small>
+ <small class="shard_uri"><%= @manifest |> ShardURI.from_manifest %></small>
</h1>
<ol class="breadcrumb">
@@ -18,6 +18,11 @@
</li>
<li class="active">
<i class="fa fa-folder"></i> <%= @name %>
+ <%= if @public do %>
+ (public)
+ <% else %>
+ (private)
+ <% end %>
</li>
</ol>
</div>
@@ -30,18 +35,80 @@
<tr>
<th>Name</th>
<th>Shard</th>
- <th>Id</th>
+ <th style="width: 150px"></th>
+ <th>URI</th>
</tr>
- <%= for {name, manifest} <- dir_contents(@conn, @shard) do %>
+ <%= for {name, {manifest, stored}} <- dir_contents(@conn, @manifest) do %>
<tr>
<td>
+ <%= if stored do %>
+ <i class="fa fa-save"></i>
+ <% else %>
+ <i class="fa fa-link"></i>
+ <% end %>
<strong><%= name %></strong>
</td>
<td>
<%= render ShardWeb.PageView, "shard_entry.html", conn: @conn, manifest: manifest %>
</td>
- <td><small><%= (SData.term_hash manifest) |> Base.encode16 %></small></td>
+ <td>
+ <%= form_for @conn, directory_path(@conn, :dir_rm), [class: "form-inline", style: "display: inline"], fn f -> %>
+ <%= hidden_input f, :dir_name, value: @name %>
+ <%= hidden_input f, :dir_public, value: @public %>
+ <%= hidden_input f, :item_name, value: name %>
+ <%= submit "Remove", [class: "btn btn-xs btn-danger"] %>
+ <% end %>
+ <%= form_for @conn, directory_path(@conn, :dir_set_stored), [class: "form-inline", style: "display: inline"], fn f -> %>
+ <%= hidden_input f, :dir_name, value: @name %>
+ <%= hidden_input f, :dir_public, value: @public %>
+ <%= hidden_input f, :item_name, value: name %>
+ <%= hidden_input f, :item_stored, value: (if stored do "false" else "true" end) %>
+ <%= if stored do %>
+ <%= submit "Don't store", [class: "btn btn-xs btn-warning"] %>
+ <% else %>
+ <%= submit "Store", [class: "btn btn-xs btn-success"] %>
+ <% end %>
+ <% end %>
+ </td>
+ <td><small class="shard_uri"><%= manifest |> ShardURI.from_manifest %></small></td>
</tr>
<% end %>
</table>
+<%= if @owner == @pk do %>
+ <fieldset><legend>Add existing item</legend>
+ <%= form_for @conn, directory_path(@conn, :dir_add), [class: "form-horizontal"], fn f -> %>
+ <%= hidden_input f, :dir_name, value: @name %>
+ <%= hidden_input f, :dir_public, value: @public %>
+ <div class="form-group">
+ <%= label :add_name, "Name:", class: ["col-sm-2 control-label"] %>
+ <div class="col-sm-10">
+ <%= text_input f, :add_name, [class: "form-control", value: ""] %>
+ </div>
+ </div>
+ <div class="form-group">
+ <%= label :add_uri, "URI:", class: ["col-sm-2 control-label"] %>
+ <div class="col-sm-10">
+ <%= text_input f, :add_uri, [class: "form-control", placeholder: "example: shard:identity:xxx"] %>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-sm-2 control-label">Stored?</label>
+ <div class="col-sm-10">
+ <div class="radio">
+ <label><%= radio_button f, :add_stored, "yes" %>Stored <i class="fa fa-save"></i></label>
+ </div>
+ <div class="radio">
+ <label><%= radio_button f, :add_stored, "no" %>Linked <i class="fa fa-link"></i></label>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <%= submit "Add", [class: "btn btn-default"] %>
+ </div>
+ </div>
+ <% end %>
+ </fieldset>
+<% end %>
diff --git a/shardweb/lib/templates/identity/view.html.eex b/shardweb/lib/templates/identity/view.html.eex
index 3fb5a3f..c5dfaf2 100644
--- a/shardweb/lib/templates/identity/view.html.eex
+++ b/shardweb/lib/templates/identity/view.html.eex
@@ -2,7 +2,8 @@
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
- <%= @view_nick %> <small><%= @view_pk |> Base.encode16 %></small>
+ <%= @view_nick %>
+ <small class="shard_uri"><%= @manifest |> ShardURI.from_manifest %></small>
</h1>
<ol class="breadcrumb">
<li>
diff --git a/shardweb/lib/templates/layout/app.html.eex b/shardweb/lib/templates/layout/app.html.eex
index 1310131..bd5e3b2 100644
--- a/shardweb/lib/templates/layout/app.html.eex
+++ b/shardweb/lib/templates/layout/app.html.eex
@@ -127,6 +127,14 @@
<!-- 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="<%= if @view_module == ShardWeb.Directoryview and @view_template == "view.html" do "active" else "" end %>">
+ <a href="<%= directory_path(@conn, :view_pub, Base.encode16(@pk), "collection") %>"><i class="fa fa-fw fa-globe"></i> My public stuff</a>
+ </li>
+ <li class="<%= if @view_module == ShardWeb.Directoryview and @view_template == "view.html" do "active" else "" end %>">
+ <a href="<%= directory_path(@conn, :view_priv, Base.encode16(@pk), "collection") %>"><i class="fa fa-fw fa-folder"></i> My private stuff</a>
+ </li>
+
<li class="<%= if @view_module == ShardWeb.ChatView and @view_template == "chat.html" and @public do "active" else "" end %>">
<a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-hashtag"></i> Chat rooms <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo" class="<%= if not (@view_module == ShardWeb.ChatView and @view_template == "chat.html" and @public) do "collapse" else "" end %>">
diff --git a/shardweb/lib/templates/page/shard_list.html.eex b/shardweb/lib/templates/page/shard_list.html.eex
index dd846d8..3fffef7 100644
--- a/shardweb/lib/templates/page/shard_list.html.eex
+++ b/shardweb/lib/templates/page/shard_list.html.eex
@@ -23,21 +23,21 @@
<tr>
<th></th>
<th>Shard</th>
- <th>Id</th>
+ <th>URI</th>
</tr>
- <%= for {id, manifest, why_have_it} <- shard_list() do %>
+ <%= for {_id, manifest, why_have_it} <- shard_list() do %>
<tr>
<td>
<%= case why_have_it do %>
<% {:cached, _} -> %><span class="label label-warning">cache</span>
<% {:pinned, _, _} -> %><span class="label label-success">pinned</span>
- <% {:req, a, _} -> %><span class="label label-default">req (<%= MapSet.size(a) %>)</span>
+ <% {:req, a, _} -> %><span class="label label-success">req (<%= MapSet.size(a) %>)</span>
<% end %>
</td>
<td>
<%= render "shard_entry.html", conn: @conn, manifest: manifest, pk: @pk %>
</td>
- <td><small><%= id |> Base.encode16 %></small></td>
+ <td><small class="shard_uri"><%= manifest |> ShardURI.from_manifest %></small></td>
</tr>
<% end %>
</table>