refactor backend details into sub-template
This commit is contained in:
parent
520e645600
commit
087536862b
2 changed files with 27 additions and 50 deletions
25
templates/_backend_line.html.ep
Normal file
25
templates/_backend_line.html.ep
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s8 m6 l6 right-align">
|
||||||
|
%= $backend->{longname}
|
||||||
|
% if ($backend->{id} == $user->{backend_id}) {
|
||||||
|
(aktuell ausgewählt)
|
||||||
|
% }
|
||||||
|
% if ($backend->{has_area}) {
|
||||||
|
<br/>
|
||||||
|
<a href="https://dbf.finalrewind.org/coverage/HAFAS/<%= $backend->{name} %>"><%= join(q{, }, @{$backend->{regions} // []}) || '[Karte]' %></a>
|
||||||
|
% }
|
||||||
|
% elsif ($backend->{regions}) {
|
||||||
|
<br/>
|
||||||
|
%= join(q{, }, @{$backend->{regions} // []})
|
||||||
|
% }
|
||||||
|
% if ($backend->{homepage}) {
|
||||||
|
<br/>
|
||||||
|
<a href="<%= $backend->{homepage} %>"><%= $backend->{homepage} =~ s{ ^ http s? :// (?: www[.] )? (.*?) (?: / )? $ }{$1}xr %></a>
|
||||||
|
% }
|
||||||
|
</div>
|
||||||
|
<div class="col s4 m6 l6 left-align">
|
||||||
|
<button class="btn waves-effect waves-light <%= $backend->{id} == $user->{backend_id} ? 'disabled' : q{} %>" style="min-width: 6em;" type="submit" name="backend" value="<%= $backend->{id} %>">
|
||||||
|
<%= $backend->{name} %>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -21,31 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% for my $backend (@{ stash('suggestions') // [] }) {
|
% for my $backend (@{ stash('suggestions') // [] }) {
|
||||||
<div class="row">
|
%= include '_backend_line', user => $user, backend => $backend
|
||||||
<div class="col s8 m6 l6 right-align">
|
|
||||||
%= $backend->{longname}
|
|
||||||
% if ($backend->{id} == $user->{backend_id}) {
|
|
||||||
(aktuell ausgewählt)
|
|
||||||
% }
|
|
||||||
% if ($backend->{has_area}) {
|
|
||||||
<br/>
|
|
||||||
<a href="https://dbf.finalrewind.org/coverage/HAFAS/<%= $backend->{name} %>"><%= join(q{, }, @{$backend->{regions} // []}) || '[Karte]' %></a>
|
|
||||||
% }
|
|
||||||
% elsif ($backend->{regions}) {
|
|
||||||
<br/>
|
|
||||||
%= join(q{, }, @{$backend->{regions} // []})
|
|
||||||
% }
|
|
||||||
% if ($backend->{homepage}) {
|
|
||||||
<br/>
|
|
||||||
<a href="<%= $backend->{homepage} %>"><%= $backend->{homepage} =~ s{ ^ http s? :// (?: www[.] )? (.*?) (?: / )? $ }{$1}xr %></a>
|
|
||||||
% }
|
|
||||||
</div>
|
|
||||||
<div class="col s4 m6 l6 left-align">
|
|
||||||
<button class="btn waves-effect waves-light <%= $backend->{id} == $user->{backend_id} ? 'disabled' : q{} %>" style="min-width: 6em;" type="submit" name="backend" value="<%= $backend->{id} %>">
|
|
||||||
<%= $backend->{name} %>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
% }
|
% }
|
||||||
% }
|
% }
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -54,30 +30,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% for my $backend (@{ stash('backends') // [] }) {
|
% for my $backend (@{ stash('backends') // [] }) {
|
||||||
<div class="row">
|
%= include '_backend_line', user => $user, backend => $backend
|
||||||
<div class="col s8 m6 l6 right-align">
|
|
||||||
%= $backend->{longname}
|
|
||||||
% if ($backend->{id} == $user->{backend_id}) {
|
|
||||||
(aktuell ausgewählt)
|
|
||||||
% }
|
|
||||||
% if ($backend->{has_area}) {
|
|
||||||
<br/>
|
|
||||||
<a href="https://dbf.finalrewind.org/coverage/HAFAS/<%= $backend->{name} %>"><%= join(q{, }, @{$backend->{regions} // []}) || '[Karte]' %></a>
|
|
||||||
% }
|
|
||||||
% elsif ($backend->{regions}) {
|
|
||||||
<br/>
|
|
||||||
%= join(q{, }, @{$backend->{regions} // []})
|
|
||||||
% }
|
|
||||||
% if ($backend->{homepage}) {
|
|
||||||
<br/>
|
|
||||||
<a href="<%= $backend->{homepage} %>"><%= $backend->{homepage} =~ s{ ^ http s? :// (?: www[.] )? (.*?) (?: / )? $ }{$1}xr %></a>
|
|
||||||
% }
|
|
||||||
</div>
|
|
||||||
<div class="col s4 m6 l6 left-align">
|
|
||||||
<button class="btn waves-effect waves-light <%= $backend->{id} == $user->{backend_id} ? 'disabled' : q{} %>" style="min-width: 6em;" type="submit" name="backend" value="<%= $backend->{id} %>">
|
|
||||||
<%= $backend->{name} %>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
% }
|
% }
|
||||||
%= end
|
%= end
|
||||||
|
|
Loading…
Reference in a new issue