annotate libervia/pages/photos/album/_browser/__init__.py @ 1300:6e110baa707f

browser (photos/album): photo(s) upload and deletion
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 16:47:51 +0200
parents
children 7a4a92cf5b2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1300
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
1 from browser import document, window, bind, html, DOMNode
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
2 from browser import aio
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
3 from browser import timer
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
4 from javascript import JSON
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
5 from interpreter import Inspector
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
6 from bridge import Bridge
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
7 from template import Template
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
8 import dialog
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
9
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
10 files_service = window.files_service
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
11 files_path = window.files_path
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
12 bridge = Bridge()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
13
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
14
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
15 def on_progress(ev, photo_elt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
16 if ev.lengthComputable:
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
17 percent = int(ev.loaded/ev.total*100)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
18 update_progress(photo_elt, percent)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
19
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
20
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
21 def on_load(file_, photo_elt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
22 update_progress(photo_elt, 100)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
23 photo_elt.classList.add("progress_finished")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
24 photo_elt.classList.remove("progress_started")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
25 photo_elt.select_one('.action_delete').bind("click", on_delete)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
26 print(f"file {file_.name} uploaded correctly")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
27
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
28
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
29 def on_error(failure, file_, photo_elt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
30 # TODO: cleaner error notification
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
31 window.alert(f"can't upload {file_.name}: failure")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
32
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
33
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
34 def update_progress(photo_elt, new_value):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
35 progress_elt = photo_elt.select_one("progress")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
36 progress_elt.value = new_value
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
37 progress_elt.text = f"{new_value}%"
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
38
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
39
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
40 def on_slot_cb(file_, upload_slot, photo_elt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
41 put_url, get_url, headers = upload_slot
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
42 xhr = window.XMLHttpRequest.new()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
43 xhr.open("PUT", put_url, True)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
44 xhr.upload.bind('progress', lambda ev: on_progress(ev, photo_elt))
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
45 xhr.upload.bind('load', lambda ev: on_load(file_, photo_elt))
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
46 xhr.upload.bind('error', lambda ev: on_error(xhr.response, file_, photo_elt))
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
47 xhr.setRequestHeader('Xmpp-File-Path', window.encodeURIComponent(files_path))
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
48 xhr.setRequestHeader('Xmpp-File-No-Http', "true")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
49 xhr.send(file_)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
50
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
51
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
52 def on_slot_eb(file_, failure, photo_elt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
53 breakpoint()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
54
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
55
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
56 def upload_files(files):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
57 print(f"uploading {len(files)} files")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
58 photo_tpl = Template('photo/item.html')
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
59 album_items = document['album_items']
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
60 for file_ in files:
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
61 url = window.URL.createObjectURL(file_)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
62 photo_elt = photo_tpl.get_elt({
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
63 "file": {
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
64 "name": file_.name,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
65 # we don't want to open the file on click, it's not yet the
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
66 # uploaded URL
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
67 "url": url,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
68 # we have no thumb yet, so we use the whole image
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
69 # TODO: reduce image for preview
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
70 "thumb_url": url,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
71 },
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
72 "uploading": True,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
73 })
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
74 photo_elt.classList.add("progress_started")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
75 print(photo_elt.outerHTML)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
76 album_items <= photo_elt
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
77 # timer.set_timeout(lambda photo_elt=photo_elt: fake_finish(photo_elt), 5000)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
78
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
79 bridge.fileHTTPUploadGetSlot(
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
80 file_.name,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
81 file_.size,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
82 file_.type or '',
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
83 files_service,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
84 callback=lambda upload_slot, file_=file_, photo_elt=photo_elt:
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
85 on_slot_cb(file_, upload_slot, photo_elt),
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
86 errback=lambda failure, file_=file_, photo_elt=photo_elt:
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
87 on_slot_eb(file_, failure, photo_elt),
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
88 )
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
89
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
90
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
91 @bind("#file_drop", "drop")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
92 def on_file_select(evt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
93 evt.stopPropagation()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
94 evt.preventDefault()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
95 files = evt.dataTransfer.files
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
96 upload_files(files)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
97
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
98
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
99 @bind("#file_drop", "dragover")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
100 def on_drag_over(evt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
101 evt.stopPropagation()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
102 evt.preventDefault()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
103 evt.dataTransfer.dropEffect = 'copy'
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
104
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
105
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
106 @bind("#file_input", "change")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
107 def on_file_input_change(evt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
108 files = evt.currentTarget.files
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
109 upload_files(files)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
110
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
111
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
112 def file_delete_cb(item_elt, item):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
113 item_elt.classList.add("state_deleted")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
114 item_elt.bind("transitionend", lambda evt: item_elt.remove())
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
115 print(f"deleted {item['name']}")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
116
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
117
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
118 def file_delete_eb(failure, item_elt, item):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
119 # TODO: cleaner error notification
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
120 window.alert(f"error while deleting {item['name']}: failure")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
121
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
122
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
123 def delete_ok(evt, notif_elt, item_elt, item):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
124 file_path = f"{files_path.rstrip('/')}/{item['name']}"
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
125 bridge.fileSharingDelete(
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
126 files_service,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
127 file_path,
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
128 "",
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
129 callback=lambda : file_delete_cb(item_elt, item),
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
130 errback=lambda failure: file_delete_eb(failure, item_elt, item),
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
131 )
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
132
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
133
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
134 def delete_cancel(evt, notif_elt, item_elt, item):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
135 notif_elt.remove()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
136 item_elt.classList.remove("selected_for_deletion")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
137
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
138
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
139 def on_delete(evt):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
140 evt.stopPropagation()
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
141 target = evt.currentTarget
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
142 item_elt = DOMNode(target.elt.closest('.item'))
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
143 item_elt.classList.add("selected_for_deletion")
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
144 item = JSON.parse(item_elt.dataset.item)
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
145 dialog.Confirm(
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
146 f"{item['name']!r} will be deleted, are you sure?",
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
147 ok_label="delete",
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
148 ).show(
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
149 ok_cb=lambda evt, notif_elt: delete_ok(evt, notif_elt, item_elt, item),
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
150 cancel_cb=lambda evt, notif_elt: delete_cancel(evt, notif_elt, item_elt, item),
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
151 )
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
152
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
153
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
154 for elt in document.select('.action_delete'):
6e110baa707f browser (photos/album): photo(s) upload and deletion
Goffi <goffi@goffi.org>
parents:
diff changeset
155 elt.bind("click", on_delete)