From 1e91dc596fd2f7fdd96b7fd2fc50724f93e46529 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 12 Oct 2018 14:40:21 +0200 Subject: Move and reorganize some stuff --- shardweb/lib/templates/chat/chat.html.eex | 37 ++++ shardweb/lib/templates/identity/list.html.eex | 32 ++++ shardweb/lib/templates/identity/self.html.eex | 59 ++++++ shardweb/lib/templates/layout/app.html.eex | 227 ++++++++++++++++++++++++ shardweb/lib/templates/layout/flashes.html.eex | 24 +++ shardweb/lib/templates/page/peer_list.html.eex | 47 +++++ shardweb/lib/templates/page/shard_list.html.eex | 46 +++++ 7 files changed, 472 insertions(+) create mode 100644 shardweb/lib/templates/chat/chat.html.eex create mode 100644 shardweb/lib/templates/identity/list.html.eex create mode 100644 shardweb/lib/templates/identity/self.html.eex create mode 100644 shardweb/lib/templates/layout/app.html.eex create mode 100644 shardweb/lib/templates/layout/flashes.html.eex create mode 100644 shardweb/lib/templates/page/peer_list.html.eex create mode 100644 shardweb/lib/templates/page/shard_list.html.eex (limited to 'shardweb/lib/templates') diff --git a/shardweb/lib/templates/chat/chat.html.eex b/shardweb/lib/templates/chat/chat.html.eex new file mode 100644 index 0000000..86c2fb6 --- /dev/null +++ b/shardweb/lib/templates/chat/chat.html.eex @@ -0,0 +1,37 @@ + +
+
+

+ #<%= @room %> + public chat room + +

+ +
+
+ + +<%= render ShardWeb.LayoutView, "flashes.html", assigns %> + + + + + + +
+
+
+ <<%= @nick %>> +
+
+ +
+
+
diff --git a/shardweb/lib/templates/identity/list.html.eex b/shardweb/lib/templates/identity/list.html.eex new file mode 100644 index 0000000..1354264 --- /dev/null +++ b/shardweb/lib/templates/identity/list.html.eex @@ -0,0 +1,32 @@ + +
+
+

+ People on the network + +

+ +
+
+ + +<%= render ShardWeb.LayoutView, "flashes.html", assigns %> + + + + + + + + <%= for {_id, manifest, pid} <- people_list() do %> + + + + + <% end %> +
User namePublic key
<%= GenServer.call(pid, :get_info).nick %> <%= manifest.pk |> Base.encode16 %>
+ diff --git a/shardweb/lib/templates/identity/self.html.eex b/shardweb/lib/templates/identity/self.html.eex new file mode 100644 index 0000000..5e57e02 --- /dev/null +++ b/shardweb/lib/templates/identity/self.html.eex @@ -0,0 +1,59 @@ + +
+
+

+ <%= @nick %> <%= @pk |> Base.encode16 %> +

+ +
+
+ + +<%= render ShardWeb.LayoutView, "flashes.html", assigns %> + + +<%= form_for @conn, identity_path(@conn, :update), [class: "form-horizontal"], fn f -> %> +
+ +
+ +
+
+
+ <%= label :nick, "Nickname:", class: ["col-sm-2 control-label"] %> +
+ <%= text_input f, :nick, [class: "form-control", value: @nick] %> +
+
+
+
+ <%= submit "Update", [class: "btn btn-default"] %> +
+
+<% end %> + +

Other identities

+ + + +<%= form_for @conn, identity_path(@conn, :create), [class: "form-inline"], fn _f -> %> + <%= submit "Create new identity", [class: "btn btn-danger"] %> +<% end %> diff --git a/shardweb/lib/templates/layout/app.html.eex b/shardweb/lib/templates/layout/app.html.eex new file mode 100644 index 0000000..5a087f2 --- /dev/null +++ b/shardweb/lib/templates/layout/app.html.eex @@ -0,0 +1,227 @@ + + + + + + + + + + + + Shard. + + + " rel="stylesheet"> + + + " rel="stylesheet"> + + + " rel="stylesheet"> + + + " rel="stylesheet" type="text/css"> + + + + + + "> + + + + +
+ + + + +
+ +
+ + + + <%= render @view_module, @view_template, assigns %> + +
+ + +
+ + +
+ + + + + + + + + + + + + + <%= render_gon_script(@conn) %> + + + + + + diff --git a/shardweb/lib/templates/layout/flashes.html.eex b/shardweb/lib/templates/layout/flashes.html.eex new file mode 100644 index 0000000..5371f43 --- /dev/null +++ b/shardweb/lib/templates/layout/flashes.html.eex @@ -0,0 +1,24 @@ + + <%= if get_flash(@conn, :info) do %> +
+
+
+ + <%= get_flash(@conn, :info) %> +
+
+
+ <% end %> + + + <%= if get_flash(@conn, :error) do %> +
+
+
+ + <%= get_flash(@conn, :error) %> +
+
+
+ <% end %> + diff --git a/shardweb/lib/templates/page/peer_list.html.eex b/shardweb/lib/templates/page/peer_list.html.eex new file mode 100644 index 0000000..f385528 --- /dev/null +++ b/shardweb/lib/templates/page/peer_list.html.eex @@ -0,0 +1,47 @@ + +
+
+

+ Peer list + +

+ +
+
+ + +<%= render ShardWeb.LayoutView, "flashes.html", assigns %> + + + + + + + + <%= for {{:inet, ip, port}, _pid, auth} <- conn_list() do %> + + + + + + <% end %> +
Peer IDAddressPort
+ <%= case auth do %> + <% nil -> %>(anonymous) + <% %SNet.Auth{his_pk: his_pk} -> %> <%= Shard.Keys.pk_display(his_pk) %> + <% end %> + <%= :inet_parse.ntoa(ip) %><%= port %>
+ +<%= form_for @conn, page_path(@conn, :add_peer), [class: "form-inline"], fn f -> %> + <%= text_input f, :ip, [class: "form-control", placeholder: "Hostname / IP address"] %> + <%= text_input f, :port, [class: "form-control", placeholder: "Port", value: "4044"] %> + <%= submit "Add peer", [class: "btn btn-default"] %> +<% end %> + diff --git a/shardweb/lib/templates/page/shard_list.html.eex b/shardweb/lib/templates/page/shard_list.html.eex new file mode 100644 index 0000000..a0648d3 --- /dev/null +++ b/shardweb/lib/templates/page/shard_list.html.eex @@ -0,0 +1,46 @@ + +
+
+

+ Shard list + +

+ +
+
+ + +<%= render ShardWeb.LayoutView, "flashes.html", assigns %> + + + + + + + + <%= for {id, manifest, pid} <- shard_list() do %> + + + + + + <% end %> +
ShardIdPid
+ <%= case manifest do %> + <% %SApp.Identity.Manifest{pk: pk} -> %> + <%= GenServer.call(pid, :get_info).nick %> + <%= Shard.Keys.pk_display pk %> + <% %SApp.Chat.Manifest{channel: chan} -> %> #<%= chan %> + <% %SApp.Chat.PrivChat.Manifest{pk_list: pk_list} -> %> + <%= pk_list |> Enum.map(&SApp.Identity.get_nick/1) |> Enum.join(", ") %> + <% x -> %> <%= inspect x %> + <% end %> + <%= id |> Base.encode16 %><%= inspect(pid) %>
+ -- cgit v1.2.3