diff options
author | Yorhel <git@yorhel.nl> | 2021-06-28 07:53:27 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-07-08 16:11:33 +0200 |
commit | f936faa64f4dae3035159dfa454bf044ba05c517 (patch) | |
tree | e84448438a6ce07a50245c0c6794438881ca2810 /lib/VNWeb/Elm.pm | |
parent | 7c08ad43f59ab237d7fd011fb285e26db9dc5c2d (diff) |
Ulist.Widget: Experiment with a VN list management widget
Currently only added on VN listings in row view, but the goal is to add
this widget to other listings and pages as well. This should make it
easy to see whether a VN is on your list and to add/remove/edit your
list status.
The code is one of the messiest copy-paste jobs I've ever done. I'm
totally going to regret having to maintain this crap. But anyway, let's
first see how this UI is received.
Diffstat (limited to 'lib/VNWeb/Elm.pm')
-rw-r--r-- | lib/VNWeb/Elm.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/VNWeb/Elm.pm b/lib/VNWeb/Elm.pm index 68b244c7..1c02a5fe 100644 --- a/lib/VNWeb/Elm.pm +++ b/lib/VNWeb/Elm.pm @@ -168,7 +168,27 @@ $apis{AdvSearchQuery} = [ { type => 'hash', keys => { # Response to 'AdvSearchLo tags => $apis{TagResult}[0], traits => $apis{TraitResult}[0], anime => $apis{AnimeResult}[0], -} } ], +} } ]; +$apis{UListWidget} = [ { type => 'hash', keys => { # Initialization for UList.Widget and response to UListWidget + uid => { vndbid => 'u' }, + vid => { vndbid => 'v' }, + # Only includes selected labels, null if the VN is not on the list at all. + labels => { required => 0, aoh => { id => { int => 1 }, label => {required => 0, default => ''} } }, + # Can be set to null to lazily load the extra data as needed + full => { required => 0, type => 'hash', keys => { + title => {}, + labels => { aoh => { id => { int => 1 }, label => {}, private => { anybool => 1 } } }, + canvote => { anybool => 1 }, + canreview => { anybool => 1 }, + vote => { vnvote => 1 }, + review => { required => 0, vndbid => 'w' }, + notes => { required => 0, default => '' }, + started => { required => 0, default => '' }, + finished => { required => 0, default => '' }, + releases => $apis{Releases}[0], + rlist => { aoh => { id => { vndbid => 'r' }, status => { uint => 1 } } }, + } }, +} } ]; # Compile %apis into a %schema and generate the elm_Response() functions |