Add farm_map library to create and style map instances.
This commit is contained in:
parent
1850c64ee2
commit
000b7b8ea5
|
@ -0,0 +1,3 @@
|
|||
.farm-map {
|
||||
height: 400px;
|
||||
}
|
|
@ -11,3 +11,12 @@ farmOS-map:
|
|||
dependencies:
|
||||
- core/jquery
|
||||
- core/jquery.once
|
||||
|
||||
farm_map:
|
||||
css:
|
||||
theme:
|
||||
css/farm_map.css: { }
|
||||
js:
|
||||
js/farm_map.js: { }
|
||||
dependencies:
|
||||
- farm_map/farmOS-map
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
(function ($, Drupal) {
|
||||
Drupal.behaviors.farm_map = {
|
||||
attach: function (context, settings) {
|
||||
var options = {
|
||||
// TODO: Set the map units.
|
||||
//units: drupalSettings.farm_map.units,
|
||||
interactions: {
|
||||
onFocusOnly: true
|
||||
},
|
||||
};
|
||||
$('.farm-map', context).each(function (index, element) {
|
||||
$(element).once('farm-map').each(function () {
|
||||
$(element).attr('tabIndex', 0);
|
||||
farmOS.map.create($(element).attr('id'), options);
|
||||
$('.ol-popup-closer', context).click(function () {
|
||||
$(element).focus();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}(jQuery, Drupal));
|
Loading…
Reference in New Issue