aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/templates/directory/view.html.eex
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/templates/directory/view.html.eex')
-rw-r--r--shardweb/lib/templates/directory/view.html.eex75
1 files changed, 71 insertions, 4 deletions
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 %>