philomena/lib/philomena_web/templates/image/index.html.heex
2024-06-01 23:50:49 -04:00

52 lines
2.1 KiB
Text

<% header = assigns[:header] || ""
params = assigns[:params] || assigns[:scope] || []
scope = assigns[:scope] || []
tags = assigns[:tags] || []
route = assigns[:route] || fn p -> ~p"/images?#{p}" end
image_url = fn image -> ~p"/images/#{image}?#{scope}" end
sorted_url = fn image, hit -> ~p"/images/#{image}?#{Keyword.put(scope, :sort, hit["sort"])}" end
pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @images, route: route, params: params)
info = render(PhilomenaWeb.PaginationView, "_pagination_info.html", page: @images) %>
<div class="block" id="imagelist-container">
<section class="block__header page__header flex">
<span class="block__header__title page__title hide-mobile">
<%= header %>
</span>
<div class="page__pagination">
<%= pagination %>
</div>
<div class="flex__right page__info">
<%= random_button(@conn, params) %>
<%= hidden_toggle(@conn, route, params) %>
<%= deleted_toggle(@conn, route, params) %>
<%= quick_tag(@conn) %>
</div>
</section>
<%= info_row(@conn, tags) %>
<div class="block__content js-resizable-media-container">
<%= for record <- @images do %>
<%= case record do %>
<% {image, hit} -> %>
<%= render(PhilomenaWeb.ImageView, "_image_box.html", image: image, link: sorted_url.(image, hit), size: assigns[:size] || :thumb, conn: @conn) %>
<% image -> %>
<%= render(PhilomenaWeb.ImageView, "_image_box.html", image: image, link: image_url.(image), size: assigns[:size] || :thumb, conn: @conn) %>
<% end %>
<% end %>
</div>
<div class="block__header block__header--light page__header flex">
<div class="page__pagination">
<%= pagination %>
</div>
<span class="block__header__title page__info">
<%= info %>
</span>
<div class="flex__right page__options">
<a href="/settings/edit" title="Display Settings">
<i class="fa fa-cog"></i>
<span class="hide-mobile hide-limited-desktop">
Display Settings
</span>
</a>
</div>
</div>
</div>