[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 2/8] Simplify preparePaperPanel() function
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 2/8] Simplify preparePaperPanel() function |
Date: |
Sat, 7 Aug 2010 11:18:47 +0200 |
We factorize a little bit the code to make the function simpler and
easier to read.
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/media/map_rendering_form.js | 35 ++++++++++++++++-------------------
1 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/www/media/map_rendering_form.js b/www/media/map_rendering_form.js
index 5a4548d..a146fdf 100644
--- a/www/media/map_rendering_form.js
+++ b/www/media/map_rendering_form.js
@@ -127,32 +127,29 @@ function filterAllowedPaper(paperlist)
function preparePaperPanel()
{
+ /* Start the Ajax request to get the list of allowed paper
+ * sizes */
$("#paperselection").hide();
if (getCurrentMode() == 'bbox')
{
- $.post("/apis/papersize/", {
- lat_upper_left : $("#lat_upper_left").val(),
- lon_upper_left : $("#lon_upper_left").val(),
- lat_bottom_right : $("#lat_bottom_right").val(),
- lon_bottom_right : $("#lon_bottom_right").val(),
- layout : $("input[name='layout']:checked").val()
- },
- function(data) {
- filterAllowedPaper(data);
- }
- );
+ args = {
+ lat_upper_left : $("#lat_upper_left").val(),
+ lon_upper_left : $("#lon_upper_left").val(),
+ lat_bottom_right : $("#lat_bottom_right").val(),
+ lon_bottom_right : $("#lon_bottom_right").val(),
+ layout : $("input[name='layout']:checked").val()
+ };
}
else
{
- $.post("/apis/papersize/", {
- osmid: $("#id_administrative_osmid").val(),
- layout : $("input[name='layout']:checked").val()
- },
- function(data) {
- filterAllowedPaper(data);
- }
- );
+ args = {
+ osmid : $("#id_administrative_osmid").val(),
+ layout : $("input[name='layout']:checked").val()
+ };
}
+
+ $.post("/apis/papersize/", args,
+ function(data) { filterAllowedPaper(data); });
}
/** When using a by admin boundary area, contains the country code of
--
1.7.0.4
- [Maposmatic-dev] [PATCH 1/8] Implement the paper orientation selection, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] Re: [PATCH 1/8] Implement the paper orientation selection, Maxime Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 8/8] Put immediatly focus on the admin search box on page load, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 7/8] Re-indent Javascript code to 2 spaces, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 5/8] Support None/None initial paper size for the 'Best fit' case, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 6/8] Completely rework the Nominatim search, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 3/8] Update paper size in the 'Best fit' case, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 4/8] Only handle click on the label instead on the full <li> element, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 2/8] Simplify preparePaperPanel() function,
Thomas Petazzoni <=