From de2a0b3cb152175e7b8df28e97fb532d1021f20c Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 20 Apr 2020 09:27:27 +0200 Subject: v2rw/VN::Page: Add releases listing Biggest visible change here is that external links now require a click to show the dropdown box. I hadn't implemented a hover-style dropdown in Elm yet. I'm not sure yet which solution I like better. --- lib/VNWeb/Releases/Lib.pm | 24 ++++++++++++++++++++++++ lib/VNWeb/Releases/Page.pm | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 lib/VNWeb/Releases/Lib.pm (limited to 'lib/VNWeb/Releases') diff --git a/lib/VNWeb/Releases/Lib.pm b/lib/VNWeb/Releases/Lib.pm new file mode 100644 index 00000000..a5853504 --- /dev/null +++ b/lib/VNWeb/Releases/Lib.pm @@ -0,0 +1,24 @@ +package VNWeb::Releases::Lib; + +use VNWeb::Prelude; +use Exporter 'import'; + +our @EXPORT = qw/release_extlinks_/; + + +# Generate the html for an 'external links' dropdown, assumes enrich_extlinks() has already been called on this object. +sub release_extlinks_ { + my($r, $id) = @_; + return if !$r->{extlinks}->@*; + my $has_dd = $r->{extlinks}->@* > ($r->{website} ? 1 : 0); + my sub icon_ { + a_ href => $r->{website}||'#', sub { + txt_ scalar $r->{extlinks}->@* if $has_dd; + abbr_ class => 'icons external', title => 'External link', ''; + } + } + elm_ ReleaseExtLinks => undef, [ ''.($id||$r->{id}), $r->{extlinks} ], \&icon_ if $has_dd; + icon_ if !$has_dd; +} + +1; diff --git a/lib/VNWeb/Releases/Page.pm b/lib/VNWeb/Releases/Page.pm index d0c6d620..77a50f27 100644 --- a/lib/VNWeb/Releases/Page.pm +++ b/lib/VNWeb/Releases/Page.pm @@ -193,7 +193,7 @@ sub _infotable_ { td_ sub { div_ class => 'elm_dd_input', style => 'width: 150px', sub { my $d = tuwf->dbVali('SELECT status FROM rlists WHERE', { rid => $r->{id}, uid => auth->uid }); - elm_ 'UList.ReleaseEdit', $VNWeb::User::Lists::RLIST_STATUS, { rid => $r->{id}, uid => auth->uid, status => $d }; + elm_ 'UList.ReleaseEdit', $VNWeb::User::Lists::RLIST_STATUS, { rid => $r->{id}, uid => auth->uid, status => $d, empty => 'not on your list' }; } }; } if auth; -- cgit v1.2.3