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.eex30
-rw-r--r--shardweb/lib/templates/identity/view.html.eex2
-rw-r--r--shardweb/lib/templates/page/shard_entry.html.eex11
3 files changed, 42 insertions, 1 deletions
diff --git a/shardweb/lib/templates/directory/view.html.eex b/shardweb/lib/templates/directory/view.html.eex
index ef8200b..7b9be38 100644
--- a/shardweb/lib/templates/directory/view.html.eex
+++ b/shardweb/lib/templates/directory/view.html.eex
@@ -76,6 +76,34 @@
</table>
<%= if @owner == @pk do %>
+ <%= if @public do %>
+ <fieldset><legend>Upload file</legend>
+ <%= form_for @conn, directory_path(@conn, :dir_upload), [multipart: true, class: "form-horizontal"], fn f -> %>
+ <%= hidden_input f, :dir_name, value: @name %>
+ <%= hidden_input f, :dir_public, value: @public %>
+ <div class="form-group">
+ <%= label :file, "File:", class: ["col-sm-2 control-label"] %>
+ <div class="col-sm-10">
+ <%= file_input f, :file, [class: "form-control"] %>
+ </div>
+ </div>
+ <div class="form-group">
+ <%= label :upload_name, "Save as (optionnal):", class: ["col-sm-2 control-label"] %>
+ <div class="col-sm-10">
+ <%= text_input f, :upload_name, [class: "form-control", value: ""] %>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <%= submit "Upload file", [class: "btn btn-primary"] %>
+ </div>
+ </div>
+ <% end %>
+ </fieldset>
+ <% else %>
+ <p>Warning: file upload in private directories does not keeps file private (yeah WTF right?), so we don't let you do that.</p>
+ <% end %>
+
<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 %>
@@ -106,7 +134,7 @@
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
- <%= submit "Add", [class: "btn btn-default"] %>
+ <%= submit "Add", [class: "btn btn-primary"] %>
</div>
</div>
<% end %>
diff --git a/shardweb/lib/templates/identity/view.html.eex b/shardweb/lib/templates/identity/view.html.eex
index c5dfaf2..c81caf6 100644
--- a/shardweb/lib/templates/identity/view.html.eex
+++ b/shardweb/lib/templates/identity/view.html.eex
@@ -23,6 +23,8 @@
<a class="btn btn-s btn-primary" href="<%= chat_path(@conn, :privchat, @pk |> Base.encode16) %>"><i class="fa fa-comments"></i> PM</a>
<% end %>
+ <a class="btn btn-s btn-success" href="<%= directory_path(@conn, :view_pub, @pk |> Base.encode16, "collection") %>"><i class="fa fa-folder"></i> Public stuff</a>
+
<pre>
<%= inspect(SApp.Identity.get_info(@pid), pretty: true, width: 40) %>
</pre>
diff --git a/shardweb/lib/templates/page/shard_entry.html.eex b/shardweb/lib/templates/page/shard_entry.html.eex
index d99fc34..bc9edd4 100644
--- a/shardweb/lib/templates/page/shard_entry.html.eex
+++ b/shardweb/lib/templates/page/shard_entry.html.eex
@@ -23,6 +23,17 @@
<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 %>
+ <% %SApp.File.Manifest{infohash: infohash} -> %>
+ <% file_info = SApp.File.get_info(Shard.Manager.find_or_start(@manifest)) %>
+ <i class="fa fa-file"></i>
+ <%= if file_info[:size] != nil do Size.humanize!(file_info[:size]) end %>
+ <%= if file_info[:mime_type] != nil do %><code><%= file_info[:mime_type] %></code><% end %>
+ <%= if file_info[:missing_blocks] != nil and file_info[:missing_blocks] > 0 do %>
+ <%= file_info[:num_blocks] - file_info[:missing_blocks] %> / <%= file_info[:num_blocks] %>
+ <% end %>
+ <%= if file_info[:missing_blocks] == 0 do %>
+ <a href="<%= directory_path(@conn, :raw_file, infohash|>Base.encode16) %>">[raw]</a>
+ <% end %>
<% x -> %> <%= inspect x %>
<% end %>