Add preliminary photo drag-drop code.

This commit is contained in:
voussoir 2021-01-25 13:47:47 -08:00
parent 6c2da7a6f0
commit b5e8363374
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 32 additions and 2 deletions

View file

@ -74,6 +74,26 @@ cards.bookmarks = {};
/******************************************************************************/ /******************************************************************************/
cards.photos = {}; cards.photos = {};
cards.photos.drag_start =
function drag_start(event)
{
}
cards.photos.drag_end =
function drag_end(event)
{
}
cards.photos.drag_over =
function drag_over(event)
{
}
cards.photos.drag_drop =
function drag_drop(event)
{
}
cards.photos.show_tools = cards.photos.show_tools =
function show_tools(event) function show_tools(event)
{ {

View file

@ -123,10 +123,18 @@ draggable=true
{% set tag_names_inner = "T" if tag_names_title else "" %} {% set tag_names_inner = "T" if tag_names_title else "" %}
<div <div
id="photo_card_{{photo.id}}"
data-id="{{photo.id}}" data-id="{{photo.id}}"
class="photo_card photo_card_{{view}} photo_card_unselected {%if photo.searchhidden%}photo_card_searchhidden{%endif%}" class="photo_card photo_card_{{view}} photo_card_unselected {%if photo.searchhidden%}photo_card_searchhidden{%endif%}"
ondragstart="return cards.photos.drag_start(event);"
ondragend="return cards.photos.drag_end(event);"
ondragover="return cards.photos.drag_over(event);"
ondrop="return cards.photos.drag_drop(event);"
draggable="true"
> >
<div class="photo_card_filename"><a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a></div> <div class="photo_card_filename">
<a target="_blank" href="/photo/{{photo.id}}" draggable="false">{{photo.basename}}</a>
</div>
<span class="photo_card_metadata"> <span class="photo_card_metadata">
{{- metadatas|join_and_trail(", ")|safe -}} {{- metadatas|join_and_trail(", ")|safe -}}
@ -146,7 +154,9 @@ class="photo_card photo_card_{{view}} photo_card_unselected {%if photo.searchhid
{% set thumbnail_src = "/static/basic_thumbnails/" + thumbnail_src + ".png" %} {% set thumbnail_src = "/static/basic_thumbnails/" + thumbnail_src + ".png" %}
{% endif -%}{# if thumbnail #} {% endif -%}{# if thumbnail #}
<a class="photo_card_thumbnail" target="_blank" href="/photo/{{photo.id}}"><img loading="lazy" src="{{thumbnail_src}}"></a> <a class="photo_card_thumbnail" target="_blank" href="/photo/{{photo.id}}" draggable="false">
<img loading="lazy" src="{{thumbnail_src}}" draggable="false">
</a>
{% endif %}{# if grid #} {% endif %}{# if grid #}
<span class="photo_card_tags" title="{{tag_names_title}}">{{tag_names_inner}}</span> <span class="photo_card_tags" title="{{tag_names_title}}">{{tag_names_inner}}</span>