From 087536862b26619fbf63423d15469d46d70f2365 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 24 Aug 2024 07:42:20 +0200 Subject: [PATCH] refactor backend details into sub-template --- templates/_backend_line.html.ep | 25 +++++++++++++++ templates/select_backend.html.ep | 52 ++------------------------------ 2 files changed, 27 insertions(+), 50 deletions(-) create mode 100644 templates/_backend_line.html.ep diff --git a/templates/_backend_line.html.ep b/templates/_backend_line.html.ep new file mode 100644 index 0000000..5f2bcf1 --- /dev/null +++ b/templates/_backend_line.html.ep @@ -0,0 +1,25 @@ +
+
+ %= $backend->{longname} + % if ($backend->{id} == $user->{backend_id}) { + (aktuell ausgewählt) + % } + % if ($backend->{has_area}) { +
+ <%= join(q{, }, @{$backend->{regions} // []}) || '[Karte]' %> + % } + % elsif ($backend->{regions}) { +
+ %= join(q{, }, @{$backend->{regions} // []}) + % } + % if ($backend->{homepage}) { +
+ <%= $backend->{homepage} =~ s{ ^ http s? :// (?: www[.] )? (.*?) (?: / )? $ }{$1}xr %> + % } +
+
+ +
+
diff --git a/templates/select_backend.html.ep b/templates/select_backend.html.ep index 55182f9..61df44d 100644 --- a/templates/select_backend.html.ep +++ b/templates/select_backend.html.ep @@ -21,31 +21,7 @@ % for my $backend (@{ stash('suggestions') // [] }) { -
-
- %= $backend->{longname} - % if ($backend->{id} == $user->{backend_id}) { - (aktuell ausgewählt) - % } - % if ($backend->{has_area}) { -
- <%= join(q{, }, @{$backend->{regions} // []}) || '[Karte]' %> - % } - % elsif ($backend->{regions}) { -
- %= join(q{, }, @{$backend->{regions} // []}) - % } - % if ($backend->{homepage}) { -
- <%= $backend->{homepage} =~ s{ ^ http s? :// (?: www[.] )? (.*?) (?: / )? $ }{$1}xr %> - % } -
-
- -
-
+ %= include '_backend_line', user => $user, backend => $backend % } % }
@@ -54,30 +30,6 @@
% for my $backend (@{ stash('backends') // [] }) { -
-
- %= $backend->{longname} - % if ($backend->{id} == $user->{backend_id}) { - (aktuell ausgewählt) - % } - % if ($backend->{has_area}) { -
- <%= join(q{, }, @{$backend->{regions} // []}) || '[Karte]' %> - % } - % elsif ($backend->{regions}) { -
- %= join(q{, }, @{$backend->{regions} // []}) - % } - % if ($backend->{homepage}) { -
- <%= $backend->{homepage} =~ s{ ^ http s? :// (?: www[.] )? (.*?) (?: / )? $ }{$1}xr %> - % } -
-
- -
-
+ %= include '_backend_line', user => $user, backend => $backend % } %= end