Skip to content

Commit

Permalink
SAMBRO: Display error DIV if map layer is missing (#1521)
Browse files Browse the repository at this point in the history
* SAMBRO: Display error DIV if map layer is missing

Fixes #1344

* Wrap error message with T()
  • Loading branch information
hallamoore authored and flavour committed Nov 20, 2019
1 parent a61515c commit 5529818
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions modules/templates/SAMBRO/controllers.py
Expand Up @@ -50,25 +50,29 @@ def __call__(self):
except:
current.log.error("Cannot find Layer for Map")
layer_id = None

feature_resources = [{"name" : T("Alerts"),
"id" : "search_results",
"layer_id" : layer_id,
# @ToDo: Make the filter update timestamp on refresh in the client side
"filter" : "~.info.expires__gt=%s&~.external__ne=True" % request.utcnow,
# We activate in callback after ensuring URL is updated for current filter status
"active" : False,
}]

_map = current.gis.show_map(callback='''S3.search.s3map()''',
catalogue_layers=True,
collapsed=True,
feature_resources=feature_resources,
save=False,
search=True,
toolbar=True,
)
output["_map"] = _map
output["_map"] = DIV(
T("Cannot find Layer for Map"),
_class="mapError"
)
else:
feature_resources = [{"name" : T("Alerts"),
"id" : "search_results",
"layer_id" : layer_id,
# @ToDo: Make the filter update timestamp on refresh in the client side
"filter" : "~.info.expires__gt=%s&~.external__ne=True" % request.utcnow,
# We activate in callback after ensuring URL is updated for current filter status
"active" : False,
}]

_map = current.gis.show_map(callback='''S3.search.s3map()''',
catalogue_layers=True,
collapsed=True,
feature_resources=feature_resources,
save=False,
search=True,
toolbar=True,
)
output["_map"] = _map

# Filterable List of Alerts
# - most recent first
Expand Down

0 comments on commit 5529818

Please sign in to comment.