mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
image page scaling
This commit is contained in:
parent
d1d2382348
commit
a0e08f49c3
5 changed files with 25 additions and 6 deletions
3
assets/static/images/tagblocked.svg
Normal file
3
assets/static/images/tagblocked.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 26 KiB |
|
@ -1,6 +1,6 @@
|
|||
.center--layout--flex
|
||||
= if @image.thumbnails_generated do
|
||||
= render PhilomenaWeb.ImageView, "_image_container.html", image: @image, size: :full
|
||||
= render PhilomenaWeb.ImageView, "_image_target.html", image: @image
|
||||
- else
|
||||
#thumbnails-not-yet-generated.block.block--fixed.block--warning.layout--narrow
|
||||
h3 Just a moment
|
||||
|
|
14
lib/philomena_web/templates/image/_image_target.html.slime
Normal file
14
lib/philomena_web/templates/image/_image_target.html.slime
Normal file
|
@ -0,0 +1,14 @@
|
|||
= content_tag :div, [data: image_container_data(@image, :full), class: "image-show-container"] do
|
||||
.block.block--fixed.block--warning.block--no-margin.image-filtered.hidden
|
||||
strong
|
||||
= link("This image is blocked by your current filter - click here to display it anyway", to: "#", data: [click_unfilter: @image.id])
|
||||
p
|
||||
= img_tag(Routes.static_path(PhilomenaWeb.Endpoint, "/images/tagblocked.svg"), width: 250, height: 250, data: [click_unfilter: @image.id])
|
||||
span.filter-explanation
|
||||
=< link("your current filter", to: "#", class: "filter-link")
|
||||
|
||||
#image_target.hidden.image-show data-scaled="true" data-uris=Jason.encode!(thumb_urls(@image, false)) data-width=@image.image_width data-height=@image.image_height
|
||||
= if @image.image_mime_type == "video/webm" do
|
||||
video controls=true
|
||||
- else
|
||||
picture
|
|
@ -18,7 +18,7 @@ defmodule PhilomenaWeb.AppView do
|
|||
def pretty_time(time) do
|
||||
seconds = NaiveDateTime.diff(NaiveDateTime.utc_now(), time, :second)
|
||||
relation = if seconds < 0, do: "from now", else: "ago"
|
||||
time = time |> DateTime.from_naive!("Etc/UTC")
|
||||
time = time |> DateTime.from_naive!("Etc/UTC") |> DateTime.to_iso8601()
|
||||
|
||||
seconds = abs(seconds)
|
||||
minutes = abs(div(seconds, 60))
|
||||
|
@ -42,7 +42,7 @@ defmodule PhilomenaWeb.AppView do
|
|||
true -> String.replace(@time_strings[:years], "%d", to_string(years))
|
||||
end
|
||||
|
||||
content_tag(:time, "#{words} #{relation}", datetime: time |> DateTime.to_iso8601())
|
||||
content_tag(:time, "#{words} #{relation}", datetime: time, title: time)
|
||||
end
|
||||
|
||||
def can?(conn, action, model) do
|
||||
|
|
|
@ -44,8 +44,8 @@ defmodule PhilomenaWeb.ImageView do
|
|||
Application.get_env(:philomena, :image_url_root)
|
||||
end
|
||||
|
||||
def image_container(image, size, block) do
|
||||
data = [
|
||||
def image_container_data(image, size) do
|
||||
[
|
||||
image_id: image.id,
|
||||
image_tags: Jason.encode!(Enum.map(image.tags, & &1.id)),
|
||||
score: image.score,
|
||||
|
@ -61,8 +61,10 @@ defmodule PhilomenaWeb.ImageView do
|
|||
aspect_ratio: image.image_aspect_ratio,
|
||||
size: size
|
||||
]
|
||||
end
|
||||
|
||||
content_tag(:div, block.(), class: "image-container #{size}", data: data)
|
||||
def image_container(image, size, block) do
|
||||
content_tag(:div, block.(), class: "image-container #{size}", data: image_container_data(image, size))
|
||||
end
|
||||
|
||||
def display_order(tags) do
|
||||
|
|
Loading…
Reference in a new issue