diff options
| -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 |
