diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2015-04-16 20:33:02 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2015-04-16 20:33:02 +0200 | 
| commit | 908744a6f3d5ac40a48f0a52c5167e131785b2cc (patch) | |
| tree | 027ddde8fa6a0293a98de6a99b5f0f3dfa27e830 | |
| parent | 8b9008a94a3b3b626bbe916d6f461189938dab3c (diff) | |
| download | Chimère-908744a6f3d5ac40a48f0a52c5167e131785b2cc.tar.bz2 Chimère-908744a6f3d5ac40a48f0a52c5167e131785b2cc.zip  | |
Allow custom fx for "show_dialog"
| -rw-r--r-- | chimere/static/chimere/js/jquery.chimere.js | 25 | 
1 files changed, 15 insertions, 10 deletions
diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index d85490f..4303e14 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -82,6 +82,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {              // Provide this function for overriding the getSubcategories default              get_subcategories_fx: null,              hide_popup_fx: null, +            open_dialog_fx: null,              // if leave to false every click on the map hide the pop-up              explicit_popup_hide: false,              controls:null, @@ -1409,16 +1410,23 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {                  helpers.zoom_to_area(options["area"]);              }          }, +        open_dialog: function(title, content){ +            if(settings.open_dialog_fx){ +                settings.open_dialog_fx(title, content); +            } else { +                $("#category_description").html(content).dialog(); +                $("#category_description").dialog("option", "title", title); +                $('#category_description').dialog('open'); +            } +        },          category_detail: function (category_id) {              /* show the detail of a category */              var uri = extra_url + "getDescriptionDetail/" + category_id;              $.ajax({url:uri, -                        success: function (data) { -                            $("#category_description").html(data).dialog(); -                            $("#category_description").dialog( "option", "title", -                                    $("#category_title").html()); -                        } -                  }); +                    success: function (data) { +                        methods.open_dialog($("#category_title").html(), data); +                    } +                   });          },          /*          * Load the subcategory description if available @@ -1430,10 +1438,7 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {                      dataType: "json",                      success: function (data) {                          if (!data.description){return} -                        $('#category_description').html(data.description); -                        $("#category_description").dialog("option", "title", -                                                          data.name); -                        $('#category_description').dialog('open'); +                        methods.open_dialog(data.name, data.description);                      },                      error: function (data) {                          // fail silently  | 
