diff options
Diffstat (limited to 'shardweb/lib/views')
-rw-r--r-- | shardweb/lib/views/layout_view.ex | 20 | ||||
-rw-r--r-- | shardweb/lib/views/page_view.ex | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/shardweb/lib/views/layout_view.ex b/shardweb/lib/views/layout_view.ex index 2b12323..317d405 100644 --- a/shardweb/lib/views/layout_view.ex +++ b/shardweb/lib/views/layout_view.ex @@ -4,4 +4,24 @@ defmodule ShardWeb.LayoutView do def shard_list do Shard.Manager.list_shards end + + def str_of_pk_list(conn, pk_list) do + case pk_list + |> Enum.filter(&(&1 != conn.assigns.pk)) + |> Enum.map(&Base.encode16/1) + do + [] -> conn.assigns.pk |> Base.encode16 + l -> Enum.join(l, ",") + end + end + + def nicks_of_pk_list(conn, pk_list) do + case pk_list + |> Enum.filter(&(&1 != conn.assigns.pk)) + |> Enum.map(&SApp.Identity.get_nick/1) + do + [] -> "(myself)" + l -> Enum.join(l, ", ") + end + end end diff --git a/shardweb/lib/views/page_view.ex b/shardweb/lib/views/page_view.ex index eb88617..9d7dd6d 100644 --- a/shardweb/lib/views/page_view.ex +++ b/shardweb/lib/views/page_view.ex @@ -14,5 +14,6 @@ defmodule ShardWeb.PageView do def shard_list do Shard.Manager.list_shards + |> Enum.sort_by(fn {_,m,_} -> m end) end end |