diff options
Diffstat (limited to 'public/gallery.js')
-rw-r--r-- | public/gallery.js | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/public/gallery.js b/public/gallery.js index 222bde5..96f0216 100644 --- a/public/gallery.js +++ b/public/gallery.js @@ -371,15 +371,45 @@ let OrphansModel = { }, } +let OrphansReplacement = { + view(node) { + const info = vnode.attrs.info + if (!info) + return [] + + return [ + ` → `, + m(m.route.Link, {href: `/view/${info.sha1}`}, + m('img.thumbnail', {src: `/thumb/${info.sha1}`, + width: info.thumbW, height: info.thumbH, loading})), + `${info.tags} tags`, + ] + }, +} + +let OrphansRow = { + view(node) { + const info = vnode.attrs.info + return m('.row', [ + m('img.thumbnail', {src: `/thumb/${info.sha1}`, + width: info.thumbW, height: info.thumbH, loading}), + `${info.tags} tags`, + m(OrphansReplacement, {info: info.replacement}), + ]) + }, +} + let OrphansList = { // See BrowseView. oncreate(vnode) { vnode.dom.focus() }, view(vnode) { - let children = (DuplicatesModel.entries.length == 0) + let children = (OrphansModel.entries.length == 0) ? "No orphans" - : OrphansModel.entries.map(group => - m('.row', "TODO")) + : OrphansModel.entries.map(info => [ + m("h3", info.lastPath), + m(OrphansRow, {info}), + ]) return m('.orphans[tabindex=0]', {}, children) }, } |