aboutsummaryrefslogtreecommitdiffstats
path: root/root
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2024-01-01 22:24:50 -0800
committerDan Fandrich <dan@coneharvesters.com>2024-01-01 22:27:36 -0800
commit1090823edb5ecbe7a7fc4ffba7dddeeb2a3dea71 (patch)
tree764477c68d07154dd52548e5b813a460aa86cbfb /root
parent09eb282b123abcd3937235700571b9a761407c75 (diff)
downloadmgamirrors-1090823edb5ecbe7a7fc4ffba7dddeeb2a3dea71.tar
mgamirrors-1090823edb5ecbe7a7fc4ffba7dddeeb2a3dea71.tar.gz
mgamirrors-1090823edb5ecbe7a7fc4ffba7dddeeb2a3dea71.tar.bz2
mgamirrors-1090823edb5ecbe7a7fc4ffba7dddeeb2a3dea71.tar.xz
mgamirrors-1090823edb5ecbe7a7fc4ffba7dddeeb2a3dea71.zip
Choose better defaults in the distrib page
Default to the lexicographic last of the versions and architectures for the user rather than allowing the browser default to the first. This will normally select Cauldron and x86_64.
Diffstat (limited to 'root')
-rw-r--r--root/html/pages/distrib/index.tt14
1 files changed, 10 insertions, 4 deletions
diff --git a/root/html/pages/distrib/index.tt b/root/html/pages/distrib/index.tt
index 9102db0..5ce85ea 100644
--- a/root/html/pages/distrib/index.tt
+++ b/root/html/pages/distrib/index.tt
@@ -1,21 +1,27 @@
<!-- $Id$ -->
<form id="distform" action="[% c.uri_for() %]">
-[% FOREACH ver = c.model('Mirrors').version_list.keys.sort %]
+[% SET versions = c.model('Mirrors').version_list.keys.sort %]
+[% SET selver = c.req.param('version') %]
+[% DEFAULT selver = versions.-1 %]
+[% FOREACH ver = versions %]
[% IF loop.first %]
<select name="version">
[% END %]
-<option value="[% ver | html %]"[% 'selected="selected"' IF ver == c.req.param('version') %]>[% ver | html %]</option>
+<option value="[% ver | html %]"[% ' selected' IF ver == selver %]>[% ver | html %]</option>
[% IF loop.last %]
</select>
[% END %]
[% END %]
-[% FOREACH arch = c.model('Mirrors').arch_list.keys.sort %]
+[% SET archs = c.model('Mirrors').arch_list.keys.sort %]
+[% SET selarch = c.req.param('arch') %]
+[% DEFAULT selarch = archs.-1 %]
+[% FOREACH arch = archs %]
[% IF loop.first %]
<select name="arch">
[% END %]
-<option value="[% arch | html %]"[% 'selected="selected"' IF arch == c.req.param('arch') %]>[% arch | html %]</option>
+<option value="[% arch | html %]"[% ' selected' IF arch == selarch %]>[% arch | html %]</option>
[% IF loop.last %]
</select>
[% END %]