Skip to content

Commit

Permalink
Merge pull request #5 from MrkGrgsn/OEHXCDHG-235
Browse files Browse the repository at this point in the history
OEHXCDHG-235 Show map in search sidebar
  • Loading branch information
Mark Gregson authored Jan 4, 2017
2 parents b5fb374 + 8b3f57f commit cd02048
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ckanext/spatial/public/css/spatial_query.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,7 @@ div[style*="crosshair"] .leaflet-clickable{
display: none;
}
}

.dataset-map #dataset-map-container.minimal-map .leaflet-control-container {
display: none;
}
18 changes: 12 additions & 6 deletions ckanext/spatial/public/js/spatial_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,10 @@ this.ckan.module('spatial-query', function ($, _) {

$('#dataset-map-clear').on('click', clearMap)

// OK add the expander
$('.leaflet-control-draw a', module.el)
.add($('.show-map-link', map_nav))
.on('click', function() {
function loadTheMap() {
if (!is_exanded) {
map_nav.hide();
$('#dataset-map-container').removeClass('minimal-map');
$('body').addClass('dataset-map-expanded');

if (!extentLayer) {
Expand All @@ -229,7 +227,12 @@ this.ckan.module('spatial-query', function ($, _) {
resetMap();
is_exanded = true;
}
});
}

// OK add the expander
$('.leaflet-control-draw a', module.el)
.add($('.show-map-link', map_nav))
.on('click', loadTheMap);
$('.show-map-link i', map_nav).on('click', function(e){
window.location.href = $('#dataset-map-clear').attr('href');
e.stopPropagation();
Expand All @@ -245,6 +248,7 @@ this.ckan.module('spatial-query', function ($, _) {

map_nav.show();
$('body').removeClass('dataset-map-expanded dataset-map-layer-drawn');
$('#dataset-map-container').addClass('minimal-map');
show_map_link.parent().removeClass('active');

var show_form = $('.extended-map-show-form a');
Expand Down Expand Up @@ -320,7 +324,9 @@ this.ckan.module('spatial-query', function ($, _) {
setPreviousExtent();
if(!$('body').is('.dataset-map-layer-drawn')){
setTimeout(function() {
$('#dataset-map-container').css('position', 'absolute');
// $('#dataset-map-container').css('position', 'relative');
$('#dataset-map-container').addClass('minimal-map');
$('.minimal-map').on('click', loadTheMap);
}, 0);
}

Expand Down

0 comments on commit cd02048

Please sign in to comment.