2022-08-13 22:39:31 +00:00
|
|
|
<!--
|
|
|
|
Photo Gallery Template, shared by Site Photos + User Photos.
|
|
|
|
|
|
|
|
When Site Gallery: .IsSiteGallery is defined and true.
|
|
|
|
When User Gallery: .User is defined, .IsOwnPhotos may be.
|
|
|
|
-->
|
|
|
|
{{define "title"}}
|
2022-08-22 00:29:39 +00:00
|
|
|
{{if .IsSiteGallery}}
|
|
|
|
Member Gallery
|
|
|
|
{{else}}
|
|
|
|
Photos of {{.User.Username}}
|
|
|
|
{{if eq .User.Visibility "private"}}<sup class="fa fa-mask ml-2 is-size-6" title="Private Profile"></sup>{{end}}
|
|
|
|
{{end}}
|
2022-08-13 22:39:31 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
|
|
|
|
<!-- Reusable card body -->
|
|
|
|
{{define "card-body"}}
|
|
|
|
<div>
|
|
|
|
<small class="has-text-grey">Uploaded {{.CreatedAt.Format "Jan _2 2006 15:04:05"}}</small>
|
2024-09-26 05:46:33 +00:00
|
|
|
{{if .Views}}
|
|
|
|
<small class="has-text-grey is-size-7 ml-2">
|
|
|
|
<i class="fa fa-eye"></i>
|
|
|
|
{{.Views}}
|
|
|
|
</small>
|
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
<div class="mt-2">
|
2024-07-07 21:00:58 +00:00
|
|
|
{{if .Pinned}}
|
|
|
|
<span class="tag is-success is-light">
|
|
|
|
<span class="icon"><i class="fa fa-thumbtack"></i></span>
|
|
|
|
<span>Pinned</span>
|
|
|
|
</span>
|
|
|
|
{{end}}
|
|
|
|
|
2022-08-13 06:11:36 +00:00
|
|
|
{{if .Explicit}}
|
|
|
|
<span class="tag is-danger is-light">
|
|
|
|
<span class="icon"><i class="fa fa-fire"></i></span>
|
|
|
|
<span>Explicit</span>
|
|
|
|
</span>
|
|
|
|
{{end}}
|
|
|
|
|
2022-08-13 22:39:31 +00:00
|
|
|
{{if eq .Visibility "public"}}
|
2022-08-13 06:11:36 +00:00
|
|
|
<span class="tag is-info is-light">
|
|
|
|
<span class="icon"><i class="fa fa-eye"></i></span>
|
|
|
|
<span>
|
2022-08-13 22:39:31 +00:00
|
|
|
Public
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
{{else if eq .Visibility "friends"}}
|
|
|
|
<span class="tag is-warning is-light">
|
2022-08-23 03:58:35 +00:00
|
|
|
<span class="icon"><i class="fa fa-user-group"></i></span>
|
2022-08-13 22:39:31 +00:00
|
|
|
<span>
|
|
|
|
Friends
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
{{else}}
|
|
|
|
<span class="tag is-private is-light">
|
2022-08-23 03:58:35 +00:00
|
|
|
<span class="icon"><i class="fa fa-lock"></i></span>
|
2022-08-13 22:39:31 +00:00
|
|
|
<span>
|
|
|
|
Private
|
2022-08-13 06:11:36 +00:00
|
|
|
</span>
|
|
|
|
</span>
|
2022-08-13 22:39:31 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
|
|
|
|
{{if .Gallery}}
|
|
|
|
<span class="tag is-success is-light">
|
|
|
|
<span class="icon"><i class="fa fa-image"></i></span>
|
|
|
|
<span>Gallery</span>
|
|
|
|
</span>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<!-- Reusable card footer -->
|
|
|
|
{{define "card-footer"}}
|
2022-08-21 21:05:08 +00:00
|
|
|
<a class="card-footer-item" href="/photo/edit?id={{.ID}}">
|
|
|
|
<span class="icon"><i class="fa fa-edit"></i></span>
|
|
|
|
<span>Edit</span>
|
|
|
|
</a>
|
|
|
|
<a class="card-footer-item has-text-danger" href="/photo/delete?id={{.ID}}">
|
|
|
|
<span class="icon"><i class="fa fa-trash"></i></span>
|
|
|
|
<span>Delete</span>
|
|
|
|
</a>
|
2022-08-13 06:11:36 +00:00
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<!-- Main content template -->
|
|
|
|
{{define "content"}}
|
2023-12-26 23:44:34 +00:00
|
|
|
{{if not .IsSiteGallery}}
|
|
|
|
<style type="text/css">
|
|
|
|
{{template "profile-theme-hero-style" .User}}
|
|
|
|
</style>
|
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
<div class="container">
|
2024-08-23 05:53:37 +00:00
|
|
|
<section class="hero is-link is-bold">
|
2022-08-13 06:11:36 +00:00
|
|
|
<div class="hero-body">
|
2022-12-21 05:11:43 +00:00
|
|
|
<div class="container">
|
|
|
|
<div class="level">
|
|
|
|
<div class="level-left">
|
|
|
|
<h1 class="title">
|
|
|
|
<span class="icon mr-4"><i class="fa fa-image"></i></span>
|
|
|
|
<span>{{template "title" .}}</span>
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
{{if or .IsOwnPhotos .IsSiteGallery}}
|
|
|
|
<div class="level-right">
|
|
|
|
<div>
|
|
|
|
<a href="/photo/upload" class="button">
|
|
|
|
<span class="icon"><i class="fa fa-upload"></i></span>
|
|
|
|
<span>Upload Photo</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
2022-12-21 05:11:43 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<!-- ugly hack.. needed by the card-footers later below. -->
|
|
|
|
{{$Root := .}}
|
|
|
|
|
|
|
|
<div class="block p-4">
|
2022-08-13 22:39:31 +00:00
|
|
|
<!-- Profile Tab for user view -->
|
|
|
|
{{if not .IsSiteGallery}}
|
2022-08-13 06:11:36 +00:00
|
|
|
<div class="tabs is-boxed">
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<a href="/u/{{.User.Username}}">
|
|
|
|
<span class="icon is-small">
|
|
|
|
<i class="fa fa-user"></i>
|
|
|
|
</span>
|
|
|
|
<span>Profile</span>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="is-active">
|
|
|
|
<a>
|
|
|
|
<span class="icon is-small">
|
|
|
|
<i class="fa fa-image"></i>
|
|
|
|
</span>
|
2022-08-26 02:58:43 +00:00
|
|
|
<span>
|
|
|
|
Photos
|
|
|
|
{{if .PhotoCount}}<span class="tag is-link is-light ml-1">{{.PhotoCount}}</span>{{end}}
|
|
|
|
</span>
|
2023-09-16 20:46:26 +00:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
2024-02-11 00:17:15 +00:00
|
|
|
<a href="/u/{{.User.Username}}/notes">
|
2023-09-16 20:46:26 +00:00
|
|
|
<span class="icon is-small">
|
|
|
|
<i class="fa fa-pen-to-square"></i>
|
|
|
|
</span>
|
|
|
|
<span>
|
|
|
|
Notes
|
|
|
|
{{if .NoteCount}}<span class="tag is-link is-light ml-1">{{.NoteCount}}</span>{{end}}
|
|
|
|
</span>
|
2022-08-13 06:11:36 +00:00
|
|
|
</a>
|
|
|
|
</li>
|
2023-10-22 22:02:24 +00:00
|
|
|
<li>
|
2024-02-11 00:17:15 +00:00
|
|
|
<a href="/u/{{.User.Username}}/friends">
|
2023-10-22 22:02:24 +00:00
|
|
|
<span class="icon is-small">
|
|
|
|
<i class="fa fa-user-group"></i>
|
|
|
|
</span>
|
|
|
|
<span>
|
|
|
|
Friends
|
|
|
|
{{if .FriendCount}}<span class="tag is-link is-light ml-1">{{.FriendCount}}</span>{{end}}
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</li>
|
2022-08-13 06:11:36 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
2022-08-13 22:39:31 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
|
|
|
|
<!-- Photo Detail Modal -->
|
|
|
|
<div class="modal" id="detail-modal">
|
|
|
|
<div class="modal-background"></div>
|
|
|
|
<div class="modal-content photo-modal">
|
2024-03-08 02:10:29 +00:00
|
|
|
<!-- Notes: to get the image to always scale and fit on screen, it is made as a background image in CSS
|
|
|
|
on the detailImg div; but we don't have the image's minimum size here, so the hidden <img> inside
|
|
|
|
provides the size pushing to make it visible on screen, otherwise the divs are 0x0 pixels and nothing
|
|
|
|
would be visible. -->
|
|
|
|
<div id="detailImg">
|
|
|
|
<img style="visibility: hidden">
|
2024-03-16 05:02:24 +00:00
|
|
|
|
|
|
|
<!-- Alt Text button for accessibility -->
|
|
|
|
<button class="button is-small alt-text py-1 px-2">
|
|
|
|
<strong>ALT</strong>
|
|
|
|
</button>
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<button class="modal-close is-large" aria-label="close"></button>
|
|
|
|
</div>
|
|
|
|
|
2023-02-14 06:19:18 +00:00
|
|
|
<!-- Shy User alert banner (Site Gallery) -->
|
|
|
|
{{if and .IsSiteGallery .IsShyUser}}
|
|
|
|
<div class="notification is-danger is-light">
|
|
|
|
<i class="fa fa-exclamation-triangle"></i> You have a <strong>Shy Account</strong> so you will only see
|
|
|
|
pictures of you and your friends here. <a href="/faq#shy-faqs">Learn more <small class="fa fa-external-link"></small></a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<!-- Shy User alert banner (User Gallery - IsShyFrom) -->
|
|
|
|
{{if .IsShyFrom}}
|
|
|
|
<div class="notification is-danger is-light">
|
|
|
|
<i class="fa fa-exclamation-triangle"></i> You have a <strong>Shy Account</strong> and you are not friends
|
|
|
|
with this person so can not see their gallery. <a href="/faq#shy-faqs">Learn more <small class="fa fa-external-link"></small></a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2024-01-07 22:20:01 +00:00
|
|
|
<!-- Notice if the current user can not see the user's default profile picture -->
|
|
|
|
{{if .ProfilePictureHiddenVisibility}}
|
|
|
|
<div class="block">
|
|
|
|
<i class="fa fa-info-circle mr-1"></i>
|
|
|
|
<strong>Notice:</strong>
|
|
|
|
@{{.User.Username}}'s default profile picture is set to
|
|
|
|
{{if eq .ProfilePictureHiddenVisibility "friends"}}
|
|
|
|
<img src="/static/img/shy-friends.png" width="16" height="16">
|
2024-04-13 21:55:25 +00:00
|
|
|
<strong class="has-text-warning">Friends only</strong>
|
2024-01-07 22:20:01 +00:00
|
|
|
{{else}}
|
|
|
|
<img src="/static/img/shy-private.png" width="16" height="16">
|
|
|
|
<strong class="has-text-private">Private</strong>
|
|
|
|
{{end}}
|
|
|
|
visibility and can not be seen by you.
|
|
|
|
<a href="/faq#private-avatar" target="_blank">Learn more <i class="fa fa-external-link"></i></a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2022-08-13 06:11:36 +00:00
|
|
|
<div class="block">
|
2024-08-08 06:05:23 +00:00
|
|
|
<div class="level mb-2">
|
2022-08-13 06:11:36 +00:00
|
|
|
<div class="level-left">
|
|
|
|
<div class="level-item">
|
2023-02-14 06:19:18 +00:00
|
|
|
{{if .Pager.Total}}
|
2022-08-13 06:11:36 +00:00
|
|
|
<span>
|
2024-01-07 00:44:05 +00:00
|
|
|
Found <strong>{{FormatNumberCommas .Pager.Total}}</strong> photo{{Pluralize64 .Pager.Total}} (page {{.Pager.Page}} of {{.Pager.Pages}}).
|
2022-08-13 22:39:31 +00:00
|
|
|
{{if .ExplicitCount}}
|
2023-07-28 03:19:50 +00:00
|
|
|
{{.ExplicitCount}} explicit photo{{Pluralize64 .ExplicitCount}} hidden per your <a href="/settings#prefs">settings</a>.
|
2022-08-13 22:39:31 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</span>
|
2023-10-22 23:03:17 +00:00
|
|
|
{{else if .ExplicitCount}}
|
|
|
|
<!-- No pager, but still show explicit hint, e.g. in case user filters by Private but all privates are explicit -->
|
|
|
|
<span>
|
|
|
|
{{.ExplicitCount}} explicit photo{{Pluralize64 .ExplicitCount}} hidden per your <a href="/settings#prefs">settings</a>.
|
|
|
|
</span>
|
2023-02-14 06:19:18 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="level-right">
|
|
|
|
<div class="level-item">
|
2022-08-26 02:58:43 +00:00
|
|
|
<div class="tabs is-toggle is-small is-hidden-mobile">
|
2022-08-13 06:11:36 +00:00
|
|
|
<ul>
|
|
|
|
<li{{if eq .ViewStyle "cards"}} class="is-active"{{end}}>
|
2023-11-05 21:20:41 +00:00
|
|
|
<a href="{{.Request.URL.Path}}?{{QueryPlus "view" "cards"}}">Cards</a>
|
2022-08-13 06:11:36 +00:00
|
|
|
</li>
|
|
|
|
<li{{if eq .ViewStyle "full"}} class="is-active"{{end}}>
|
2023-11-05 21:20:41 +00:00
|
|
|
<a href="{{.Request.URL.Path}}?{{QueryPlus "view" "full"}}">Full</a>
|
2022-08-13 06:11:36 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2024-08-08 06:05:23 +00:00
|
|
|
<!-- Show an "Unsubscribe to this user's new photo notifications" if you are Friends. -->
|
|
|
|
{{if .AreFriends}}
|
|
|
|
<p class="block">
|
|
|
|
<a href="/comments/subscription?table_name=friend.photos&table_id={{.User.Username}}&next={{UrlEncode .Request.URL.String}}&subscribe={{if .AreNotificationsMuted}}true{{else}}false{{end}}"
|
|
|
|
class="{{if .AreNotificationsMuted}}has-text-success{{else}}{{end}}">
|
|
|
|
<span class="icon"><i class="fa fa-bell{{if not .AreNotificationsMuted}}-slash{{end}}"></i></span>
|
|
|
|
<span>
|
|
|
|
{{if .AreNotificationsMuted}}
|
|
|
|
Enable notifications about <strong>{{.User.Username}}</strong>'s new photos
|
|
|
|
{{else}}
|
|
|
|
Mute notifications about <strong>{{.User.Username}}</strong>'s new photos
|
|
|
|
{{end}}
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
|
2024-03-29 06:02:42 +00:00
|
|
|
<!-- If viewing our own profile, and we don't have a profile picture set, offer advice. -->
|
2024-03-29 06:06:58 +00:00
|
|
|
{{if and (not .IsSiteGallery) (eq .CurrentUser.ProfilePhoto.ID 0) (eq .CurrentUser.ID .User.ID)}}
|
2024-03-29 06:02:42 +00:00
|
|
|
<div class="notification is-success is-light content">
|
|
|
|
<p>
|
|
|
|
<i class="fa-regular fa-id-badge mr-1"></i>
|
|
|
|
<strong>Your default profile picture is not set</strong>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Your default profile picture is currently not set to anything, and appears to other members as
|
|
|
|
the default blue <img src="/static/img/shy.png" width="16" height="16"> placeholder image.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
To upload a <strong>new</strong> profile picture, <a href="/photo/upload?intent=profile_pic">click here</a>.
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
To use one of your <strong>existing</strong> photos as your profile picture:
|
|
|
|
<ol class="my-2">
|
|
|
|
<li>
|
|
|
|
Click on the "Edit" button beneath one of your photos below.
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
On the edit page, below the picture, click on the button to "Set this as my profile photo (crop image)"
|
|
|
|
and select the square shape you want for your profile pic.
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
Click on "Save Changes" when done!
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Having a profile picture set, along with an approved <a href="/photo/certification">certification photo</a>,
|
|
|
|
is required to access the social features on {{PrettyTitle}} such as the chat room, forums and member directory.
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2023-10-23 02:17:49 +00:00
|
|
|
<!-- Indicator if friends-only is selected. -->
|
|
|
|
{{if eq .FilterWho "friends"}}
|
|
|
|
<div class="notification is-success is-light">
|
2023-10-26 03:07:28 +00:00
|
|
|
Showing you all recent photos from <strong>yourself & your friends.</strong>
|
2023-10-23 02:17:49 +00:00
|
|
|
<a href="{{.Request.URL.Path}}?who=everybody">See all certified members' gallery photos?</a>
|
|
|
|
</div>
|
2023-10-26 03:07:28 +00:00
|
|
|
{{else if eq .FilterWho "friends+private"}}
|
|
|
|
<div class="notification is-success is-light">
|
|
|
|
Showing you all recent photos from <strong>yourself & your friends</strong> as well
|
|
|
|
as any <strong>private photos shared with you</strong> by others on the site (if they are
|
|
|
|
marked to appear in the Site Gallery).
|
|
|
|
</div>
|
2024-04-28 02:06:17 +00:00
|
|
|
{{else if eq .FilterWho "likes"}}
|
|
|
|
<div class="notification is-success is-light">
|
|
|
|
Showing you photos that you have <i class="fa fa-heart"></i> <strong>Liked.</strong>
|
|
|
|
</div>
|
2023-10-23 02:17:49 +00:00
|
|
|
{{end}}
|
|
|
|
|
2023-10-22 23:03:17 +00:00
|
|
|
<!-- Filters -->
|
2022-09-08 04:18:54 +00:00
|
|
|
<div class="block">
|
2023-10-22 23:03:17 +00:00
|
|
|
<form action="{{.Request.URL.Path}}" method="GET">
|
2022-09-08 04:18:54 +00:00
|
|
|
|
|
|
|
<div class="card nonshy-collapsible-mobile">
|
|
|
|
<header class="card-header has-background-link-light">
|
2024-03-30 22:59:29 +00:00
|
|
|
<p class="card-header-title has-text-dark">
|
2022-10-21 04:02:30 +00:00
|
|
|
Search Filters
|
2022-09-08 04:18:54 +00:00
|
|
|
</p>
|
|
|
|
<button class="card-header-icon" type="button">
|
|
|
|
<span class="icon">
|
|
|
|
<i class="fa fa-angle-up"></i>
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</header>
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="columns is-multiline mb-0">
|
|
|
|
|
2023-10-23 02:17:49 +00:00
|
|
|
<!-- Site Gallery: friends-only filter -->
|
|
|
|
{{if .IsSiteGallery}}
|
|
|
|
<div class="column">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label" for="who">Whose photos:</label>
|
|
|
|
<div class="select is-fullwidth">
|
|
|
|
<select id="who" name="who">
|
2023-10-26 03:07:28 +00:00
|
|
|
<option value="friends"{{if eq .FilterWho "friends"}} selected{{end}}>Myself & friends only</option>
|
|
|
|
<option value="friends+private"{{if eq .FilterWho "friends+private"}} selected{{end}}>Myself, friends, & private photo grants</option>
|
2024-04-28 02:06:17 +00:00
|
|
|
<option value="likes"{{if eq .FilterWho "likes"}} selected{{end}}>Photos I have 'liked'</option>
|
2023-10-23 02:17:49 +00:00
|
|
|
<option value="everybody"{{if eq .FilterWho "everybody"}} selected{{end}}>All certified members</option>
|
2024-07-26 05:39:11 +00:00
|
|
|
{{if .CurrentUser.HasAdminScope "social.moderator.photo"}}
|
|
|
|
<option value="uncertified"{{if eq .FilterWho "uncertified"}} selected{{end}}>☮ Non-certified members</option>
|
|
|
|
{{end}}
|
2023-10-23 02:17:49 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2023-10-22 23:03:17 +00:00
|
|
|
{{if or .CurrentUser.Explicit .IsOwnPhotos}}
|
2022-09-08 04:18:54 +00:00
|
|
|
<div class="column">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label" for="explicit">Explicit:</label>
|
|
|
|
<div class="select is-fullwidth">
|
|
|
|
<select id="explicit" name="explicit">
|
|
|
|
<option value="">Show all</option>
|
|
|
|
<option value="true"{{if eq .FilterExplicit "true"}} selected{{end}}>Only explicit</option>
|
|
|
|
<option value="false"{{if eq .FilterExplicit "false"}} selected{{end}}>Hide explicit</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<div class="column">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label" for="visibility">Visibility:</label>
|
|
|
|
<div class="select is-fullwidth">
|
|
|
|
<select id="visibility" name="visibility">
|
|
|
|
<option value="">All photos</option>
|
|
|
|
<option value="public"{{if eq .FilterVisibility "public"}} selected{{end}}>Public only</option>
|
2023-10-22 23:03:17 +00:00
|
|
|
|
|
|
|
<!-- Friends & Private: always show on Site Gallery, show if available on User Gallery -->
|
|
|
|
{{if or .IsSiteGallery .AreFriends .IsOwnPhotos}}
|
2022-09-08 04:18:54 +00:00
|
|
|
<option value="friends"{{if eq .FilterVisibility "friends"}} selected{{end}}>Friends only</option>
|
2023-10-22 23:03:17 +00:00
|
|
|
{{end}}
|
|
|
|
{{if or .IsSiteGallery .AreWeGrantedPrivate .IsOwnPhotos}}
|
2022-09-08 04:18:54 +00:00
|
|
|
<option value="private"{{if eq .FilterVisibility "private"}} selected{{end}}>Private only</option>
|
2023-10-22 23:03:17 +00:00
|
|
|
{{end}}
|
2022-09-08 04:18:54 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="column">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label" for="sort">Sort by:</label>
|
|
|
|
<div class="select is-fullwidth">
|
|
|
|
<select id="sort" name="sort">
|
2024-07-07 21:00:58 +00:00
|
|
|
{{if not .IsSiteGallery}}
|
|
|
|
<option value="pinned desc nulls last, updated_at desc"{{if eq .Sort "pinned desc nulls last, updated_at desc"}} selected{{end}}>
|
|
|
|
Pinned, recently updated
|
|
|
|
</option>
|
|
|
|
{{end}}
|
2022-09-08 04:18:54 +00:00
|
|
|
<option value="created_at desc"{{if eq .Sort "created_at desc"}} selected{{end}}>Most recent</option>
|
|
|
|
<option value="created_at asc"{{if eq .Sort "created_at asc"}} selected{{end}}>Oldest first</option>
|
2024-09-22 00:25:36 +00:00
|
|
|
<option value="like_count desc"{{if eq .Sort "like_count desc"}} selected{{end}}>Most likes</option>
|
|
|
|
<option value="comment_count desc"{{if eq .Sort "comment_count desc"}} selected{{end}}>Most comments</option>
|
2024-09-26 05:46:33 +00:00
|
|
|
<option value="views desc"{{if eq .Sort "views desc"}} selected{{end}}>Most views</option>
|
2022-09-08 04:18:54 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-10-22 23:03:17 +00:00
|
|
|
{{if and .IsSiteGallery (.CurrentUser.HasAdminScope "social.moderator.photo")}}
|
2022-09-10 03:11:50 +00:00
|
|
|
<div class="column">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label has-text-danger" for="admin_view">Admin view:</label>
|
|
|
|
<div class="select is-fullwidth">
|
|
|
|
<select id="admin_view" name="admin_view">
|
|
|
|
<option value="">Default (disabled)</option>
|
|
|
|
<option value="true"{{if .AdminView}} selected{{end}}>Show all photos</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2022-09-08 04:18:54 +00:00
|
|
|
</div>
|
|
|
|
<div class="has-text-centered">
|
2023-10-22 23:07:24 +00:00
|
|
|
<a href="{{.Request.URL.Path}}" class="button">Reset</a>
|
2022-09-08 04:18:54 +00:00
|
|
|
<button type="submit" class="button is-success">
|
|
|
|
Apply Filters
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-11-05 21:20:41 +00:00
|
|
|
<!-- Retain cards vs. full parameter -->
|
|
|
|
<input type="hidden" name="view" value="{{.ViewStyle}}">
|
|
|
|
|
2022-09-08 04:18:54 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{if .IsOwnPhotos}}
|
|
|
|
<div class="block">
|
|
|
|
<a href="/photo/private" class="has-text-private">
|
|
|
|
<span class="icon"><i class="fa fa-lock"></i></span>
|
|
|
|
<span>Manage who can see <strong>my</strong> private photos</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-12-25 07:00:59 +00:00
|
|
|
{{else if not .IsSiteGallery}}
|
2022-09-08 04:18:54 +00:00
|
|
|
<div class="block">
|
2022-12-25 07:00:59 +00:00
|
|
|
{{if not .IsMyPrivateUnlockedFor}}
|
2022-09-08 04:18:54 +00:00
|
|
|
<a href="/photo/private/share?to={{.User.Username}}" class="has-text-private">
|
|
|
|
<span class="icon"><i class="fa fa-unlock"></i></span>
|
|
|
|
<span>Grant <strong>{{.User.Username}}</strong> access to see <strong>my</strong> private photos</span>
|
|
|
|
</a>
|
2022-12-25 07:00:59 +00:00
|
|
|
{{else}}
|
|
|
|
<span class="icon"><i class="fa fa-unlock has-text-private"></i></span>
|
|
|
|
<span>You had granted <strong>{{.User.Username}}</strong> access to see <strong>your</strong> private photos.</span>
|
|
|
|
<a href="/photo/private">Manage that here.</a>
|
|
|
|
{{end}}
|
2022-09-08 04:18:54 +00:00
|
|
|
</div>
|
2022-12-25 07:00:59 +00:00
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if .AreWeGrantedPrivate}}
|
|
|
|
<div class="block mt-0">
|
|
|
|
<span class="icon"><i class="fa fa-eye has-text-private"></i></span>
|
|
|
|
<strong>{{.User.Username}}</strong> has <span class="has-text-private">granted</span> you
|
|
|
|
access to see their private photos.
|
2022-09-08 04:18:54 +00:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2023-06-22 03:46:27 +00:00
|
|
|
{{SimplePager .Pager}}
|
2022-08-13 06:11:36 +00:00
|
|
|
|
|
|
|
<!-- "Full" view style? (blog style) -->
|
|
|
|
{{if eq .ViewStyle "full"}}
|
|
|
|
{{range .Photos}}
|
|
|
|
<div class="card block">
|
2022-08-13 22:39:31 +00:00
|
|
|
<header class="card-header {{if .Explicit}}has-background-danger{{else}}has-background-link{{end}}">
|
|
|
|
<!-- Site Gallery header -->
|
|
|
|
{{if $Root.IsSiteGallery}}
|
|
|
|
<div class="card-header-title has-text-light">
|
|
|
|
{{if $Root.UserMap.Has .UserID}}
|
|
|
|
{{$Owner := $Root.UserMap.Get .UserID}}
|
2022-08-23 03:58:35 +00:00
|
|
|
<div class="columns is-mobile is-gapless nonshy-fullwidth">
|
2022-09-09 04:52:50 +00:00
|
|
|
<div class="column is-narrow mr-2">
|
|
|
|
{{template "avatar-24x24" $Owner}}
|
2022-08-13 22:39:31 +00:00
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<a href="/u/{{$Owner.Username}}" class="has-text-light">
|
|
|
|
{{$Owner.Username}}
|
|
|
|
<i class="fa fa-external-link ml-2"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-08-23 03:58:35 +00:00
|
|
|
<div class="column is-narrow">
|
|
|
|
<span class="icon">
|
|
|
|
{{if eq .Visibility "friends"}}
|
|
|
|
<i class="fa fa-user-group has-text-warning" title="Friends"></i>
|
|
|
|
{{else if eq .Visibility "private"}}
|
|
|
|
<i class="fa fa-lock has-text-private-light" title="Private"></i>
|
|
|
|
{{else}}
|
|
|
|
<i class="fa fa-eye has-text-link-light" title="Public"></i>
|
|
|
|
{{end}}
|
|
|
|
</span>
|
|
|
|
</div>
|
2022-08-13 22:39:31 +00:00
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<span class="fa fa-user mr-2"></span>
|
|
|
|
<span>[deleted]</span>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<!-- User Gallery Full Header -->
|
2022-08-13 06:11:36 +00:00
|
|
|
<p class="card-header-title has-text-light">
|
|
|
|
<span class="icon">
|
|
|
|
<i class="fa fa-image"></i>
|
|
|
|
</span>
|
|
|
|
{{or .Caption "Photo"}}
|
|
|
|
</p>
|
2022-08-13 22:39:31 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</header>
|
|
|
|
|
2023-09-20 01:24:57 +00:00
|
|
|
<div class="card-image has-text-centered is-clipped">
|
2023-06-26 05:55:07 +00:00
|
|
|
<!-- GIF video? -->
|
|
|
|
{{if HasSuffix .Filename ".mp4"}}
|
2024-05-19 21:08:17 +00:00
|
|
|
<video loop controls controlsList="nodownload" playsinline
|
2024-09-27 03:32:04 +00:00
|
|
|
class="js-modal-trigger"
|
|
|
|
data-url="{{PhotoURL .Filename}}" data-photo-id="{{.ID}}"
|
2024-03-16 05:02:24 +00:00
|
|
|
{{if .AltText}}title="{{.AltText}}"{{end}}
|
2023-09-24 18:41:19 +00:00
|
|
|
{{if BlurExplicit .}}class="blurred-explicit"
|
|
|
|
{{else if (not (eq ($Root.CurrentUser.GetProfileField "autoplay_gif") "false"))}}autoplay
|
|
|
|
{{end}}>
|
2023-06-26 05:55:07 +00:00
|
|
|
<source src="{{PhotoURL .Filename}}" type="video/mp4">
|
|
|
|
</video>
|
|
|
|
{{else}}
|
2024-09-26 05:46:33 +00:00
|
|
|
<a href="/photo/view?id={{.ID}}" data-url="{{PhotoURL .Filename}}" data-photo-id="{{.ID}}" target="_blank"
|
2024-09-27 03:32:04 +00:00
|
|
|
class="js-modal-trigger">
|
2024-03-16 05:02:24 +00:00
|
|
|
<img src="{{PhotoURL .Filename}}" loading="lazy"
|
|
|
|
{{if BlurExplicit .}}class="blurred-explicit"{{end}}
|
|
|
|
{{if .AltText}}alt="{{.AltText}}" title="{{.AltText}}"{{end}}>
|
|
|
|
</a>
|
2023-06-26 05:55:07 +00:00
|
|
|
{{end}}
|
2022-08-13 22:39:31 +00:00
|
|
|
</div>
|
|
|
|
|
2022-08-13 06:11:36 +00:00
|
|
|
<div class="card-content">
|
2022-08-13 22:39:31 +00:00
|
|
|
{{if .Caption}}
|
|
|
|
{{.Caption}}
|
|
|
|
{{else}}<em>No caption</em>{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
|
|
|
|
{{template "card-body" .}}
|
2022-08-25 04:17:34 +00:00
|
|
|
|
2024-03-16 20:29:28 +00:00
|
|
|
<!-- Quick mark photo as explicit -->
|
2024-10-02 06:13:09 +00:00
|
|
|
{{if and (not .Explicit) (ne .UserID $Root.CurrentUser.ID) (not .HasAdminLabelNonExplicit)}}
|
2023-12-27 00:26:23 +00:00
|
|
|
<div class="mt-2">
|
2024-03-16 20:29:28 +00:00
|
|
|
<a href="#"
|
|
|
|
class="has-text-danger is-size-7 nonshy-mark-explicit"
|
|
|
|
data-photo-id="{{.ID}}" data-photo-url="{{PhotoURL .Filename}}">
|
|
|
|
<i class="fa fa-fire mr-1"></i>
|
|
|
|
Should this photo be marked Explicit?
|
2023-12-27 00:26:23 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2022-08-27 02:50:33 +00:00
|
|
|
<!-- Like & Comments buttons -->
|
2022-09-10 03:11:50 +00:00
|
|
|
{{if not $Root.AdminView}}
|
2022-08-27 02:50:33 +00:00
|
|
|
<div class="mt-4 columns is-centered is-mobile is-gapless">
|
|
|
|
<div class="column is-narrow mr-1">
|
|
|
|
{{$Like := $Root.LikeMap.Get .ID}}
|
|
|
|
<button type="button" class="button is-small nonshy-like-button"
|
|
|
|
data-table-name="photos" data-table-id="{{.ID}}"
|
|
|
|
title="Like">
|
|
|
|
<span class="icon{{if $Like.UserLikes}} has-text-danger{{end}}"><i class="fa fa-heart"></i></span>
|
|
|
|
<span class="nonshy-likes">
|
|
|
|
Like
|
|
|
|
{{if gt $Like.Count 0}}
|
|
|
|
({{$Like.Count}})
|
|
|
|
{{end}}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="column is-narrow">
|
|
|
|
{{$Comments := $Root.CommentMap.Get .ID}}
|
|
|
|
<a href="/photo/view?id={{.ID}}#comments" class="button is-small">
|
|
|
|
<span class="icon"><i class="fa fa-comment"></i></span>
|
|
|
|
<span>{{$Comments}} Comment{{Pluralize64 $Comments}}</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-08-25 04:17:34 +00:00
|
|
|
</div>
|
2022-09-10 03:11:50 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
2022-08-21 21:05:08 +00:00
|
|
|
|
|
|
|
<footer class="card-footer">
|
2024-05-27 20:02:05 +00:00
|
|
|
{{if or $Root.IsOwnPhotos ($Root.CurrentUser.HasAdminScope "social.moderator.photo")}}
|
2022-08-21 21:05:08 +00:00
|
|
|
{{template "card-footer" .}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if not $Root.IsOwnPhotos}}
|
|
|
|
<a class="card-footer-item has-text-danger" href="/contact?intent=report&subject=report.photo&id={{.ID}}">
|
|
|
|
<span class="icon"><i class="fa fa-flag"></i></span>
|
|
|
|
<span>Report</span>
|
|
|
|
</a>
|
|
|
|
{{end}}
|
|
|
|
</footer>
|
|
|
|
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<!-- "Cards" style (default) -->
|
|
|
|
{{else}}
|
|
|
|
<div class="columns is-multiline">
|
|
|
|
{{range .Photos}}
|
|
|
|
<div class="column is-one-quarter-desktop is-half-tablet">
|
|
|
|
<div class="card">
|
2022-08-13 22:39:31 +00:00
|
|
|
<!-- Header only on Site Gallery version -->
|
|
|
|
{{if $Root.IsSiteGallery}}
|
|
|
|
<header class="card-header {{if .Explicit}}has-background-danger{{else}}has-background-link{{end}}">
|
|
|
|
<div class="card-header-title has-text-light">
|
|
|
|
{{if $Root.UserMap.Has .UserID}}
|
|
|
|
{{$Owner := $Root.UserMap.Get .UserID}}
|
2022-08-23 03:58:35 +00:00
|
|
|
<div class="columns is-mobile is-gapless nonshy-fullwidth">
|
2022-09-09 04:52:50 +00:00
|
|
|
<div class="column is-narrow mr-2">
|
|
|
|
{{template "avatar-24x24" $Owner}}
|
2022-08-13 22:39:31 +00:00
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<a href="/u/{{$Owner.Username}}" class="has-text-light">
|
|
|
|
{{$Owner.Username}}
|
|
|
|
<i class="fa fa-external-link ml-2"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-08-23 03:58:35 +00:00
|
|
|
<div class="column is-narrow">
|
|
|
|
<span class="icon">
|
|
|
|
{{if eq .Visibility "friends"}}
|
|
|
|
<i class="fa fa-user-group has-text-warning" title="Friends"></i>
|
|
|
|
{{else if eq .Visibility "private"}}
|
|
|
|
<i class="fa fa-lock has-text-private-light" title="Private"></i>
|
|
|
|
{{else}}
|
|
|
|
<i class="fa fa-eye has-text-link-light" title="Public"></i>
|
|
|
|
{{end}}
|
|
|
|
</span>
|
|
|
|
</div>
|
2022-08-13 22:39:31 +00:00
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<span class="fa fa-user mr-2"></span>
|
|
|
|
<span>[deleted]</span>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
{{end}}
|
|
|
|
|
2023-09-20 01:24:57 +00:00
|
|
|
<div class="card-image has-text-centered is-clipped">
|
2023-06-26 05:55:07 +00:00
|
|
|
<!-- GIF video? -->
|
|
|
|
{{if HasSuffix .Filename ".mp4"}}
|
2024-05-19 21:08:17 +00:00
|
|
|
<video loop controls controlsList="nodownload" playsinline
|
2024-09-27 03:32:04 +00:00
|
|
|
class="js-modal-trigger"
|
|
|
|
data-url="{{PhotoURL .Filename}}" data-photo-id="{{.ID}}"
|
2024-03-16 05:02:24 +00:00
|
|
|
{{if .AltText}}title="{{.AltText}}"{{end}}
|
2023-09-24 18:41:19 +00:00
|
|
|
{{if BlurExplicit .}}class="blurred-explicit"
|
|
|
|
{{else if (not (eq ($Root.CurrentUser.GetProfileField "autoplay_gif") "false"))}}autoplay
|
|
|
|
{{end}}>
|
2023-06-26 05:55:07 +00:00
|
|
|
<source src="{{PhotoURL .Filename}}" type="video/mp4">
|
|
|
|
</video>
|
|
|
|
{{else}}
|
2024-09-26 05:46:33 +00:00
|
|
|
<a href="/photo/view?id={{.ID}}" data-url="{{PhotoURL .Filename}}" data-photo-id="{{.ID}}" target="_blank"
|
2024-09-27 03:32:04 +00:00
|
|
|
class="js-modal-trigger">
|
2024-03-16 05:02:24 +00:00
|
|
|
<img src="{{PhotoURL .Filename}}" loading="lazy"
|
|
|
|
{{if BlurExplicit .}}class="blurred-explicit"{{end}}
|
|
|
|
{{if .AltText}}alt="{{.AltText}}" title="{{.AltText}}"{{end}}>
|
2023-06-26 05:55:07 +00:00
|
|
|
</a>
|
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
|
|
{{if .Caption}}
|
|
|
|
{{.Caption}}
|
|
|
|
{{else}}<em>No caption</em>{{end}}
|
|
|
|
|
|
|
|
{{template "card-body" .}}
|
2022-08-25 04:17:34 +00:00
|
|
|
|
2024-03-16 20:29:28 +00:00
|
|
|
<!-- Quick mark photo as explicit -->
|
2024-10-02 06:13:09 +00:00
|
|
|
{{if and (not .Explicit) (ne .UserID $Root.CurrentUser.ID) (not .HasAdminLabelNonExplicit)}}
|
2023-12-27 00:26:23 +00:00
|
|
|
<div class="mt-2">
|
2024-03-16 20:29:28 +00:00
|
|
|
<a href="#"
|
|
|
|
class="has-text-danger is-size-7 nonshy-mark-explicit"
|
|
|
|
data-photo-id="{{.ID}}" data-photo-url="{{PhotoURL .Filename}}">
|
|
|
|
<i class="fa fa-fire mr-1"></i>
|
|
|
|
Should this photo be marked Explicit?
|
2023-12-27 00:26:23 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2022-08-27 02:50:33 +00:00
|
|
|
<!-- Like & Comments buttons -->
|
2022-09-10 03:11:50 +00:00
|
|
|
{{if not $Root.AdminView}}
|
2022-08-27 02:50:33 +00:00
|
|
|
<div class="mt-4 columns is-centered is-mobile is-gapless">
|
|
|
|
<div class="column is-narrow mr-1">
|
|
|
|
{{$Like := $Root.LikeMap.Get .ID}}
|
|
|
|
<button type="button" class="button is-small nonshy-like-button"
|
|
|
|
data-table-name="photos" data-table-id="{{.ID}}"
|
|
|
|
title="Like">
|
|
|
|
<span class="icon{{if $Like.UserLikes}} has-text-danger{{end}}"><i class="fa fa-heart"></i></span>
|
|
|
|
<span class="nonshy-likes">
|
|
|
|
Like
|
|
|
|
{{if gt $Like.Count 0}}
|
|
|
|
({{$Like.Count}})
|
|
|
|
{{end}}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="column is-narrow">
|
|
|
|
{{$Comments := $Root.CommentMap.Get .ID}}
|
|
|
|
<a href="/photo/view?id={{.ID}}#comments" class="button is-small">
|
|
|
|
<span class="icon"><i class="fa fa-comment"></i></span>
|
|
|
|
<span>{{$Comments}} Comment{{Pluralize64 $Comments}}</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-08-25 04:17:34 +00:00
|
|
|
</div>
|
2022-09-10 03:11:50 +00:00
|
|
|
{{end}}
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
2022-08-21 21:05:08 +00:00
|
|
|
|
|
|
|
<footer class="card-footer">
|
2024-05-27 20:02:05 +00:00
|
|
|
{{if or $Root.IsOwnPhotos ($Root.CurrentUser.HasAdminScope "social.moderator.photo")}}
|
2022-08-21 21:05:08 +00:00
|
|
|
{{template "card-footer" .}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if not $Root.IsOwnPhotos}}
|
|
|
|
<a class="card-footer-item has-text-danger" href="/contact?intent=report&subject=report.photo&id={{.ID}}">
|
|
|
|
<span class="icon"><i class="fa fa-flag"></i></span>
|
2022-08-27 02:50:33 +00:00
|
|
|
<span class="is-hidden-desktop">Report</span>
|
2022-08-21 21:05:08 +00:00
|
|
|
</a>
|
|
|
|
{{end}}
|
|
|
|
</footer>
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
{{end}}<!-- ViewStyle -->
|
|
|
|
|
2023-06-22 03:46:27 +00:00
|
|
|
{{SimplePager .Pager}}
|
2022-08-13 06:11:36 +00:00
|
|
|
|
2024-04-05 05:24:35 +00:00
|
|
|
<!-- Admin change log link -->
|
2024-05-27 20:02:05 +00:00
|
|
|
{{if .CurrentUser.HasAdminScope "admin.changelog"}}
|
2024-04-05 05:24:35 +00:00
|
|
|
<div class="block">
|
|
|
|
<a href="/admin/changelog?table_name=photos{{if .User}}&about_user_id={{.User.ID}}{{end}}" class="button is-small has-text-warning">
|
|
|
|
<span class="icon"><i class="fa fa-peace mr-1"></i></span>
|
|
|
|
<span>{{if .User}}User{{else}}Site{{end}} Gallery change log</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
2022-08-13 06:11:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
|
|
// Get our modal to trigger it on click of a detail img.
|
2024-03-16 05:02:24 +00:00
|
|
|
let $modal = document.querySelector("#detail-modal"),
|
|
|
|
$altText = $modal.getElementsByTagName("button")[0];
|
|
|
|
|
|
|
|
function setModalImage(url, altText) {
|
|
|
|
let $modalImg = document.querySelector("#detailImg"),
|
|
|
|
$img = $modalImg.getElementsByTagName("img")[0];
|
|
|
|
$img.src = url;
|
|
|
|
$modalImg.style.backgroundImage = `url(${url})`;
|
|
|
|
|
|
|
|
// Alt text?
|
|
|
|
$modalImg.title = altText;
|
|
|
|
$altText.style.display = altText ? "block" : "none";
|
|
|
|
$altText.onclick = (e) => {
|
|
|
|
window.alert(altText);
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-09-26 05:46:33 +00:00
|
|
|
function markImageViewed(photoID) {
|
|
|
|
fetch(`/v1/photo/${photoID}/view`, {
|
|
|
|
method: "POST",
|
|
|
|
mode: "same-origin",
|
|
|
|
cache: "no-cache",
|
|
|
|
credentials: "same-origin",
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
}).then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
if (data.StatusCode !== 200) {
|
2024-09-28 19:45:20 +00:00
|
|
|
console.error("When marking photo %d as viewed: status code %d: %s", photoID, data.StatusCode, data.data.error);
|
2024-09-26 05:46:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}).catch(window.alert);
|
|
|
|
}
|
|
|
|
|
2022-08-13 06:11:36 +00:00
|
|
|
document.querySelectorAll(".js-modal-trigger").forEach(node => {
|
2024-03-16 05:02:24 +00:00
|
|
|
let $img = node.getElementsByTagName("img"),
|
2024-09-27 03:32:04 +00:00
|
|
|
$video = node.tagName === 'VIDEO' ? node : null,
|
2024-09-26 05:46:33 +00:00
|
|
|
photoID = node.dataset.photoId,
|
2024-03-16 05:02:24 +00:00
|
|
|
altText = $img[0] != undefined ? $img[0].alt : '';
|
2024-09-27 03:32:04 +00:00
|
|
|
|
|
|
|
// Video (animated GIF) handlers.
|
|
|
|
if ($video !== null) {
|
|
|
|
|
|
|
|
// Log this video viewed if the user interacts with it in any way.
|
|
|
|
// Note: because videos don't open in the lightbox modal.
|
|
|
|
['pause', 'mouseover'].forEach(event => {
|
|
|
|
$video.addEventListener(event, (e) => {
|
|
|
|
// Log a view of this video.
|
|
|
|
markImageViewed(photoID);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Images: open in the lightbox modal.
|
2022-08-13 06:11:36 +00:00
|
|
|
node.addEventListener("click", (e) => {
|
|
|
|
e.preventDefault();
|
2024-03-16 05:02:24 +00:00
|
|
|
setModalImage(node.dataset.url, altText);
|
2022-08-13 06:11:36 +00:00
|
|
|
$modal.classList.add("is-active");
|
2024-09-26 05:46:33 +00:00
|
|
|
|
|
|
|
// Log a view of this photo.
|
|
|
|
markImageViewed(photoID);
|
2022-08-13 06:11:36 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2024-03-16 20:29:28 +00:00
|
|
|
|
|
|
|
<!-- Mark Explicit modal -->
|
|
|
|
{{template "mark-explicit-modal" .}}
|
2023-06-22 03:46:27 +00:00
|
|
|
{{end}}
|