Skip to content

Commit 4077fed

Browse files
committed
Merge branch 'develop' into 'master'
Develop See merge request gtt/redmine_gtt!14
2 parents e925e74 + 498e3f5 commit 4077fed

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

README.rdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ psql -U postgres -d redmine -c "CREATE EXTENSION postgis;"
1515
Installation goes here
1616

1717
cd path/to/project
18-
bundle install --without test
18+
bundle install --path vendor/bundle --without test
1919

2020
RAILS_ENV=production bundle exec rake db:migrate
2121
RAILS_ENV=production bundle exec rake redmine:plugins:migrate

assets/javascripts/app.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
var App = (function ($, publ) {
88

99
var map, vector, bounds, contents, toolbar, geolocation = null;
10+
var maps = [];
1011
var features = [];
1112
var layerArr = [];
1213
var filters = {
@@ -210,6 +211,9 @@ var App = (function ($, publ) {
210211
publ.zoomToExtent();
211212
map.on('moveend', publ.updateFilter);
212213
});
214+
215+
// Handle multiple maps per page
216+
maps.push(map);
213217
};
214218

215219
/**
@@ -344,12 +348,14 @@ var App = (function ($, publ) {
344348
if (!force && (filters.distance || filters.location)) {
345349
// Do not zoom to extent but show the previous extent stored as cookie
346350
var parts = (getCookie("_redmine_gtt_permalink")).split("/");
347-
map.getView().setZoom(parseInt(parts[0], 10));
348-
map.getView().setCenter(ol.proj.transform([
349-
parseFloat(parts[1]),
350-
parseFloat(parts[2])
351-
],'EPSG:4326','EPSG:3857'));
352-
map.getView().setRotation(parseFloat(parts[3]));
351+
maps.forEach(function (m) {
352+
m.getView().setZoom(parseInt(parts[0], 10));
353+
m.getView().setCenter(ol.proj.transform([
354+
parseFloat(parts[1]),
355+
parseFloat(parts[2])
356+
],'EPSG:4326','EPSG:3857'));
357+
m.getView().setRotation(parseFloat(parts[3]));
358+
})
353359
}
354360
else if (vector.getSource().getFeatures().length > 0) {
355361
var extent = ol.extent.createEmpty();
@@ -358,14 +364,20 @@ var App = (function ($, publ) {
358364
vector.getSource().getFeatures().forEach(function (feature) {
359365
ol.extent.extend(extent, feature.getGeometry().getExtent());
360366
});
361-
map.getView().fit(extent, map.getSize());
367+
maps.forEach(function (m) {
368+
m.getView().fit(extent, m.getSize());
369+
});
362370
}
363371
else if (bounds.getSource().getFeatures().length > 0) {
364-
map.getView().fit(bounds.getSource().getExtent(), map.getSize());
372+
maps.forEach(function (m) {
373+
m.getView().fit(bounds.getSource().getExtent(), m.getSize());
374+
});
365375
}
366376
else if (geolocation) {
367377
geolocation.once('change:position', function (error) {
368-
map.getView().setCenter(geolocation.getPosition());
378+
maps.forEach(function (m) {
379+
m.getView().setCenter(geolocation.getPosition());
380+
});
369381
});
370382
}
371383
};

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
author 'Georepublic'
66
author_url 'https://hub.georepublic.net/gtt/redmine_gtt'
77
description 'Adds location-based task management and maps'
8-
version '0.7.2'
8+
version '0.8.1'
99

1010
requires_redmine :version_or_higher => '3.4.0'
1111

0 commit comments

Comments
 (0)