diff options
author | Alex Auvolat <alex@adnab.me> | 2018-09-26 18:14:32 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-09-26 18:14:32 +0200 |
commit | 26629dc30a116204263ac4b515600649ba742ba0 (patch) | |
tree | a066688ce44e028abd188867bc92b72496d4893a /shardweb/lib/shard_web/templates | |
parent | 1a13285971ef728109011a93e676e26248b30242 (diff) | |
download | shard-26629dc30a116204263ac4b515600649ba742ba0.tar.gz shard-26629dc30a116204263ac4b515600649ba742ba0.zip |
Web UI for multiple identities
Diffstat (limited to 'shardweb/lib/shard_web/templates')
4 files changed, 50 insertions, 7 deletions
diff --git a/shardweb/lib/shard_web/templates/identity/view.html.eex b/shardweb/lib/shard_web/templates/identity/view.html.eex new file mode 100644 index 0000000..b9210f2 --- /dev/null +++ b/shardweb/lib/shard_web/templates/identity/view.html.eex @@ -0,0 +1,40 @@ +<h4>Identity</h4> + +<%= form_for @conn, identity_path(@conn, :update), [class: "form-horizontal"], fn f -> %> + <div class="form-group"> + <label class="col-sm-2 control-label">Public key:</label> + <div class="col-sm-10"> + <input type="text" value="<%= @pk |> Base.encode16 %>" class="form-control" disabled /> + </div> + </div> + <div class="form-group"> + <%= label :nick, "Nickname:", class: ["col-sm-2 control-label"] %> + <div class="col-sm-10"> + <%= text_input f, :nick, [class: "form-control", value: @nick] %> + </div> + </div> + <div class="form-group"> + <div class="col-sm-offset-2 col-sm-10"> + <%= submit "Update", [class: "btn btn-default"] %> + </div> + </div> +<% end %> + +<h4>Other identities</h4> + +<ul> + <%= for pk2 <- identity_list(), pk2 != @pk do %> + <li> + <%= form_for @conn, identity_path(@conn, :switch), [class: "form-inline"], fn f -> %> + <%= hidden_input f, :pk, value: (pk2 |> Base.encode16) %> + <%= submit "Switch to", [class: "btn btn-xs btn-success"] %> + <strong><%= get_nick pk2 %></strong> + <small><%= pk2 |> Base.encode16 %></small> + <% end %> + </li> + <% end %> +</ul> + +<%= 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/shard_web/templates/layout/app.html.eex b/shardweb/lib/shard_web/templates/layout/app.html.eex index 9903775..d4b2075 100644 --- a/shardweb/lib/shard_web/templates/layout/app.html.eex +++ b/shardweb/lib/shard_web/templates/layout/app.html.eex @@ -18,6 +18,7 @@ <ul class="nav nav-pills pull-right"> <li><a href="<%= page_path(@conn, :index) %>">Home</a></li> <li><a href="<%= room_path(@conn, :show, "lobby") %>">Chat</a></li> + <li><a href="<%= identity_path(@conn, :view) %>">[<%= @nick %>]</a></li> </ul> </nav> <span class="logo"></span> diff --git a/shardweb/lib/shard_web/templates/page/index.html.eex b/shardweb/lib/shard_web/templates/page/index.html.eex index 412cbe5..2efa030 100644 --- a/shardweb/lib/shard_web/templates/page/index.html.eex +++ b/shardweb/lib/shard_web/templates/page/index.html.eex @@ -21,7 +21,7 @@ <% end %> </table> -<%= form_for @conn, peer_path(@conn, :add), [class: "form-inline"], fn f -> %> +<%= 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"] %> diff --git a/shardweb/lib/shard_web/templates/room/show.html.eex b/shardweb/lib/shard_web/templates/room/show.html.eex index bc1641a..e7b1166 100644 --- a/shardweb/lib/shard_web/templates/room/show.html.eex +++ b/shardweb/lib/shard_web/templates/room/show.html.eex @@ -12,11 +12,13 @@ <!-- The list of messages will appear here: --> <ul id='msg-list' class='row' style='list-style: none; min-height:400px; padding: 10px; max-height: 400px; overflow: scroll'></ul> -<div class="row"> - <div class="col-xs-3"> - <strong><%= @name %></strong> - </div> - <div class="col-xs-9"> - <input type="text" id="msg" class="form-control" placeholder="Your Message" autofocus> +<div class="form-horizontal"> + <div class="form-group"> + <div class="col-sm-2 control-label"> + <strong><<%= @nick %>></strong> + </div> + <div class="col-sm-10"> + <input type="text" id="msg" class="form-control" placeholder="Your Message" autofocus> + </div> </div> </div> |