philomena/lib/philomena_web/views/gallery_view.ex

24 lines
659 B
Elixir
Raw Permalink Normal View History

2019-11-18 05:47:09 +01:00
defmodule PhilomenaWeb.GalleryView do
use PhilomenaWeb, :view
2019-12-05 01:53:31 +01:00
alias PhilomenaWeb.ImageScope
2019-12-05 01:53:31 +01:00
def scope(conn), do: ImageScope.scope(conn)
def sortable_classes(%{assigns: %{gallery_prev: prev, gallery_next: next}}) do
[]
|> sortable_prev(prev)
|> sortable_next(next)
|> Enum.join(" ")
end
def sortable_prev(list, false), do: list
def sortable_prev(list, _), do: ["js-sortable-has-prev" | list]
def sortable_next(list, false), do: list
def sortable_next(list, _), do: ["js-sortable-has-next" | list]
2019-12-05 01:53:31 +01:00
def show_subscription_link?(%{id: id}, %{id: id}), do: false
def show_subscription_link?(_user1, _user2), do: true
2019-11-18 05:47:09 +01:00
end