2019-11-18 05:47:09 +01:00
|
|
|
defmodule PhilomenaWeb.GalleryView do
|
|
|
|
use PhilomenaWeb, :view
|
2019-12-05 01:53:31 +01:00
|
|
|
|
2020-05-08 04:10:54 +02:00
|
|
|
alias PhilomenaWeb.ImageScope
|
2019-12-05 01:53:31 +01:00
|
|
|
|
|
|
|
def scope(conn), do: ImageScope.scope(conn)
|
|
|
|
|
2020-05-01 21:51:28 +02:00
|
|
|
def sortable_classes(%{assigns: %{gallery_prev: prev, gallery_next: next}}) do
|
|
|
|
[]
|
|
|
|
|> sortable_prev(prev)
|
|
|
|
|> sortable_next(next)
|
|
|
|
|> Enum.join(" ")
|
|
|
|
end
|
|
|
|
|
|
|
|
def sortable_prev(list, nil), do: list
|
|
|
|
def sortable_prev(list, _), do: ["js-sortable-has-prev" | list]
|
|
|
|
|
|
|
|
def sortable_next(list, nil), 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
|