diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-09-27 16:26:28 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-09-27 16:26:28 +0200 |
commit | a324a90b4c8718e8f6133e2ad11c5b78724138d6 (patch) | |
tree | 85bafeec080d98aef262000fdafa3ae6fb88ea2f | |
parent | 13f37c70772f9dd6035d5656fa7a862c107aa217 (diff) | |
download | Chimère-a324a90b4c8718e8f6133e2ad11c5b78724138d6.tar.bz2 Chimère-a324a90b4c8718e8f6133e2ad11c5b78724138d6.zip |
Single click mode for desktop view
-rw-r--r-- | chimere/models.py | 2 | ||||
-rw-r--r-- | chimere/static/chimere/js/jquery.chimere.js | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/chimere/models.py b/chimere/models.py index 5fc946c..3e877ed 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -2076,7 +2076,7 @@ class Area(models.Model, SimpleArea): restrict_to_extent = models.BooleanField(_("Restrict to the area extent"), default=False) single_click_map = models.BooleanField( - _("Mobile - Hide categories after click"), default=False) + _("Hide categories after click"), default=False) min_zoom = models.IntegerField( _("Minimum zoom"), blank=True, null=True, help_text=_("Set a minimal zoom level. By default minimal zoom level " diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index cb030e7..9075c94 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -1836,6 +1836,7 @@ function transformCoordToLonLat(coord) { $('.subcategories li input').bind("click", function (e) { $('#search-result').html(''); var c_name = $(this).attr('name'); + var c_id = $(this).attr('id'); c_name = c_name.substr(c_name.lastIndexOf("_") + 1); var par = $(this).parent(); if ($(this).prop('checked')){ @@ -1843,6 +1844,14 @@ function transformCoordToLonLat(coord) { } else { par.removeClass('selected'); } + if (settings[map_id].single_click_category){ + $('.subcategories li input').each(function(){ + if ($(this).attr('id') != c_id){ + $(this).prop('checked', false); + $(this).parent().removeClass('selected'); + } + }); + } if (!settings[map_id].suspend_load) methods.loadGeoObjects(map_id); _toggle_categories($(this)); if ($('#layer_cat_'+c_name).length){ |