mirror of
https://github.com/Mibew/open-street-map-plugin.git
synced 2025-04-12 04:10:11 +03:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
0f19a690cc | |||
5bbbb0525f | |||
4ccf6ef3b5 | |||
6cf3aa7f1a | |||
ca6b8971b3 | |||
5de46d20ac | |||
71e4b68200 | |||
9a4f5ef15b |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
# Do not index node.js modules that are used for building
|
# Do not index node.js modules that are used for building
|
||||||
node_modules
|
node_modules
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
# Do not index bower components
|
# Do not index bower components
|
||||||
vendor
|
vendor
|
||||||
|
19
Plugin.php
19
Plugin.php
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of Mibew Open Street Map Plugin.
|
* This file is a part of Mibew Open Street Map Plugin.
|
||||||
*
|
*
|
||||||
* Copyright 2014-2018 the original author or authors.
|
* Copyright 2014-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -102,9 +102,11 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
public function pageAddJsHandler(&$args)
|
public function pageAddJsHandler(&$args)
|
||||||
{
|
{
|
||||||
if ($args['request']->attributes->get('_route') == 'users') {
|
if ($args['request']->attributes->get('_route') == 'users') {
|
||||||
$args['js'][] = $this->getFilesPath() . '/vendor/jquery-colorbox/jquery.colorbox-min.js';
|
$filepath = str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath());
|
||||||
$args['js'][] = $this->getFilesPath() . '/vendor/leaflet/dist/leaflet.js';
|
$args['js'][] = $filepath . '/vendor/jquery-colorbox/jquery.colorbox-min.js';
|
||||||
$args['js'][] = $this->getFilesPath() . '/js/plugin.js';
|
$args['js'][] = $filepath . '/vendor/leaflet/dist/leaflet.js';
|
||||||
|
$args['js'][] = $filepath . '/js/common.js';
|
||||||
|
$args['js'][] = $filepath . '/js/users.js';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,9 +118,10 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
public function pageAddCssHandler(&$args)
|
public function pageAddCssHandler(&$args)
|
||||||
{
|
{
|
||||||
if ($args['request']->attributes->get('_route') == 'users') {
|
if ($args['request']->attributes->get('_route') == 'users') {
|
||||||
$args['css'][] = $this->getFilesPath() . '/vendor/jquery-colorbox/example3/colorbox.css';
|
$filepath = str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath());
|
||||||
$args['css'][] = $this->getFilesPath() . '/vendor/leaflet/dist/leaflet.css';
|
$args['css'][] = $filepath . '/vendor/jquery-colorbox/example3/colorbox.css';
|
||||||
$args['css'][] = $this->getFilesPath() . '/css/styles.css';
|
$args['css'][] = $filepath . '/vendor/leaflet/dist/leaflet.css';
|
||||||
|
$args['css'][] = $filepath . '/css/styles.css';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +130,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
*/
|
*/
|
||||||
public static function getVersion()
|
public static function getVersion()
|
||||||
{
|
{
|
||||||
return '0.1.0';
|
return '0.2.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of Mibew Open Street Map Plugin.
|
* This file is a part of Mibew Open Street Map Plugin.
|
||||||
*
|
*
|
||||||
* Copyright 2014-2018 the original author or authors.
|
* Copyright 2014-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,7 +18,7 @@ gulp.task('bower', function(callback) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('prepare-release', ['bower'], function() {
|
gulp.task('prepare-release', gulp.series('bower', function() {
|
||||||
var version = require('./package.json').version;
|
var version = require('./package.json').version;
|
||||||
|
|
||||||
return eventStream.merge(
|
return eventStream.merge(
|
||||||
@ -30,12 +30,10 @@ gulp.task('prepare-release', ['bower'], function() {
|
|||||||
)
|
)
|
||||||
.pipe(chmod(0644))
|
.pipe(chmod(0644))
|
||||||
.pipe(gulp.dest('release'));
|
.pipe(gulp.dest('release'));
|
||||||
});
|
}));
|
||||||
|
|
||||||
// Builds and packs plugins sources
|
// Builds and packs plugins sources
|
||||||
gulp.task('default', ['prepare-release'], function() {
|
gulp.task('default', gulp.series('prepare-release'));
|
||||||
// The "default" task is just an alias for "prepare-release" task.
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns files stream with the plugin sources.
|
* Returns files stream with the plugin sources.
|
||||||
|
48
js/common.js
Normal file
48
js/common.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*!
|
||||||
|
* This file is a part of Mibew Open Street Map Plugin.
|
||||||
|
*
|
||||||
|
* Copyright 2014-2021 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display popup with a map and a marker on it.
|
||||||
|
*
|
||||||
|
* @param {String} country Name of the country. It will be used in the
|
||||||
|
* marker's title.
|
||||||
|
* @param {String} city Name of the city. It will be used in the marker's
|
||||||
|
* title.
|
||||||
|
* @param {Number} latitude Latitude of the point the marker should be
|
||||||
|
* placed.
|
||||||
|
* @param {Number} longitude Longitude of the point the marker should be
|
||||||
|
* placed.
|
||||||
|
*/
|
||||||
|
var showMap = function (country, city, latitude, longitude) {
|
||||||
|
var $canvas = $('<div id="map-canvas"></div>');
|
||||||
|
|
||||||
|
jQuery.colorbox({
|
||||||
|
html: $canvas,
|
||||||
|
onComplete: function() {
|
||||||
|
var map = L.map('map-canvas', {
|
||||||
|
center: [latitude, longitude],
|
||||||
|
zoom: 9
|
||||||
|
});
|
||||||
|
var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||||
|
var osmAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
|
||||||
|
var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 19, attribution: osmAttrib});
|
||||||
|
map.addLayer(osm);
|
||||||
|
L.marker([latitude, longitude]).addTo(map).bindPopup('<strong>' + city + ', ' + country + '</strong>').openPopup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Open Street Map Plugin.
|
* This file is a part of Mibew Open Street Map Plugin.
|
||||||
*
|
*
|
||||||
* Copyright 2014-2018 the original author or authors.
|
* Copyright 2014-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -16,38 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (Mibew, $, L) {
|
(function (Mibew, $) {
|
||||||
/**
|
|
||||||
* Display popup with a map and a marker on it.
|
|
||||||
*
|
|
||||||
* @param {String} country Name of the country. It will be used in the
|
|
||||||
* marker's title.
|
|
||||||
* @param {String} city Name of the city. It will be used in the marker's
|
|
||||||
* title.
|
|
||||||
* @param {Number} latitude Latitude of the point the marker should be
|
|
||||||
* placed.
|
|
||||||
* @param {Number} longitude Longitude of the point the marker should be
|
|
||||||
* placed.
|
|
||||||
*/
|
|
||||||
var showMap = function (country, city, latitude, longitude) {
|
|
||||||
var $canvas = $('<div id="map-canvas"></div>');
|
|
||||||
|
|
||||||
$.colorbox({
|
|
||||||
html: $canvas,
|
|
||||||
onComplete: function() {
|
|
||||||
var map = L.map('map-canvas', {
|
|
||||||
center: [latitude, longitude],
|
|
||||||
zoom: 9
|
|
||||||
});
|
|
||||||
var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
||||||
var osmAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
|
|
||||||
var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 19, attribution: osmAttrib});
|
|
||||||
map.addLayer(osm);
|
|
||||||
L.marker([latitude, longitude]).addTo(map).bindPopup('<strong>' + city + ', ' + country + '</strong>').openPopup();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes all necessary actions to get Geo info and show it on the map.
|
* Makes all necessary actions to get Geo info and show it on the map.
|
||||||
*
|
*
|
||||||
@ -124,4 +93,4 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
})(Mibew, jQuery, L);
|
})(Mibew, jQuery);
|
12
package.json
12
package.json
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bower": "~1.3.12",
|
"bower": "~1.8.8",
|
||||||
"gulp": "~3.8.10",
|
"gulp": "~4.0.0",
|
||||||
"event-stream": "~3.1.7",
|
"event-stream": "~3.1.7",
|
||||||
"gulp-zip": "~2.0.2",
|
"gulp-zip": "~2.0.2",
|
||||||
"gulp-tar": "~1.3.1",
|
"gulp-tar": "~3.1.0",
|
||||||
"gulp-gzip": "~0.0.8",
|
"gulp-gzip": "~0.0.8",
|
||||||
"gulp-chmod": "~1.2.0",
|
"gulp-chmod": "~3.0.0",
|
||||||
"gulp-rename": "~1.2.0"
|
"gulp-rename": "~1.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user