From: Gael UTARD <[email protected]> And select portrait by default instead of landscape.
Signed-off-by: Gael UTARD <[email protected]> --- www/maposmatic/forms.py | 4 ++-- www/media/js/newmap.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/www/maposmatic/forms.py b/www/maposmatic/forms.py index 8ed0a8c..251d24c 100644 --- a/www/maposmatic/forms.py +++ b/www/maposmatic/forms.py @@ -57,8 +57,8 @@ class MapRenderingJobForm(forms.ModelForm): MODES = (('admin', _('Administrative boundary')), ('bbox', _('Bounding box'))) - ORIENTATION = (('landscape', _('Landscape')), - ('portrait', _('Portrait'))) + ORIENTATION = (('portrait', _('Portrait')), + ('landscape', _('Landscape'))) mode = forms.ChoiceField(choices=MODES, initial='admin', widget=forms.RadioSelect) diff --git a/www/media/js/newmap.js b/www/media/js/newmap.js index 14f084c..78f2da4 100644 --- a/www/media/js/newmap.js +++ b/www/media/js/newmap.js @@ -74,7 +74,8 @@ function handlePaperSizeClick(width_mm, height_mm, portrait_ok, landscape_ok) if (landscape_ok) { landscape.attr("disabled", ""); - landscape.attr("checked", "checked"); + if (! portrait_ok) + landscape.attr("checked", "checked"); landscape.parent().parent().removeClass("disabled"); } else { @@ -84,8 +85,7 @@ function handlePaperSizeClick(width_mm, height_mm, portrait_ok, landscape_ok) if (portrait_ok) { portrait.attr("disabled", ""); - if (! landscape_ok) - portrait.attr("checked", "checked"); + portrait.attr("checked", "checked"); portrait.parent().parent().removeClass("disabled"); } else { @@ -119,6 +119,9 @@ function filterAllowedPaper(paperlist) paperDef[1], paperDef[2], paperDef[3], paperDef[4])); $(item).show(); + /* select the default paper size */ + if (paperDef[5]) + default_paper = $(item); } else $(item).hide(); @@ -134,10 +137,7 @@ function filterAllowedPaper(paperlist) }); $("#paperselection").show(); - - /* Make sure that default paper size and orientation are selected - * by simulating a click on the first available paper */ - $("label input", $($("#papersizeselection ul li:visible")[0])).click(); + $("label input", $(default_paper)).click(); } function preparePaperPanel() -- 1.7.5.4
