summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Releases
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-05-28 16:39:38 +0200
committerYorhel <git@yorhel.nl>2020-05-28 16:39:40 +0200
commite36bfde55478f4ae5d83ee73845a348a92386bca (patch)
tree932eea74bd2b29dbac5065c810691c731ef30e63 /lib/VNWeb/Releases
parent002f165ed4823b7563e7443526d907d27b5b431b (diff)
Drop ReleaseExtLinks.elm in favor of pure CSS solution
It's the only Elm module used on VN pages for not-logged-in visitors, so doing this in CSS makes it possible to not load an Elm bundle on those pages (when I get to splitting up the JS files). This solution also simplifies code reuse with the producer pages, but a v2rw migration of that page would have taken care of that as well.
Diffstat (limited to 'lib/VNWeb/Releases')
-rw-r--r--lib/VNWeb/Releases/Lib.pm31
1 files changed, 24 insertions, 7 deletions
diff --git a/lib/VNWeb/Releases/Lib.pm b/lib/VNWeb/Releases/Lib.pm
index a5853504..29042c56 100644
--- a/lib/VNWeb/Releases/Lib.pm
+++ b/lib/VNWeb/Releases/Lib.pm
@@ -10,15 +10,32 @@ our @EXPORT = qw/release_extlinks_/;
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', '';
+
+ if($r->{extlinks}->@* == 1 && $r->{website}) {
+ a_ href => $r->{website}, sub {
+ abbr_ class => 'icons external', title => 'Official website', '';
+ };
+ return
+ }
+
+ div_ class => 'elm_dd_noarrow elm_dd_hover elm_dd_left elm_dd_relextlink', sub {
+ div_ class => 'elm_dd', sub {
+ a_ href => $r->{website}||'#', sub {
+ txt_ scalar $r->{extlinks}->@*;
+ abbr_ class => 'icons external', title => 'External link', '';
+ };
+ div_ sub {
+ ul_ sub {
+ li_ sub {
+ a_ href => $_->[1], sub {
+ span_ $_->[2] if length $_->[2];
+ txt_ $_->[0];
+ }
+ } for $r->{extlinks}->@*;
+ }
+ }
}
}
- elm_ ReleaseExtLinks => undef, [ ''.($id||$r->{id}), $r->{extlinks} ], \&icon_ if $has_dd;
- icon_ if !$has_dd;
}
1;