diff options
author | Guillermo Ramos | 2020-02-11 17:08:42 +0100 |
---|---|---|
committer | Guillermo Ramos | 2020-02-11 17:20:52 +0100 |
commit | abad279fd6247b81e04efd9110ffe221bb096708 (patch) | |
tree | 8f506aa68d29e7b2105cccc34624fb84a1ceabfd /lib/waev_web | |
parent | 840e37b56a2af853631c8f583e28e5bd576f34f5 (diff) | |
download | waev-abad279fd6247b81e04efd9110ffe221bb096708.tar.gz |
CSS cleanup
Diffstat (limited to 'lib/waev_web')
-rw-r--r-- | lib/waev_web/templates/exports/show.html.eex | 34 | ||||
-rw-r--r-- | lib/waev_web/views/exports_view.ex | 22 |
2 files changed, 34 insertions, 22 deletions
diff --git a/lib/waev_web/templates/exports/show.html.eex b/lib/waev_web/templates/exports/show.html.eex index 501f3c2..9ac011e 100644 --- a/lib/waev_web/templates/exports/show.html.eex +++ b/lib/waev_web/templates/exports/show.html.eex @@ -1,43 +1,33 @@ -<div class="wa-avatars"> - <div class="wa-avatar"> - <figure> - <img alt="<%= @export.left.name %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, @export.left.name) %>" /> - <figcaption><%= @export.left.name %></figcaption> - </figure> - </div> - <div class="wa-avatar"> - <figure> - <img alt="<%= @export.right.name %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, @export.right.name) %>" /> - <figcaption><%= @export.right.name %></figcaption> - </figure> - </div> +<div class="parties"> + <%= party_peek(assigns, @export.left) %> + <%= party_peek(assigns, @export.right) %> </div> <%= for message <- @export.messages do %> <%= case message.side do %> <% :left -> %> -<div class="wa-row wa-row-left"> - <img class="wa-avatar--tiny" src="<%= Routes.exports_path(@conn, :get_avatar, @id, @export.left.name) %>" /> +<div class="row row-left"> + <%= party_avatar(assigns, @export.left, :tiny) %> <% :right -> %> -<div class="wa-row wa-row-right"> - <img class="wa-avatar--tiny" src="<%= Routes.exports_path(@conn, :get_avatar, @id, @export.right.name) %>" /> +<div class="row row-right"> + <%= party_avatar(assigns, @export.right, :tiny) %> <% end %> - <div class="wa-message wa-white-box"> + <div class="message white-box"> <%= case message.attachment do %> <% %Waev.Export.Message.File{filename: filename, type: :image} -> %> - <img class="wa-message-photo" alt="<%= filename %>" src="<%= Routes.exports_path(@conn, :get_media, @id, filename) %>" /> + <img class="message-photo" alt="<%= filename %>" src="<%= Routes.exports_path(@conn, :get_media, @id, filename) %>" /> <% _ -> %> <% end %> - <div class="wa-message-box"> + <div class="message-box"> <%= case message.attachment do %> <% %Waev.Export.Message.File{filename: filename, type: :file} -> %> - <a class="wa-message-text" href="<%= Routes.exports_path(@conn, :get_media, @id, filename) %>"><%= filename %></a> + <a class="message-text" href="<%= Routes.exports_path(@conn, :get_media, @id, filename) %>"><%= filename %></a> <% _ -> %> <% end %> <div><%= message.text %></div> - <div class="wa-message-date"> + <div class="message-date"> <%= message.date %> </div> </div> diff --git a/lib/waev_web/views/exports_view.ex b/lib/waev_web/views/exports_view.ex index c4b637f..c4a1b59 100644 --- a/lib/waev_web/views/exports_view.ex +++ b/lib/waev_web/views/exports_view.ex @@ -1,3 +1,25 @@ defmodule WaevWeb.ExportsView do use WaevWeb, :view + + def party_peek(assigns, party) do + ~E""" +<div class="party-peek"> + <figure> + <%= party_avatar(assigns, party, :big) %> + <figcaption><%= party.name %></figcaption> + </figure> +</div> +""" + end + + def party_avatar(assigns, party, size) do + modifier = + case size do + :tiny -> "avatar--tiny" + :big -> "avatar--big" + end + ~E""" +<img class="avatar <%= modifier %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, party.name) %>" /> +""" + end end |