JGirault has uploaded a new change for review.
https://gerrit.wikimedia.org/r/298406
Change subject: Apply Wikivoyage attributions style + scale control to all maps
......................................................................
Apply Wikivoyage attributions style + scale control to all maps
Bug: T140043
Change-Id: I0e135d64f11ceab8165b9dad821da37712422130
---
M extension.json
R modules/live/ControlScale.js
M modules/live/MWMap.js
M modules/live/index.js
M modules/wikivoyage/WVMap.js
R styles/control-attribution.less
R styles/control-scale.less
7 files changed, 15 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer
refs/changes/06/298406/1
diff --git a/extension.json b/extension.json
index 9a0d3cd..a1e1bf3 100644
--- a/extension.json
+++ b/extension.json
@@ -40,7 +40,9 @@
},
"ext.kartographer.style": {
"styles": [
- "styles/kartographer.less"
+ "styles/kartographer.less",
+ "styles/control-attribution.less",
+ "styles/control-scale.less"
],
"targets": [
"mobile",
@@ -195,6 +197,7 @@
],
"scripts": [
"lib/leaflet.sleep.js",
+ "modules/live/ControlScale.js",
"modules/live/FullScreenControl.js",
"modules/live/dataLayerOpts.js",
"modules/live/MWMap.js",
@@ -322,17 +325,14 @@
"modules/wikivoyage/NearbyArticles.js",
"modules/wikivoyage/ControlLayers.js",
"modules/wikivoyage/ControlNearby.js",
- "modules/wikivoyage/ControlScale.js",
"modules/wikivoyage/WVMapLayers.js",
"modules/wikivoyage/WVMap.js",
"modules/wikivoyage/index.js"
],
"styles": [
"modules/wikivoyage/styles/wv-leaflet.less",
-
"modules/wikivoyage/styles/control-attribution.less",
"modules/wikivoyage/styles/control-layers.less",
- "modules/wikivoyage/styles/control-nearby.less",
- "modules/wikivoyage/styles/control-scale.less"
+ "modules/wikivoyage/styles/control-nearby.less"
],
"messages": [
"kartographer-wv-group",
diff --git a/modules/wikivoyage/ControlScale.js b/modules/live/ControlScale.js
similarity index 96%
rename from modules/wikivoyage/ControlScale.js
rename to modules/live/ControlScale.js
index b4a23ee..42ce767 100644
--- a/modules/wikivoyage/ControlScale.js
+++ b/modules/live/ControlScale.js
@@ -4,7 +4,7 @@
* Control to display the scale.
*
* @alias ControlScale
- * @class Kartographer.Wikivoyage.ControlScale
+ * @class Kartographer.Live.ControlScale
* @extends L.Control.Scale
* @private
*/
diff --git a/modules/live/MWMap.js b/modules/live/MWMap.js
index 9b9bfd9..a0cba83 100644
--- a/modules/live/MWMap.js
+++ b/modules/live/MWMap.js
@@ -1,5 +1,5 @@
/* globals module */
-module.MWMap = ( function ( FullScreenControl, dataLayerOpts ) {
+module.MWMap = ( function ( FullScreenControl, dataLayerOpts, ControlScale ) {
var scale, urlFormat,
mapServer = mw.config.get( 'wgKartographerMapServer' ),
@@ -194,6 +194,8 @@
} ) );
}
+ this.map.addControl( new ControlScale( { position:
'bottomright' } ) );
+
return $.Deferred().resolveWith( this, [ this.map, this._data ]
).promise();
};
@@ -385,5 +387,6 @@
};
} )(
module.FullScreenControl,
- module.dataLayerOpts
+ module.dataLayerOpts,
+ module.ControlScale
);
diff --git a/modules/live/index.js b/modules/live/index.js
index af50239..9eb66c1 100644
--- a/modules/live/index.js
+++ b/modules/live/index.js
@@ -2,5 +2,6 @@
module.exports = {
dataLayerOpts: module.dataLayerOpts,
FullScreenControl: module.FullScreenControl,
+ ControlScale: module.ControlScale,
MWMap: module.MWMap
};
diff --git a/modules/wikivoyage/WVMap.js b/modules/wikivoyage/WVMap.js
index cca2f59..428a33b 100644
--- a/modules/wikivoyage/WVMap.js
+++ b/modules/wikivoyage/WVMap.js
@@ -6,7 +6,7 @@
* @class Kartographer.Wikivoyage.WVMap
* @private
*/
-module.WVMap = ( function ( $, mw, wikivoyage, WVMapLayers, ControlNearby,
ControlScale, undefined ) {
+module.WVMap = ( function ( $, mw, wikivoyage, WVMapLayers, ControlNearby,
undefined ) {
/*jscs:disable disallowDanglingUnderscores, requireVarDeclFirst */
var Map = function ( map ) {
@@ -48,12 +48,9 @@
/**
* Adds the scale control to the map.
- *
- * @return {ControlScale}
*/
Map.prototype.scale = function () {
- this._controlScale = this._controlScale || new ControlScale( {
position: 'bottomright' } ).addTo( this.map );
- return this._controlScale;
+ mw.log( 'Map scale is now added by default on all maps. Please
remove the call to `.scale()`.' );
};
return Map;
@@ -63,6 +60,5 @@
mediaWiki,
module.wikivoyage,
module.WVMapLayers,
- module.ControlNearby,
- module.ControlScale
+ module.ControlNearby
);
diff --git a/modules/wikivoyage/styles/control-attribution.less
b/styles/control-attribution.less
similarity index 100%
rename from modules/wikivoyage/styles/control-attribution.less
rename to styles/control-attribution.less
diff --git a/modules/wikivoyage/styles/control-scale.less
b/styles/control-scale.less
similarity index 100%
rename from modules/wikivoyage/styles/control-scale.less
rename to styles/control-scale.less
--
To view, visit https://gerrit.wikimedia.org/r/298406
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e135d64f11ceab8165b9dad821da37712422130
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: JGirault <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits