From 94b1f6b0ae387b7fcb0714a4c6e213212097a100 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 2 Nov 2018 14:04:52 +0100 Subject: Directory stuff --- shardweb/lib/templates/directory/view.html.eex | 75 ++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-) (limited to 'shardweb/lib/templates/directory') 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 @@

<%= @name %> - directory contents + <%= @manifest |> ShardURI.from_manifest %>

@@ -30,18 +35,80 @@ Name Shard - Id + + URI - <%= for {name, manifest} <- dir_contents(@conn, @shard) do %> + <%= for {name, {manifest, stored}} <- dir_contents(@conn, @manifest) do %> + <%= if stored do %> + + <% else %> + + <% end %> <%= name %> <%= render ShardWeb.PageView, "shard_entry.html", conn: @conn, manifest: manifest %> - <%= (SData.term_hash manifest) |> Base.encode16 %> + + <%= 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 %> + + <%= manifest |> ShardURI.from_manifest %> <% end %> +<%= if @owner == @pk do %> +
Add existing item + <%= 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 %> +
+ <%= label :add_name, "Name:", class: ["col-sm-2 control-label"] %> +
+ <%= text_input f, :add_name, [class: "form-control", value: ""] %> +
+
+
+ <%= label :add_uri, "URI:", class: ["col-sm-2 control-label"] %> +
+ <%= text_input f, :add_uri, [class: "form-control", placeholder: "example: shard:identity:xxx"] %> +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ <%= submit "Add", [class: "btn btn-default"] %> +
+
+ <% end %> +
+<% end %> -- cgit v1.2.3