aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/templates
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/templates')
-rw-r--r--shardweb/lib/templates/directory/view.html.eex38
-rw-r--r--shardweb/lib/templates/identity/view.html.eex12
-rw-r--r--shardweb/lib/templates/layout/app.html.eex7
-rw-r--r--shardweb/lib/templates/page/shard_entry.html.eex30
-rw-r--r--shardweb/lib/templates/page/shard_list.html.eex31
5 files changed, 87 insertions, 31 deletions
diff --git a/shardweb/lib/templates/directory/view.html.eex b/shardweb/lib/templates/directory/view.html.eex
new file mode 100644
index 0000000..b981391
--- /dev/null
+++ b/shardweb/lib/templates/directory/view.html.eex
@@ -0,0 +1,38 @@
+<!-- Page Heading -->
+<div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ <%= @name %>
+ <small>directory contents</small>
+
+ </h1>
+ <ol class="breadcrumb">
+ <li class="active">
+ <i class="fa fa-folder"></i> <%= @name %>
+ </li>
+ </ol>
+ </div>
+</div>
+<!-- /.row -->
+
+<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
+
+<table class="table table-striped">
+ <tr>
+ <th>Name</th>
+ <th>Shard</th>
+ <th>Id</th>
+ </tr>
+ <%= for {name, manifest} <- dir_contents(@conn, @shard) do %>
+ <tr>
+ <td>
+ <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>
+ </tr>
+ <% end %>
+</table>
+
diff --git a/shardweb/lib/templates/identity/view.html.eex b/shardweb/lib/templates/identity/view.html.eex
index 58be7e7..6cb1bde 100644
--- a/shardweb/lib/templates/identity/view.html.eex
+++ b/shardweb/lib/templates/identity/view.html.eex
@@ -18,6 +18,18 @@
<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
+<%= if is_friend(@conn, @view_pk) do %>
+ <%= form_for @conn, identity_path(@conn, :view_post, @view_pk|>Base.encode16()), [class: "form-inline"], fn f -> %>
+ <%= hidden_input f, :rm_friend, value: "true" %>
+ <%= submit "Remove from friends", [class: "btn btn-sm btn-danger"] %>
+ <% end %>
+<% else %>
+ <%= form_for @conn, identity_path(@conn, :view_post, @view_pk|>Base.encode16()), [class: "form-inline"], fn f -> %>
+ <%= hidden_input f, :add_friend, value: "true" %>
+ <%= submit "Add to friends", [class: "btn btn-sm btn-success"] %>
+ <% end %>
+<% end %>
+
<pre>
<%= inspect(SApp.Identity.get_info(@pid), pretty: true, width: 40) %>
</pre>
diff --git a/shardweb/lib/templates/layout/app.html.eex b/shardweb/lib/templates/layout/app.html.eex
index 8d9924e..71a08f9 100644
--- a/shardweb/lib/templates/layout/app.html.eex
+++ b/shardweb/lib/templates/layout/app.html.eex
@@ -150,8 +150,13 @@
</ul>
</li>
+
+ <li class="<%= if @view_module == ShardWeb.DirectoryView and @view_template == "view.html" and not @public and @name == "friends" do "active" else "" end %>">
+ <a href="<%= directory_path(@conn, :view_priv, @pk|>Base.encode16(), "friends") %>"><i class="fa fa-fw fa-heart"></i> Friends</a>
+ </li>
+
<li class="<%= if (@view_module == ShardWeb.IdentityView and @view_template == "list.html") or (@view_module == ShardWeb.ChatView and @view_template == "chat.html" and not @public) do "active" else "" end %>">
- <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>
+ <a href="<%= identity_path(@conn, :list) %>"><i class="fa fa-fw fa-users"></i> Everyone<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}, pid} <- shard_list() do %>
diff --git a/shardweb/lib/templates/page/shard_entry.html.eex b/shardweb/lib/templates/page/shard_entry.html.eex
new file mode 100644
index 0000000..8a55b3a
--- /dev/null
+++ b/shardweb/lib/templates/page/shard_entry.html.eex
@@ -0,0 +1,30 @@
+ <%= case @manifest do %>
+ <% %SApp.Identity.Manifest{pk: pk} -> %><i class="fa fa-user"></i>
+ <%= SApp.Identity.get_nick(pk) %>
+ <a href="<%= identity_path(@conn, :view, pk|>Base.encode16) %>">
+ <small><%= Shard.Keys.pk_display pk %></small>
+ </a>
+
+ <% %SApp.Chat.Manifest{channel: chan} -> %><i class="fa fa-hashtag"></i>
+ <a href="<%= chat_path(@conn, :chat, chan) %>">
+ <%= chan %>
+ </a>
+
+ <% %SApp.Chat.PrivChat.Manifest{pk_list: pk_list} -> %><i class="fa fa-comments"></i>
+ <a href="<%= chat_path(@conn, :privchat,
+ (pk_list |> Enum.filter(&(&1!=@pk)) |> Enum.map(&Base.encode16/1) |> Enum.join(","))) %>">
+ <%= pk_list |> Enum.filter(&(&1!=@pk)) |> Enum.map(&SApp.Identity.get_nick/1) |> Enum.join(", ") %>
+ </a>
+
+ <% %SApp.Directory.Manifest{owner: owner, public: public, name: name} -> %><i class="fa fa-folder"></i>
+ <%= SApp.Identity.get_nick(owner) %>
+ <a href="<%= identity_path(@conn, :view, owner|>Base.encode16) %>">
+ <small><%= Shard.Keys.pk_display owner %></small>
+ </a>
+ /
+ <a href="<%= directory_path(@conn, (if public do :view_pub else :view_priv end), owner|>Base.encode16(), name) %>"><%= name %></a>
+ <%= if public do %><i class="fa fa-globe"></i><% else %><i class="fa fa-lock"></i><% end %>
+
+
+ <% x -> %> <%= inspect x %>
+ <% end %>
diff --git a/shardweb/lib/templates/page/shard_list.html.eex b/shardweb/lib/templates/page/shard_list.html.eex
index 489c1a5..53f6264 100644
--- a/shardweb/lib/templates/page/shard_list.html.eex
+++ b/shardweb/lib/templates/page/shard_list.html.eex
@@ -35,36 +35,7 @@
<% end %>
</td>
<td>
- <%= case manifest do %>
- <% %SApp.Identity.Manifest{pk: pk} -> %><i class="fa fa-user"></i>
- <%= SApp.Identity.get_nick(pk) %>
- <a href="<%= identity_path(@conn, :view, pk|>Base.encode16) %>">
- <small><%= Shard.Keys.pk_display pk %></small>
- </a>
-
- <% %SApp.Chat.Manifest{channel: chan} -> %><i class="fa fa-hashtag"></i>
- <a href="<%= chat_path(@conn, :chat, chan) %>">
- <%= chan %>
- </a>
-
- <% %SApp.Chat.PrivChat.Manifest{pk_list: pk_list} -> %><i class="fa fa-comments"></i>
- <a href="<%= chat_path(@conn, :privchat,
- (pk_list |> Enum.filter(&(&1!=@pk)) |> Enum.map(&Base.encode16/1) |> Enum.join(","))) %>">
- <%= pk_list |> Enum.filter(&(&1!=@pk)) |> Enum.map(&SApp.Identity.get_nick/1) |> Enum.join(", ") %>
- </a>
-
- <% %SApp.Directory.Manifest{owner: owner, public: public, name: name} -> %><i class="fa fa-folder"></i>
- <%= SApp.Identity.get_nick(owner) %>
- <a href="<%= identity_path(@conn, :view, owner|>Base.encode16) %>">
- <small><%= Shard.Keys.pk_display owner %></small>
- </a>
- /
- <a href="#"><%= name %></a>
- <%= if public do %><i class="fa fa-globe"></i><% else %><i class="fa fa-lock"></i><% end %>
-
-
- <% x -> %> <%= inspect x %>
- <% end %>
+ <%= render "shard_entry.html", conn: @conn, manifest: manifest %>
</td>
<td><small><%= id |> Base.encode16 %></small></td>
</tr>