diff options
author | Yorhel <git@yorhel.nl> | 2019-11-06 14:15:30 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-11-10 12:44:55 +0100 |
commit | 27b1c8315c58e0f37baad991283e66b92e033a94 (patch) | |
tree | 73c45cedeb92790f7ee3a42a19921ed3055dcf26 /lib | |
parent | a2b82d18814521bd7fefe6b7b015c6bdee791ad0 (diff) |
ulist: Generalize Elm dropdown + add release status change & removal
Found a cleaner way to recognize outside-of-dropdown clicks, so that
gets rid of the weird and unreliable message timing workarounds.
TODO:
- Dynamically updating that releases summary thing (1/1 blah)
- Adding releases
- Add "linkradio" styling for plain <a> tags? These hidden checkboxes
are silly for stuff that requires JS anyway.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNWeb/User/Lists.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/VNWeb/User/Lists.pm b/lib/VNWeb/User/Lists.pm index 7c8237c5..5e2f8977 100644 --- a/lib/VNWeb/User/Lists.pm +++ b/lib/VNWeb/User/Lists.pm @@ -210,6 +210,26 @@ json_api qr{/u/ulist/del.json}, $VNDEL, sub { +my $RSTATUS = form_compile any => { + uid => { id => 1 }, + rid => { id => 1 }, + status => { int => 1, enum => [ -1, keys %RLIST_STATUS ] }, # -1 meaning delete +}; + +elm_form 'UListRStatus', undef, $RSTATUS; + +json_api qr{/u/ulist/rstatus.json}, $RSTATUS, sub { + my($data) = @_; + return elm_Unauth if !auth || auth->uid != $data->{uid}; + if($data->{status} == -1) { + tuwf->dbExeci('DELETE FROM rlists WHERE uid =', \$data->{uid}, 'AND rid =', \$data->{rid}) + } else { + tuwf->dbExeci('UPDATE rlists SET status =', \$data->{status}, 'WHERE uid =', \$data->{uid}, 'AND rid =', \$data->{rid}) + } + elm_Success +}; + + # TODO: Filters to find unlabeled VNs or VNs with/without notes? sub filters_ { |