Rename in JS/CSS: storage_ => umap_ storage- => umap-

This commit is contained in:
Yohan Boniface 2018-06-02 15:43:22 +02:00
parent 1eadf4b7ed
commit 8655061817
28 changed files with 566 additions and 563 deletions

View file

@ -1,5 +1,5 @@
test:
py.test -xv
py.test -xv umap/tests/
develop:
python setup.py develop
compilemessages:

View file

@ -224,10 +224,10 @@ input.switch:checked ~ label:after {
.button-bar {
margin-top: 5px;
}
.storage-multiplechoice input[type='radio'] {
.umap-multiplechoice input[type='radio'] {
display: none;
}
.storage-multiplechoice label {
.umap-multiplechoice label {
border: 1px solid #374E75;
cursor: pointer;
background-color: #c9c9c7;
@ -237,14 +237,14 @@ input.switch:checked ~ label:after {
width: calc(100% / 3);
display: inline-block;
}
.storage-multiplechoice.by4 label {
.umap-multiplechoice.by4 label {
width: calc(100% / 4);
}
.dark .storage-multiplechoice label {
.dark .umap-multiplechoice label {
border: 1px solid black;
background-color: #2c3233;
}
.storage-multiplechoice input[type='radio']:checked + label {
.umap-multiplechoice input[type='radio']:checked + label {
background-color: #215d9c;
box-shadow: inset 0 0 6px 0px #2c3233;
color: #ededed;
@ -317,7 +317,7 @@ i.info {
.leaflet-ui-container {
overflow-x: hidden;
}
#storage-ui-container {
#umap-ui-container {
width: 400px;
position: fixed;
top: 0;
@ -331,57 +331,57 @@ i.info {
opacity: 0.98;
cursor: initial;
}
#storage-ui-container.dark {
#umap-ui-container.dark {
border-left: 1px solid #222;
background-color: #323737;
color: #efefef;
}
#storage-ui-container.fullwidth {
#umap-ui-container.fullwidth {
width: 100%;
z-index: 10000;
padding-left: 0;
padding-right: 0;
transition: all .7s;
}
.storage-edit-enabled #storage-ui-container {
.umap-edit-enabled #umap-ui-container {
top: 46px;
}
.storage-caption-bar-enabled #storage-ui-container {
.umap-caption-bar-enabled #umap-ui-container {
bottom: 46px;
}
.storage-ui #storage-ui-container {
.umap-ui #umap-ui-container {
right: 0;
}
.leaflet-top,
.leaflet-right {
transition: all .7s;
}
.storage-ui .leaflet-right {
.umap-ui .leaflet-right {
right: 400px;
}
#storage-ui-container,
#storage-alert-container,
#storage-tooltip-container {
#umap-ui-container,
#umap-alert-container,
#umap-tooltip-container {
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing: border-box;
}
#storage-ui-container .storage-popup-content img {
#umap-ui-container .umap-popup-content img {
/* See https://github.com/Leaflet/Leaflet/commit/61d746818b99d362108545c151a27f09d60960ee#commitcomment-6061847 */
max-width: 99% !important;
}
#storage-ui-container .storage-popup-content {
#umap-ui-container .umap-popup-content {
max-height: inherit;
}
#storage-ui-container .body {
#umap-ui-container .body {
clear: both;
height: calc(100% - 46px); /* Minus size of toolbox */
}
#storage-ui-container .toolbox {
#umap-ui-container .toolbox {
padding: 5px 0;
overflow: hidden;
}
#storage-ui-container .toolbox li {
#umap-ui-container .toolbox li {
color: #2e3436;
line-height: 32px;
cursor: pointer;
@ -391,19 +391,19 @@ i.info {
border: 1px solid #b6b6b3;
border-radius: 2px;
}
#storage-ui-container.dark .toolbox li {
#umap-ui-container.dark .toolbox li {
color: #d3dfeb;
border: 1px solid #202425;
}
#storage-ui-container .toolbox li:hover {
#umap-ui-container .toolbox li:hover {
color: #2e3436;
background-color: #d4d4d2;
}
#storage-ui-container.dark .toolbox li:hover {
#umap-ui-container.dark .toolbox li:hover {
color: #eeeeec;
background-color: #353c3e;
}
#storage-ui-container .toolbox li + li {
#umap-ui-container .toolbox li + li {
margin-right: 5px;
margin-left: 5px;
}
@ -417,7 +417,7 @@ i.info {
/* *********** */
/* Alerts */
/* *********** */
#storage-alert-container {
#umap-alert-container {
min-height: 46px;
line-height: 46px;
padding-left: 10px;
@ -435,35 +435,35 @@ i.info {
z-index: 1002;
border-radius: 2px;
}
#storage-alert-container.error {
#umap-alert-container.error {
background-color: #c60f13;
}
.storage-alert #storage-alert-container {
.umap-alert #umap-alert-container {
visibility: visible;
top: 23px;
}
.storage-alert .storage-action {
.umap-alert .umap-action {
margin-left: 10px;
background-color: #fff;
color: #999;
padding: 5px;
border-radius: 4px;
}
.storage-alert .storage-action:hover {
.umap-alert .umap-action:hover {
color: #000;
}
.storage-alert .error .storage-action {
.umap-alert .error .umap-action {
background-color: #666;
color: #eee;
}
.storage-alert .error .storage-action:hover {
.umap-alert .error .umap-action:hover {
color: #fff;
}
/* *********** */
/* Tooltip */
/* *********** */
#storage-tooltip-container {
#umap-tooltip-container {
line-height: 20px;
padding: 5px 10px;
width: auto;
@ -478,10 +478,10 @@ i.info {
font-weight: normal;
max-width: 300px;
}
.storage-tooltip #storage-tooltip-container {
.umap-tooltip #umap-tooltip-container {
display: block;
}
#storage-tooltip-container.tooltip-top:after {
#umap-tooltip-container.tooltip-top:after {
top: 100%;
left: calc(50% - 11px);
border: solid transparent;
@ -494,7 +494,7 @@ i.info {
border-width: 11px;
margin-left: calc(-50% + 21px);
}
#storage-tooltip-container.tooltip.tooltip-left:after {
#umap-tooltip-container.tooltip.tooltip-left:after {
left: 100%;
top: 50%;
border: solid transparent;
@ -514,7 +514,7 @@ i.info {
/* *********** */
/* Close link */
/* *********** */
.storage-close-icon {
.umap-close-icon {
background-repeat: no-repeat;
background-image: url('./img/16.png');
background-position: -52px -9px;
@ -522,25 +522,25 @@ i.info {
padding: 0 10px;
vertical-align: middle;
}
.dark .storage-close-icon {
.dark .umap-close-icon {
background-image: url('./img/16-white.png');
}
.dark .storage-close-link {
.dark .umap-close-link {
border: 1px solid #202425;
color: #eeeeec;
padding: 0 7px;
line-height: 32px;
background-color: #323737;
}
.dark .storage-close-link:hover {
.dark .umap-close-link:hover {
background-color: #2e3436;
}
.storage-alert .storage-close-link {
.umap-alert .umap-close-link {
color: #fff;
float: right;
padding-right: 10px;
}
.storage-alert .storage-close-icon {
.umap-alert .umap-close-icon {
background-position: -128px -90px;
}
@ -549,7 +549,7 @@ i.info {
/* Mobile */
/* *********** */
@media all and (orientation:portrait) {
.storage-ui #storage-ui-container {
.umap-ui #umap-ui-container {
height: 50%;
max-height: 400px;
width: 100%;
@ -558,10 +558,10 @@ i.info {
right: 0;
left: 0;
}
.storage-ui .leaflet-right {
.umap-ui .leaflet-right {
right: 0;
}
#storage-alert-container {
#umap-alert-container {
width: 100%;
left: 0;
right: 0;

View file

@ -97,7 +97,7 @@ L.U.DrawMarkerAction = L.U.BaseAction.extend({
options: {
helpMenu: true,
className: 'storage-draw-marker dark',
className: 'umap-draw-marker dark',
tooltip: L._('Draw a marker')
},
@ -111,7 +111,7 @@ L.U.DrawPolylineAction = L.U.BaseAction.extend({
options: {
helpMenu: true,
className: 'storage-draw-polyline dark',
className: 'umap-draw-polyline dark',
tooltip: L._('Draw a polyline')
},
@ -125,7 +125,7 @@ L.U.DrawPolygonAction = L.U.BaseAction.extend({
options: {
helpMenu: true,
className: 'storage-draw-polygon dark',
className: 'umap-draw-polygon dark',
tooltip: L._('Draw a polygon')
},
@ -138,7 +138,7 @@ L.U.DrawPolygonAction = L.U.BaseAction.extend({
L.U.AddPolylineShapeAction = L.U.BaseAction.extend({
options: {
className: 'storage-draw-polyline-multi dark',
className: 'umap-draw-polyline-multi dark',
tooltip: L._('Add a line to the current multi')
},
@ -151,7 +151,7 @@ L.U.AddPolylineShapeAction = L.U.BaseAction.extend({
L.U.AddPolygonShapeAction = L.U.AddPolylineShapeAction.extend({
options: {
className: 'storage-draw-polygon-multi dark',
className: 'umap-draw-polygon-multi dark',
tooltip: L._('Add a polygon to the current multi')
}
@ -184,7 +184,7 @@ L.U.CreateHoleAction = L.U.BaseFeatureAction.extend({
options: {
toolbarIcon: {
className: 'storage-new-hole',
className: 'umap-new-hole',
tooltip: L._('Start a hole here')
}
},
@ -199,7 +199,7 @@ L.U.ToggleEditAction = L.U.BaseFeatureAction.extend({
options: {
toolbarIcon: {
className: 'storage-toggle-edit',
className: 'umap-toggle-edit',
tooltip: L._('Toggle edit mode (shift-click)')
}
},
@ -215,13 +215,13 @@ L.U.DeleteFeatureAction = L.U.BaseFeatureAction.extend({
options: {
toolbarIcon: {
className: 'storage-delete-all',
className: 'umap-delete-all',
tooltip: L._('Delete this feature')
}
},
postInit: function () {
if (!this.feature.isMulti()) this.options.toolbarIcon.className = 'storage-delete-one-of-one';
if (!this.feature.isMulti()) this.options.toolbarIcon.className = 'umap-delete-one-of-one';
},
onClick: function (e) {
@ -234,7 +234,7 @@ L.U.DeleteShapeAction = L.U.BaseFeatureAction.extend({
options: {
toolbarIcon: {
className: 'storage-delete-one-of-multi',
className: 'umap-delete-one-of-multi',
tooltip: L._('Delete this shape')
}
},
@ -249,7 +249,7 @@ L.U.ExtractShapeFromMultiAction = L.U.BaseFeatureAction.extend({
options: {
toolbarIcon: {
className: 'storage-extract-shape-from-multi',
className: 'umap-extract-shape-from-multi',
tooltip: L._('Extract shape to separate feature')
}
},
@ -273,7 +273,7 @@ L.U.DeleteVertexAction = L.U.BaseVertexAction.extend({
options: {
toolbarIcon: {
className: 'storage-delete-vertex',
className: 'umap-delete-vertex',
tooltip: L._('Delete this vertex (Alt-click)')
}
},
@ -288,7 +288,7 @@ L.U.SplitLineAction = L.U.BaseVertexAction.extend({
options: {
toolbarIcon: {
className: 'storage-split-line',
className: 'umap-split-line',
tooltip: L._('Split line')
}
},
@ -303,7 +303,7 @@ L.U.ContinueLineAction = L.U.BaseVertexAction.extend({
options: {
toolbarIcon: {
className: 'storage-continue-line',
className: 'umap-continue-line',
tooltip: L._('Continue line')
}
},
@ -360,7 +360,7 @@ L.U.EditControl = L.Control.extend({
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-control-edit-enable storage-control'),
var container = L.DomUtil.create('div', 'leaflet-control-edit-enable umap-control'),
edit = L.DomUtil.create('a', '', container);
edit.href = '#';
edit.title = L._('Enable editing') + ' (Ctrl-E)';
@ -381,7 +381,7 @@ L.Control.Embed = L.Control.extend({
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-control-embed storage-control');
var container = L.DomUtil.create('div', 'leaflet-control-embed umap-control');
var link = L.DomUtil.create('a', '', container);
link.href = '#';
@ -404,8 +404,8 @@ L.U.MoreControls = L.Control.extend({
onAdd: function () {
var container = L.DomUtil.create('div', ''),
more = L.DomUtil.create('a', 'storage-control-more storage-control-text', container),
less = L.DomUtil.create('a', 'storage-control-less storage-control-text', container);
more = L.DomUtil.create('a', 'umap-control-more umap-control-text', container),
less = L.DomUtil.create('a', 'umap-control-less umap-control-text', container);
more.href = '#';
more.title = L._('More controls');
@ -426,7 +426,7 @@ L.U.MoreControls = L.Control.extend({
toggle: function () {
var pos = this.getPosition(),
corner = this._map._controlCorners[pos],
className = 'storage-more-controls';
className = 'umap-more-controls';
if (L.DomUtil.hasClass(corner, className)) L.DomUtil.removeClass(corner, className);
else L.DomUtil.addClass(corner, className);
}
@ -452,15 +452,15 @@ L.U.DataLayersControl = L.Control.extend({
},
_initLayout: function (map) {
var container = this._container = L.DomUtil.create('div', 'leaflet-control-browse storage-control'),
actions = L.DomUtil.create('div', 'storage-browse-actions', container);
this._datalayers_container = L.DomUtil.create('ul', 'storage-browse-datalayers', actions);
var container = this._container = L.DomUtil.create('div', 'leaflet-control-browse umap-control'),
actions = L.DomUtil.create('div', 'umap-browse-actions', container);
this._datalayers_container = L.DomUtil.create('ul', 'umap-browse-datalayers', actions);
var link = L.DomUtil.create('a', 'storage-browse-link', actions);
var link = L.DomUtil.create('a', 'umap-browse-link', actions);
link.href = '#';
link.title = link.innerHTML = L._('Browse data');
var toggle = L.DomUtil.create('a', 'storage-browse-toggle', container);
var toggle = L.DomUtil.create('a', 'umap-browse-toggle', container);
toggle.href = '#';
L.DomEvent
@ -539,7 +539,7 @@ L.U.DataLayersControl = L.Control.extend({
openPanel: function () {
if (!this.map.editEnabled) return;
var container = L.DomUtil.create('ul', 'storage-browse-datalayers');
var container = L.DomUtil.create('ul', 'umap-browse-datalayers');
this.map.eachDataLayerReverse(function (datalayer) {
this.addDataLayer(container, datalayer, true);
}, this);
@ -642,11 +642,11 @@ L.U.DataLayer.addInitHook(function () {
L.U.Map.include({
_openBrowser: function () {
var browserContainer = L.DomUtil.create('div', 'storage-browse-data'),
title = L.DomUtil.add('h3', 'storage-browse-title', browserContainer, this.options.name),
var browserContainer = L.DomUtil.create('div', 'umap-browse-data'),
title = L.DomUtil.add('h3', 'umap-browse-title', browserContainer, this.options.name),
filter = L.DomUtil.create('input', '', browserContainer),
filterValue = '',
featuresContainer = L.DomUtil.create('div', 'storage-browse-features', browserContainer),
featuresContainer = L.DomUtil.create('div', 'umap-browse-features', browserContainer),
filterKeys = (this.options.filterKey || this.options.sortKey || 'name').split(',');
filter.type = 'text';
filter.placeholder = L._('Filter…');
@ -682,7 +682,7 @@ L.U.Map.include({
var append = function (datalayer) {
var container = L.DomUtil.create('div', datalayer.getHidableClass(), featuresContainer),
headline = L.DomUtil.create('h5', '', container);
container.id = 'browse_data_datalayer_' + datalayer.storage_id;
container.id = 'browse_data_datalayer_' + datalayer.umap_id;
datalayer.renderToolbox(headline);
L.DomUtil.add('span', '', headline, datalayer.options.name);
var ul = L.DomUtil.create('ul', '', container);
@ -717,7 +717,7 @@ L.U.Map.include({
L.bind(appendAll, this)();
L.DomEvent.on(filter, 'input', appendAll, this);
var link = L.DomUtil.create('li', '');
L.DomUtil.create('i', 'storage-icon-16 storage-caption', link);
L.DomUtil.create('i', 'umap-icon-16 umap-caption', link);
var label = L.DomUtil.create('span', '', link);
label.innerHTML = label.title = L._('About');
L.DomEvent.on(link, 'click', this.displayCaption, this);
@ -734,7 +734,7 @@ L.U.TileLayerControl = L.Control.extend({
},
onAdd: function () {
var container = L.DomUtil.create('div', 'leaflet-control-tilelayers storage-control');
var container = L.DomUtil.create('div', 'leaflet-control-tilelayers umap-control');
var link = L.DomUtil.create('a', '', container);
link.href = '#';
@ -749,7 +749,7 @@ L.U.TileLayerControl = L.Control.extend({
},
openSwitcher: function (options) {
this._tilelayers_container = L.DomUtil.create('ul', 'storage-tilelayer-switcher-container');
this._tilelayers_container = L.DomUtil.create('ul', 'umap-tilelayer-switcher-container');
this.buildList(options);
},
@ -810,7 +810,7 @@ L.U.LocateControl = L.Control.extend({
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-control-locate storage-control'),
var container = L.DomUtil.create('div', 'leaflet-control-locate umap-control'),
link = L.DomUtil.create('a', '', container);
link.href = '#';
link.title = L._('Center map on your location');
@ -880,7 +880,7 @@ L.U.SearchControl = L.Control.extend({
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-control-search storage-control'),
var container = L.DomUtil.create('div', 'leaflet-control-search umap-control'),
self = this;
L.DomEvent.disableClickPropagation(container);
@ -949,18 +949,18 @@ L.Control.MiniMap.include({
L.Control.Loading.include({
onAdd: function (map) {
this._container = L.DomUtil.create('div', 'storage-loader', map._controlContainer);
this._container = L.DomUtil.create('div', 'umap-loader', map._controlContainer);
map.on('baselayerchange', this._layerAdd, this);
this._addMapListeners(map);
this._map = map;
},
_showIndicator: function () {
L.DomUtil.addClass(this._map._container, 'storage-loading');
L.DomUtil.addClass(this._map._container, 'umap-loading');
},
_hideIndicator: function() {
L.DomUtil.removeClass(this._map._container, 'storage-loading');
L.DomUtil.removeClass(this._map._container, 'umap-loading');
}
});
@ -1029,8 +1029,8 @@ L.U.IframeExporter = L.Class.extend({
var datalayers = [];
if (this.options.keepCurrentDatalayers) {
this.map.eachDataLayer(function (datalayer) {
if (datalayer.isVisible() && datalayer.storage_id) {
datalayers.push(datalayer.storage_id);
if (datalayer.isVisible() && datalayer.umap_id) {
datalayers.push(datalayer.umap_id);
}
});
this.queryString.datalayers = datalayers.join(',');

View file

@ -295,13 +295,13 @@ L.U.Help = L.Class.extend({
initialize: function (map) {
this.map = map;
this.box = L.DomUtil.create('div', 'storage-help-box with-transition dark', document.body);
var closeLink = L.DomUtil.create('a', 'storage-close-link', this.box);
this.box = L.DomUtil.create('div', 'umap-help-box with-transition dark', document.body);
var closeLink = L.DomUtil.create('a', 'umap-close-link', this.box);
closeLink.href = '#';
L.DomUtil.add('i', 'storage-close-icon', closeLink);
L.DomUtil.add('i', 'umap-close-icon', closeLink);
var label = L.DomUtil.create('span', '', closeLink);
label.title = label.innerHTML = L._('Close');
this.content = L.DomUtil.create('div', 'storage-help-content', this.box);
this.content = L.DomUtil.create('div', 'umap-help-content', this.box);
L.DomEvent.on(closeLink, 'click', this.hide, this);
},
@ -317,17 +317,17 @@ L.U.Help = L.Class.extend({
this.content.innerHTML = '';
for (var i = 0, name; i < arguments.length; i++) {
name = arguments[i];
L.DomUtil.add('div', 'storage-help-entry', this.content, this.resolve(name));
L.DomUtil.add('div', 'umap-help-entry', this.content, this.resolve(name));
}
L.DomUtil.addClass(document.body, 'storage-help-on');
L.DomUtil.addClass(document.body, 'umap-help-on');
},
hide: function () {
L.DomUtil.removeClass(document.body, 'storage-help-on');
L.DomUtil.removeClass(document.body, 'umap-help-on');
},
visible: function () {
return L.DomUtil.hasClass(document.body, 'storage-help-on')
return L.DomUtil.hasClass(document.body, 'umap-help-on')
},
resolve: function (name) {
@ -335,7 +335,7 @@ L.U.Help = L.Class.extend({
},
button: function (container, entries) {
var helpButton = L.DomUtil.create('a', 'storage-help-button', container);
var helpButton = L.DomUtil.create('a', 'umap-help-button', container);
helpButton.href = '#';
if (entries) {
L.DomEvent
@ -352,7 +352,7 @@ L.U.Help = L.Class.extend({
var container = L.DomUtil.create('div', ''),
self = this,
title = L.DomUtil.create('h3', '', container),
actionsContainer = L.DomUtil.create('ul', 'storage-edit-actions', container);
actionsContainer = L.DomUtil.create('ul', 'umap-edit-actions', container);
var addAction = function (action) {
var actionContainer = L.DomUtil.add('li', '', actionsContainer);
L.DomUtil.add('i', action.options.className, actionContainer),

View file

@ -9,7 +9,7 @@ L.U.FeatureMixin = {
}
// DataLayer the marker belongs to
this.datalayer = options.datalayer || null;
this.properties = {_storage_options: {}};
this.properties = {_umap_options: {}};
if (options.geojson) {
this.populate(options.geojson);
}
@ -47,8 +47,8 @@ L.U.FeatureMixin = {
view: function(e) {
if (this.map.editEnabled) return;
var outlink = this.properties._storage_options.outlink,
target = this.properties._storage_options.outlinkTarget
var outlink = this.properties._umap_options.outlink,
target = this.properties._umap_options.outlinkTarget
if (outlink) {
switch (target) {
case 'self':
@ -58,7 +58,7 @@ L.U.FeatureMixin = {
window.top.location = outlink;
break;
default:
var win = window.open(this.properties._storage_options.outlink);
var win = window.open(this.properties._umap_options.outlink);
}
return;
}
@ -92,7 +92,7 @@ L.U.FeatureMixin = {
properties.unshift('properties.name');
builder = new L.U.FormBuilder(this, properties,
{
id: 'storage-feature-properties',
id: 'umap-feature-properties',
callback: this.resetTooltip
}
);
@ -106,7 +106,7 @@ L.U.FeatureMixin = {
},
getAdvancedEditActions: function (container) {
var deleteLink = L.DomUtil.create('a', 'button storage-delete', container);
var deleteLink = L.DomUtil.create('a', 'button umap-delete', container);
deleteLink.href = '#';
deleteLink.innerHTML = L._('Delete');
L.DomEvent.on(deleteLink, 'click', function (e) {
@ -118,7 +118,7 @@ L.U.FeatureMixin = {
appendEditFieldsets: function (container) {
var optionsFields = this.getShapeOptions();
var builder = new L.U.FormBuilder(this, optionsFields, {
id: 'storage-feature-shape-properties',
id: 'umap-feature-shape-properties',
callback: this._redraw
});
var shapeProperties = L.DomUtil.createFieldset(container, L._('Shape properties'));
@ -126,7 +126,7 @@ L.U.FeatureMixin = {
var advancedOptions = this.getAdvancedOptions();
var builder = new L.U.FormBuilder(this, advancedOptions, {
id: 'storage-feature-advanced-properties',
id: 'umap-feature-advanced-properties',
callback: this._redraw
});
var advancedProperties = L.DomUtil.createFieldset(container, L._('Advanced properties'));
@ -143,11 +143,11 @@ L.U.FeatureMixin = {
getInteractionOptions: function () {
return [
'properties._storage_options.popupTemplate',
'properties._storage_options.showLabel',
'properties._storage_options.labelDirection',
'properties._storage_options.labelHover',
'properties._storage_options.labelInteractive'
'properties._umap_options.popupTemplate',
'properties._umap_options.showLabel',
'properties._umap_options.labelDirection',
'properties._umap_options.labelHover',
'properties._umap_options.labelInteractive'
];
},
@ -204,11 +204,11 @@ L.U.FeatureMixin = {
populate: function (feature) {
this.properties = L.extend({}, feature.properties);
this.properties._storage_options = L.extend({}, this.properties._storage_options);
this.properties._umap_options = L.extend({}, this.properties._storage_options, this.properties._umap_options);
// Retrocompat
if (this.properties._storage_options.clickable === false) {
this.properties._storage_options.interactive = false;
delete this.properties._storage_options.clickable;
if (this.properties._umap_options.clickable === false) {
this.properties._umap_options.interactive = false;
delete this.properties._umap_options.clickable;
}
},
@ -227,8 +227,8 @@ L.U.FeatureMixin = {
if (typeof this.staticOptions[option] !== 'undefined') {
value = this.staticOptions[option];
}
else if (L.Util.usableOption(this.properties._storage_options, option)) {
value = this.properties._storage_options[option];
else if (L.Util.usableOption(this.properties._umap_options, option)) {
value = this.properties._umap_options[option];
}
else if (this.datalayer) {
value = this.datalayer.getOption(option);
@ -271,9 +271,9 @@ L.U.FeatureMixin = {
cloneProperties: function () {
var properties = L.extend({}, this.properties);
properties._storage_options = L.extend({}, properties._storage_options);
if (Object.keys && Object.keys(properties._storage_options).length === 0) {
delete properties._storage_options; // It can make a difference on big data sets
properties._umap_options = L.extend({}, properties._umap_options);
if (Object.keys && Object.keys(properties._umap_options).length === 0) {
delete properties._umap_options; // It can make a difference on big data sets
}
return properties;
},
@ -361,7 +361,7 @@ L.U.FeatureMixin = {
text: L._('Edit this feature'),
callback: this.edit,
context: this,
iconCls: 'storage-edit'
iconCls: 'umap-edit'
}
);
}
@ -370,13 +370,13 @@ L.U.FeatureMixin = {
text: L._('Edit feature\'s layer'),
callback: this.datalayer.edit,
context: this.datalayer,
iconCls: 'storage-edit'
iconCls: 'umap-edit'
},
{
text: L._('Delete this feature'),
callback: this.confirmDelete,
context: this,
iconCls: 'storage-delete'
iconCls: 'umap-delete'
}
);
return items;
@ -515,15 +515,15 @@ L.U.Marker = L.Marker.extend({
getShapeOptions: function () {
return [
'properties._storage_options.color',
'properties._storage_options.iconClass',
'properties._storage_options.iconUrl'
'properties._umap_options.color',
'properties._umap_options.iconClass',
'properties._umap_options.iconUrl'
];
},
getAdvancedOptions: function () {
return [
'properties._storage_options.zoomTo'
'properties._umap_options.zoomTo'
];
},
@ -609,17 +609,17 @@ L.U.PathMixin = {
getShapeOptions: function () {
return [
'properties._storage_options.color',
'properties._storage_options.opacity',
'properties._storage_options.weight'
'properties._umap_options.color',
'properties._umap_options.opacity',
'properties._umap_options.weight'
];
},
getAdvancedOptions: function () {
return [
'properties._storage_options.smoothFactor',
'properties._storage_options.dashArray',
'properties._storage_options.zoomTo'
'properties._umap_options.smoothFactor',
'properties._umap_options.dashArray',
'properties._umap_options.zoomTo'
];
},
@ -869,7 +869,7 @@ L.U.Polyline = L.Polyline.extend({
getAdvancedEditActions: function (container) {
L.U.FeatureMixin.getAdvancedEditActions.call(this, container);
var toPolygon = L.DomUtil.create('a', 'button storage-to-polygon', container);
var toPolygon = L.DomUtil.create('a', 'button umap-to-polygon', container);
toPolygon.href = '#';
toPolygon.innerHTML = L._('Transform to polygon');
L.DomEvent.on(toPolygon, 'click', this.toPolygon, this);
@ -948,19 +948,19 @@ L.U.Polygon = L.Polygon.extend({
getShapeOptions: function () {
var options = L.U.PathMixin.getShapeOptions();
options.push('properties._storage_options.stroke',
'properties._storage_options.fill',
'properties._storage_options.fillColor',
'properties._storage_options.fillOpacity'
options.push('properties._umap_options.stroke',
'properties._umap_options.fill',
'properties._umap_options.fillColor',
'properties._umap_options.fillOpacity'
);
return options;
},
getInteractionOptions: function () {
var options = [
['properties._storage_options.interactive', {handler: 'Switch', label: L._('Allow interactions'), helpEntries: 'interactive', inheritable: true}],
['properties._storage_options.outlink', {label: L._('Link to…'), helpEntries: 'outlink', placeholder: 'http://...', inheritable: true}],
['properties._storage_options.outlinkTarget', {handler: 'OutlinkTarget', label: L._('Open link in…'), inheritable: true}]
['properties._umap_options.interactive', {handler: 'Switch', label: L._('Allow interactions'), helpEntries: 'interactive', inheritable: true}],
['properties._umap_options.outlink', {label: L._('Link to…'), helpEntries: 'outlink', placeholder: 'http://...', inheritable: true}],
['properties._umap_options.outlinkTarget', {handler: 'OutlinkTarget', label: L._('Open link in…'), inheritable: true}]
];
return options.concat(L.U.FeatureMixin.getInteractionOptions());
},
@ -1004,7 +1004,7 @@ L.U.Polygon = L.Polygon.extend({
getAdvancedEditActions: function (container) {
L.U.FeatureMixin.getAdvancedEditActions.call(this, container);
var toPolyline = L.DomUtil.create('a', 'button storage-to-polyline', container);
var toPolyline = L.DomUtil.create('a', 'button umap-to-polyline', container);
toPolyline.href = '#';
toPolyline.innerHTML = L._('Transform to lines');
L.DomEvent.on(toPolyline, 'click', this.toPolyline, this);

View file

@ -126,7 +126,7 @@ L.FormBuilder.ColorPicker = L.FormBuilder.Input.extend({
build: function () {
L.FormBuilder.Input.prototype.build.call(this);
this.input.placeholder = this.options.placeholder || L._('Inherit');
this.container = L.DomUtil.create('div', 'storage-color-picker', this.extendedContainer);
this.container = L.DomUtil.create('div', 'umap-color-picker', this.extendedContainer);
this.container.style.display = 'none';
for (var idx in this.colors) {
this.addColor(this.colors[idx]);
@ -356,9 +356,9 @@ L.FormBuilder.IconUrl = L.FormBuilder.Input.extend({
build: function () {
L.FormBuilder.Input.prototype.build.call(this);
this.parentContainer = L.DomUtil.create('div', 'storage-form-iconfield', this.parentNode);
this.parentContainer = L.DomUtil.create('div', 'umap-form-iconfield', this.parentNode);
this.buttonsContainer = L.DomUtil.create('div', '', this.parentContainer);
this.pictogramsContainer = L.DomUtil.create('div', 'storage-pictogram-list', this.parentContainer);
this.pictogramsContainer = L.DomUtil.create('div', 'umap-pictogram-list', this.parentContainer);
this.input.type = 'hidden';
this.input.placeholder = L._('Url');
this.udpatePreview();
@ -367,7 +367,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.Input.extend({
udpatePreview: function () {
if (this.value() && this.value().indexOf('{') === -1) { // Do not try to render URL with variables
var img = L.DomUtil.create('img', '', L.DomUtil.create('div', 'storage-icon-choice', this.buttonsContainer));
var img = L.DomUtil.create('img', '', L.DomUtil.create('div', 'umap-icon-choice', this.buttonsContainer));
img.src = this.value();
L.DomEvent.on(img, 'click', this.fetchIconList, this);
}
@ -380,7 +380,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.Input.extend({
},
addIconPreview: function (pictogram) {
var baseClass = 'storage-icon-choice',
var baseClass = 'umap-icon-choice',
value = pictogram.src,
className = value === this.value() ? baseClass + ' selected' : baseClass,
container = L.DomUtil.create('div', className, this.pictogramsContainer),
@ -486,7 +486,7 @@ L.FormBuilder.Switch = L.FormBuilder.CheckBox.extend({
L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
default: 'null',
className: 'storage-multiplechoice',
className: 'umap-multiplechoice',
clear: function () {
var checked = this.container.querySelector('input[type="radio"]:checked');
@ -604,7 +604,7 @@ L.FormBuilder.Range = L.FormBuilder.Input.extend({
L.U.FormBuilder = L.FormBuilder.extend({
options: {
className: 'storage-form'
className: 'umap-form'
},
defaultOptions: {

View file

@ -40,7 +40,7 @@ L.U.Icon.Default = L.U.Icon.extend({
iconAnchor: new L.Point(16, 40),
popupAnchor: new L.Point(0, -40),
tooltipAnchor: new L.Point(16, -24),
className: 'storage-div-icon'
className: 'umap-div-icon'
},
initialize: function(map, options) {
@ -75,7 +75,7 @@ L.U.Icon.Circle = L.U.Icon.extend({
iconAnchor: new L.Point(6, 6),
popupAnchor: new L.Point(0, -6),
tooltipAnchor: new L.Point(6, 0),
className: 'storage-circle-icon'
className: 'umap-circle-icon'
};
options = L.Util.extend({}, default_options, options);
L.U.Icon.prototype.initialize.call(this, map, options);
@ -101,7 +101,7 @@ L.U.Icon.Drop = L.U.Icon.Default.extend({
iconAnchor: new L.Point(16, 42),
popupAnchor: new L.Point(0, -42),
tooltipAnchor: new L.Point(16, -24),
className: 'storage-drop-icon'
className: 'umap-drop-icon'
}
});
@ -110,7 +110,7 @@ L.U.Icon.Ball = L.U.Icon.Default.extend({
iconAnchor: new L.Point(8, 30),
popupAnchor: new L.Point(0, -28),
tooltipAnchor: new L.Point(8, -23),
className: 'storage-ball-icon'
className: 'umap-ball-icon'
},
createIcon: function() {

View file

@ -179,7 +179,7 @@ L.U.Map.include({
}, this);
// Creation mode
if (!this.options.storage_id) {
if (!this.options.umap_id) {
this.isDirty = true;
this.options.name = L._('Untitled map');
this.options.allowEdit = true;
@ -260,8 +260,8 @@ L.U.Map.include({
},
renderControls: function () {
L.DomUtil.classIf(document.body, 'storage-caption-bar-enabled', this.options.captionBar || (this.options.slideshow && this.options.slideshow.active));
L.DomUtil.classIf(document.body, 'storage-slideshow-enabled', this.options.slideshow && this.options.slideshow.active);
L.DomUtil.classIf(document.body, 'umap-caption-bar-enabled', this.options.captionBar || (this.options.slideshow && this.options.slideshow.active));
L.DomUtil.classIf(document.body, 'umap-slideshow-enabled', this.options.slideshow && this.options.slideshow.active);
for (var i in this._controls) {
this.removeControl(this._controls[i]);
}
@ -566,9 +566,9 @@ L.U.Map.include({
},
renderShareBox: function () {
var container = L.DomUtil.create('div', 'storage-share'),
var container = L.DomUtil.create('div', 'umap-share'),
embedTitle = L.DomUtil.add('h4', '', container, L._('Embed the map')),
iframe = L.DomUtil.create('textarea', 'storage-share-iframe', container),
iframe = L.DomUtil.create('textarea', 'umap-share-iframe', container),
option;
var UIFields = [
['dimensions.width', {handler: 'Input', label: L._('width')}],
@ -599,7 +599,7 @@ L.U.Map.include({
if (this.options.shortUrl) {
L.DomUtil.create('hr', '', container);
L.DomUtil.add('h4', '', container, L._('Short URL'));
var shortUrl = L.DomUtil.create('input', 'storage-short-url', container);
var shortUrl = L.DomUtil.create('input', 'umap-short-url', container);
shortUrl.type = 'text';
shortUrl.value = this.options.shortUrl;
}
@ -677,8 +677,8 @@ L.U.Map.include({
},
updatePermissions: function () {
if (!this.options.storage_id) return this.ui.alert({content: L._('Please save the map before'), level: 'info'});
var url = L.Util.template(this.options.urls.map_update_permissions, {'map_id': this.options.storage_id});
if (!this.options.umap_id) return this.ui.alert({content: L._('Please save the map before'), level: 'info'});
var url = L.Util.template(this.options.urls.map_update_permissions, {'map_id': this.options.umap_id});
this.get(url, {
listen_form: {'id': 'map_edit'},
className: 'dark'
@ -686,7 +686,7 @@ L.U.Map.include({
},
importPanel: function () {
var container = L.DomUtil.create('div', 'storage-upload'),
var container = L.DomUtil.create('div', 'umap-upload'),
title = L.DomUtil.create('h4', '', container),
presetBox = L.DomUtil.create('div', 'formbox', container),
presetSelect = L.DomUtil.create('select', '', presetBox),
@ -859,18 +859,18 @@ L.U.Map.include({
},
displayCaption: function () {
var container = L.DomUtil.create('div', 'storage-caption'),
var container = L.DomUtil.create('div', 'umap-caption'),
title = L.DomUtil.create('h3', '', container);
title.innerHTML = this.options.name;
if (this.options.author && this.options.author.name && this.options.author.link) {
var authorContainer = L.DomUtil.add('h5', 'storage-map-author', container, L._('by') + ' '),
var authorContainer = L.DomUtil.add('h5', 'umap-map-author', container, L._('by') + ' '),
author = L.DomUtil.create('a');
author.href = this.options.author.link;
author.innerHTML = this.options.author.name;
authorContainer.appendChild(author);
}
if (this.options.description) {
var description = L.DomUtil.create('div', 'storage-map-description', container);
var description = L.DomUtil.create('div', 'umap-map-description', container);
description.innerHTML = L.Util.toHTML(this.options.description);
}
var datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container);
@ -918,7 +918,7 @@ L.U.Map.include({
};
umapCredit.innerHTML = L._('Powered by <a href="{leaflet}">Leaflet</a> and <a href="{django}">Django</a>, glued by <a href="{umap}">uMap project</a>.', urls);
var browser = L.DomUtil.create('li', '');
L.DomUtil.create('i', 'storage-icon-16 storage-list', browser);
L.DomUtil.create('i', 'umap-icon-16 umap-list', browser);
var label = L.DomUtil.create('span', '', browser);
label.innerHTML = label.title = L._('Browse data');
L.DomEvent.on(browser, 'click', this.openBrowser, this);
@ -969,7 +969,7 @@ L.U.Map.include({
},
checkDirty: function () {
L.DomUtil.classIf(this._container, 'storage-is-dirty', this.isDirty);
L.DomUtil.classIf(this._container, 'umap-is-dirty', this.isDirty);
},
addDirtyDatalayer: function (datalayer) {
@ -1081,9 +1081,9 @@ L.U.Map.include({
data: formData,
callback: function (data) {
var duration = 3000;
if (!this.options.storage_id) {
if (!this.options.umap_id) {
duration = 100000; // we want a longer message at map creation (TODO UGLY)
this.options.storage_id = data.id;
this.options.umap_id = data.id;
if (history && history.pushState) history.pushState({}, this.options.name, data.url);
else window.location = data.url;
}
@ -1101,7 +1101,7 @@ L.U.Map.include({
},
getEditUrl: function() {
return L.Util.template(this.options.urls.map_update, {'map_id': this.options.storage_id});
return L.Util.template(this.options.urls.map_update, {'map_id': this.options.umap_id});
},
getCreateUrl: function() {
@ -1109,7 +1109,7 @@ L.U.Map.include({
},
getSaveUrl: function () {
return (this.options.storage_id && this.getEditUrl()) || this.getCreateUrl();
return (this.options.umap_id && this.getEditUrl()) || this.getCreateUrl();
},
geometry: function() {
@ -1145,8 +1145,8 @@ L.U.Map.include({
return this.createDataLayer();
},
getDataLayerByStorageId: function (storage_id) {
return this.findDataLayer(function (d) { return d.storage_id == storage_id; });
getDataLayerByUmapId: function (umap_id) {
return this.findDataLayer(function (d) { return d.umap_id == umap_id; });
},
edit: function () {
@ -1331,20 +1331,20 @@ L.U.Map.include({
var advancedActions = L.DomUtil.createFieldset(container, L._('Advanced actions'));
var advancedButtons = L.DomUtil.create('div', 'button-bar', advancedActions);
var del = L.DomUtil.create('a', 'button third storage-delete', advancedButtons);
var del = L.DomUtil.create('a', 'button third umap-delete', advancedButtons);
del.href = '#';
del.innerHTML = L._('Delete');
L.DomEvent
.on(del, 'click', L.DomEvent.stop)
.on(del, 'click', this.del, this);
var clone = L.DomUtil.create('a', 'button third storage-clone', advancedButtons);
var clone = L.DomUtil.create('a', 'button third umap-clone', advancedButtons);
clone.href = '#';
clone.innerHTML = L._('Clone');
clone.title = L._('Clone this map');
L.DomEvent
.on(clone, 'click', L.DomEvent.stop)
.on(clone, 'click', this.clone, this);
var empty = L.DomUtil.create('a', 'button third storage-empty', advancedButtons);
var empty = L.DomUtil.create('a', 'button third umap-empty', advancedButtons);
empty.href = '#';
empty.innerHTML = L._('Empty');
empty.title = L._('Delete all layers');
@ -1355,14 +1355,14 @@ L.U.Map.include({
},
enableEdit: function() {
L.DomUtil.addClass(document.body, 'storage-edit-enabled');
L.DomUtil.addClass(document.body, 'umap-edit-enabled');
this.editEnabled = true;
this.fire('edit:enabled');
},
disableEdit: function() {
if (this.isDirty) return;
L.DomUtil.removeClass(document.body, 'storage-edit-enabled');
L.DomUtil.removeClass(document.body, 'umap-edit-enabled');
this.editedFeature = null;
this.editEnabled = false;
this.fire('edit:disabled');
@ -1373,20 +1373,20 @@ L.U.Map.include({
},
initCaptionBar: function () {
var container = L.DomUtil.create('div', 'storage-caption-bar', this._controlContainer),
var container = L.DomUtil.create('div', 'umap-caption-bar', this._controlContainer),
name = L.DomUtil.create('h3', '', container);
L.DomEvent.disableClickPropagation(container);
if (this.options.author && this.options.author.name && this.options.author.link) {
var authorContainer = L.DomUtil.add('span', 'storage-map-author', container, ' ' + L._('by') + ' '),
var authorContainer = L.DomUtil.add('span', 'umap-map-author', container, ' ' + L._('by') + ' '),
author = L.DomUtil.create('a');
author.href = this.options.author.link;
author.innerHTML = this.options.author.name;
authorContainer.appendChild(author);
}
var about = L.DomUtil.add('a', 'storage-about-link', container, ' — ' + L._('About'));
var about = L.DomUtil.add('a', 'umap-about-link', container, ' — ' + L._('About'));
about.href = '#';
L.DomEvent.on(about, 'click', this.displayCaption, this);
var browser = L.DomUtil.add('a', 'storage-open-browser-link', container, ' | ' + L._('Browse data'));
var browser = L.DomUtil.add('a', 'umap-open-browser-link', container, ' | ' + L._('Browse data'));
browser.href = '#';
L.DomEvent.on(browser, 'click', L.DomEvent.stop)
.on(browser, 'click', this.openBrowser, this);
@ -1401,9 +1401,9 @@ L.U.Map.include({
},
initEditBar: function () {
var container = L.DomUtil.create('div', 'storage-main-edit-toolbox with-transition dark', this._controlContainer),
var container = L.DomUtil.create('div', 'umap-main-edit-toolbox with-transition dark', this._controlContainer),
title = L.DomUtil.add('h3', '', container, L._('Editing') + '&nbsp;'),
name = L.DomUtil.create('a', 'storage-click-to-edit', title),
name = L.DomUtil.create('a', 'umap-click-to-edit', title),
setName = function () {
name.innerHTML = this.getDisplayName();
};
@ -1461,14 +1461,14 @@ L.U.Map.include({
del: function () {
if (confirm(L._('Are you sure you want to delete this map?'))) {
var url = L.Util.template(this.options.urls.map_delete, {'map_id': this.options.storage_id});
var url = L.Util.template(this.options.urls.map_delete, {'map_id': this.options.umap_id});
this.post(url);
}
},
clone: function () {
if (confirm(L._('Are you sure you want to clone this map and all its datalayers?'))) {
var url = L.Util.template(this.options.urls.map_clone, {'map_id': this.options.storage_id});
var url = L.Util.template(this.options.urls.map_clone, {'map_id': this.options.umap_id});
this.post(url);
}
},

View file

@ -194,19 +194,19 @@ L.U.DataLayer = L.Class.extend({
catch (e) {
// Certainly IE8, which has a limited version of defineProperty
}
this.setStorageId(data.id);
this.setUmapId(data.id);
this.setOptions(data);
this.backupOptions();
this.connectToMap();
if (this.displayedOnLoad()) this.show();
if (!this.storage_id) this.isDirty = true;
if (!this.umap_id) this.isDirty = true;
this.onceLoaded(function () {
this.map.on('moveend', this.fetchRemoteData, this);
});
},
displayedOnLoad: function () {
return ((this.map.datalayersOnLoad && this.storage_id && this.map.datalayersOnLoad.indexOf(this.storage_id.toString()) !== -1) ||
return ((this.map.datalayersOnLoad && this.umap_id && this.map.datalayersOnLoad.indexOf(this.umap_id.toString()) !== -1) ||
(!this.map.datalayersOnLoad && this.options.displayOnLoad));
},
@ -255,7 +255,7 @@ L.U.DataLayer = L.Class.extend({
},
fetchData: function () {
if (!this.storage_id) return;
if (!this.umap_id) return;
this.map.get(this._dataUrl(), {
callback: function (geojson, response) {
this._etag = response.getResponseHeader('ETag');
@ -275,7 +275,8 @@ L.U.DataLayer = L.Class.extend({
},
fromUmapGeoJSON: function (geojson) {
if (geojson._storage) this.setOptions(geojson._storage);
if (geojson._storage) geojson._umap_options = geojson._storage; // Retrocompat
if (geojson._umap_options) this.setOptions(geojson._umap_options);
if (this.isRemoteLayer()) this.fetchRemoteData();
else this.fromGeoJSON(geojson);
this._loaded = true;
@ -344,16 +345,16 @@ L.U.DataLayer = L.Class.extend({
},
isLoaded: function () {
return !this.storage_id || this._loaded;
return !this.umap_id || this._loaded;
},
hasDataLoaded: function () {
return !this.storage_id || this._geojson !== null;
return !this.umap_id || this._geojson !== null;
},
setStorageId: function (id) {
setUmapId: function (id) {
// Datalayer is null when listening creation form
if (!this.storage_id && id) this.storage_id = id;
if (!this.umap_id && id) this.umap_id = id;
},
backupOptions: function () {
@ -385,7 +386,7 @@ L.U.DataLayer = L.Class.extend({
_dataUrl: function() {
var template = this.map.options.urls.datalayer_view;
return L.Util.template(template, {'pk': this.storage_id, 'map_id': this.map.options.storage_id});
return L.Util.template(template, {'pk': this.umap_id, 'map_id': this.map.options.umap_id});
},
isRemoteLayer: function () {
@ -437,6 +438,7 @@ L.U.DataLayer = L.Class.extend({
// otherwise the layer becomes uneditable.
this.geojsonToFeatures(geojson);
} catch (err) {
console.log("Error with DataLayer", this.umap_id);
console.error(err);
}
},
@ -611,15 +613,15 @@ L.U.DataLayer = L.Class.extend({
},
getEditUrl: function() {
return L.Util.template(this.map.options.urls.datalayer_update, {'map_id': this.map.options.storage_id, 'pk': this.storage_id});
return L.Util.template(this.map.options.urls.datalayer_update, {'map_id': this.map.options.umap_id, 'pk': this.umap_id});
},
getCreateUrl: function() {
return L.Util.template(this.map.options.urls.datalayer_create, {'map_id': this.map.options.storage_id});
return L.Util.template(this.map.options.urls.datalayer_create, {'map_id': this.map.options.umap_id});
},
getSaveUrl: function () {
return (this.storage_id && this.getEditUrl()) || this.getCreateUrl();
return (this.umap_id && this.getEditUrl()) || this.getCreateUrl();
},
getColor: function () {
@ -627,16 +629,16 @@ L.U.DataLayer = L.Class.extend({
},
getDeleteUrl: function () {
return L.Util.template(this.map.options.urls.datalayer_delete, {'pk': this.storage_id, 'map_id': this.map.options.storage_id});
return L.Util.template(this.map.options.urls.datalayer_delete, {'pk': this.umap_id, 'map_id': this.map.options.umap_id});
},
getVersionsUrl: function () {
return L.Util.template(this.map.options.urls.datalayer_versions, {'pk': this.storage_id, 'map_id': this.map.options.storage_id});
return L.Util.template(this.map.options.urls.datalayer_versions, {'pk': this.umap_id, 'map_id': this.map.options.umap_id});
},
getVersionUrl: function (name) {
return L.Util.template(this.map.options.urls.datalayer_version, {'pk': this.storage_id, 'map_id': this.map.options.storage_id, name: name});
return L.Util.template(this.map.options.urls.datalayer_version, {'pk': this.umap_id, 'map_id': this.map.options.umap_id, name: name});
},
_delete: function () {
@ -674,7 +676,7 @@ L.U.DataLayer = L.Class.extend({
},
reset: function () {
if (!this.storage_id) this.erase();
if (!this.umap_id) this.erase();
this.resetOptions();
this.parentPane.appendChild(this.pane);
@ -795,7 +797,7 @@ L.U.DataLayer = L.Class.extend({
var advancedActions = L.DomUtil.createFieldset(container, L._('Advanced actions'));
var advancedButtons = L.DomUtil.create('div', 'button-bar', advancedActions);
var deleteLink = L.DomUtil.create('a', 'button third delete_datalayer_button storage-delete', advancedButtons);
var deleteLink = L.DomUtil.create('a', 'button third delete_datalayer_button umap-delete', advancedButtons);
deleteLink.innerHTML = L._('Delete');
deleteLink.href = '#';
L.DomEvent.on(deleteLink, 'click', L.DomEvent.stop)
@ -804,13 +806,13 @@ L.U.DataLayer = L.Class.extend({
this.map.ui.closePanel();
}, this);
if (!this.isRemoteLayer()) {
var emptyLink = L.DomUtil.create('a', 'button third storage-empty', advancedButtons);
var emptyLink = L.DomUtil.create('a', 'button third umap-empty', advancedButtons);
emptyLink.innerHTML = L._('Empty');
emptyLink.href = '#';
L.DomEvent.on(emptyLink, 'click', L.DomEvent.stop)
.on(emptyLink, 'click', this.empty, this);
}
var cloneLink = L.DomUtil.create('a', 'button third storage-clone', advancedButtons);
var cloneLink = L.DomUtil.create('a', 'button third umap-clone', advancedButtons);
cloneLink.innerHTML = L._('Clone');
cloneLink.href = '#';
L.DomEvent.on(cloneLink, 'click', L.DomEvent.stop)
@ -832,7 +834,7 @@ L.U.DataLayer = L.Class.extend({
var appendVersion = function (data) {
var date = new Date(parseInt(data.at, 10));
var content = date.toLocaleFormat() + ' (' + parseInt(data.size) / 1000 + 'Kb)';
var el = L.DomUtil.create('div', 'storage-datalayer-version', versionsContainer);
var el = L.DomUtil.create('div', 'umap-datalayer-version', versionsContainer);
var a = L.DomUtil.create('a', '', el);
L.DomUtil.add('span', '', el, content);
a.href = '#';
@ -860,7 +862,8 @@ L.U.DataLayer = L.Class.extend({
if (!confirm(L._('Are you sure you want to restore this version?'))) return;
this.map.xhr.get(this.getVersionUrl(version), {
callback: function (geojson) {
if (geojson._storage) this.setOptions(geojson._storage);
if (geojson._storage) geojson._umap_options = geojson._storage; // Retrocompat.
if (geojson._umap_options) this.setOptions(geojson._umap_options);
this.empty();
if (this.isRemoteLayer()) this.fetchRemoteData();
else this.addData(geojson);
@ -951,13 +954,13 @@ L.U.DataLayer = L.Class.extend({
return {
type: 'FeatureCollection',
features: this.isRemoteLayer() ? [] : this.featuresToGeoJSON(),
_storage: this.options
_umap_options: this.options
};
},
metadata: function () {
return {
id: this.storage_id,
id: this.umap_id,
name: this.options.name,
displayOnLoad: this.options.displayOnLoad
}
@ -983,7 +986,7 @@ L.U.DataLayer = L.Class.extend({
callback: function (data, response) {
this._geojson = geojson;
this._etag = response.getResponseHeader('ETag');
this.setStorageId(data.id);
this.setUmapId(data.id);
this.updateOptions(data);
this.backupOptions();
this.connectToMap();
@ -1002,7 +1005,7 @@ L.U.DataLayer = L.Class.extend({
this.isDirty = false;
this.map.continueSaving();
}
if (!this.storage_id) return callback.call(this);
if (!this.umap_id) return callback.call(this);
this.map.xhr.post(this.getDeleteUrl(), {
callback: callback,
context: this

View file

@ -6,7 +6,7 @@ L.U.Popup = L.Popup.extend({
initialize: function (feature) {
this.feature = feature;
this.container = L.DomUtil.create('div', 'storage-popup');
this.container = L.DomUtil.create('div', 'umap-popup');
this.format();
L.Popup.prototype.initialize.call(this, {}, feature);
this.setContent(this.container);
@ -52,7 +52,7 @@ L.U.Popup = L.Popup.extend({
renderFooter: function () {
if (this.hasFooter()) {
var footer = L.DomUtil.create('ul', 'storage-popup-footer', this.container),
var footer = L.DomUtil.create('ul', 'umap-popup-footer', this.container),
previousLi = L.DomUtil.create('li', 'previous', footer),
zoomLi = L.DomUtil.create('li', 'zoom', footer),
nextLi = L.DomUtil.create('li', 'next', footer),
@ -81,7 +81,7 @@ L.U.Popup = L.Popup.extend({
var title = this.renderTitle();
if (title) this.container.appendChild(title);
var body = this.renderBody();
if (body) L.DomUtil.add('div', 'storage-popup-content', this.container, body);
if (body) L.DomUtil.add('div', 'umap-popup-content', this.container, body);
this.renderFooter();
},
@ -98,7 +98,7 @@ L.U.Popup = L.Popup.extend({
L.U.Popup.Large = L.U.Popup.extend({
options: {
maxWidth: 500,
className: 'storage-popup-large'
className: 'umap-popup-large'
}
});
@ -150,7 +150,7 @@ L.U.Popup.GeoRSSImage = L.U.Popup.BaseWithTitle.extend({
options: {
minWidth: 300,
maxWidth: 500,
className: 'storage-popup-large storage-georss-image'
className: 'umap-popup-large umap-georss-image'
},
renderBody: function () {
@ -174,7 +174,7 @@ L.U.Popup.GeoRSSImage = L.U.Popup.BaseWithTitle.extend({
L.U.Popup.GeoRSSLink = L.U.Popup.extend({
options: {
className: 'storage-georss-link'
className: 'umap-georss-link'
},
renderBody: function () {
@ -195,7 +195,7 @@ L.U.Popup.SimplePanel = L.U.Popup.extend({
allButton: function () {
var button = L.DomUtil.create('li', '');
L.DomUtil.create('i', 'storage-icon-16 storage-list', button);
L.DomUtil.create('i', 'umap-icon-16 umap-list', button);
var label = L.DomUtil.create('span', '', button);
label.innerHTML = label.title = L._('See all');
L.DomEvent.on(button, 'click', this.feature.map.openBrowser, this.feature.map);

View file

@ -1,7 +1,7 @@
L.U.Slideshow = L.Class.extend({
statics: {
CLASSNAME: 'storage-slideshow-active'
CLASSNAME: 'umap-slideshow-active'
},
options: {
@ -68,7 +68,7 @@ L.U.Slideshow = L.Class.extend({
var time = parseInt(this.options.delay, 10);
if (!time) return;
var css = 'rotation ' + time / 1000 + 's infinite linear',
spinners = document.querySelectorAll('.storage-slideshow-toolbox .play .spinner');
spinners = document.querySelectorAll('.umap-slideshow-toolbox .play .spinner');
for (var i = 0; i < spinners.length; i++) {
spinners[i].style.animation = css;
spinners[i].style['-webkit-animation'] = css;
@ -79,7 +79,7 @@ L.U.Slideshow = L.Class.extend({
resetSpinners: function () {
// Make that animnation is coordinated with user actions
var spinners = document.querySelectorAll('.storage-slideshow-toolbox .play .spinner'),
var spinners = document.querySelectorAll('.umap-slideshow-toolbox .play .spinner'),
el, newOne;
for (var i = 0; i < spinners.length; i++) {
el = spinners[i];
@ -134,7 +134,7 @@ L.U.Slideshow = L.Class.extend({
},
renderToolbox: function (container) {
var box = L.DomUtil.create('ul', 'storage-slideshow-toolbox'),
var box = L.DomUtil.create('ul', 'umap-slideshow-toolbox'),
play = L.DomUtil.create('li', 'play', box),
stop = L.DomUtil.create('li', 'stop', box),
prev = L.DomUtil.create('li', 'prev', box),

View file

@ -18,8 +18,8 @@ L.U.TableEditor = L.Class.extend({
renderHeader: function (property) {
var container = L.DomUtil.create('div', 'tcell', this.header),
title = L.DomUtil.add('span', '', container, property),
del = L.DomUtil.create('i', 'storage-delete', container),
rename = L.DomUtil.create('i', 'storage-edit', container);
del = L.DomUtil.create('i', 'umap-delete', container),
rename = L.DomUtil.create('i', 'umap-edit', container);
del.title = L._('Delete this property on all the features');
rename.title = L._('Rename this property on all the features');
var doDelete = function () {
@ -50,7 +50,7 @@ L.U.TableEditor = L.Class.extend({
renderRow: function (feature) {
var builder = new L.U.FormBuilder(feature, this.field_properties,
{
id: 'storage-feature-properties_' + L.stamp(feature),
id: 'umap-feature-properties_' + L.stamp(feature),
className: 'trow',
callback: feature.resetTooltip
}
@ -81,7 +81,7 @@ L.U.TableEditor = L.Class.extend({
this.body.innerHTML = '';
this.datalayer.eachLayer(this.renderRow, this);
var addButton = L.DomUtil.create('li', 'add-property');
L.DomUtil.create('i', 'storage-icon-16 storage-add', addButton);
L.DomUtil.create('i', 'umap-icon-16 umap-add', addButton);
var label = L.DomUtil.create('span', '', addButton);
label.innerHTML = label.title = L._('Add a new property');
var addProperty = function () {
@ -91,7 +91,7 @@ L.U.TableEditor = L.Class.extend({
this.edit();
};
L.DomEvent.on(addButton, 'click', addProperty, this);
var className = (this.properties.length > 2) ? 'storage-table-editor fullwidth dark' : 'storage-table-editor dark';
var className = (this.properties.length > 2) ? 'umap-table-editor fullwidth dark' : 'umap-table-editor dark';
this.datalayer.map.ui.openPanel({data: {html: this.table}, className: className, actions: [addButton]});
this.datalayer.map.fire('dataload', {id: id});
}

View file

@ -15,11 +15,11 @@ L.U.UI = L.Evented.extend({
L.DomEvent.on(this.container, 'mousewheel', L.DomEvent.stopPropagation);
L.DomEvent.on(this.container, 'MozMousePixelScroll', L.DomEvent.stopPropagation);
this._panel = L.DomUtil.create('div', '', this.container);
this._panel.id = 'storage-ui-container';
this._panel.id = 'umap-ui-container';
this._alert = L.DomUtil.create('div', 'with-transition', this.container);
this._alert.id = 'storage-alert-container';
this._alert.id = 'umap-alert-container';
this._tooltip = L.DomUtil.create('div', '', this.container);
this._tooltip.id = 'storage-tooltip-container';
this._tooltip.id = 'umap-tooltip-container';
},
resetPanelClassName: function () {
@ -36,8 +36,8 @@ L.U.UI = L.Evented.extend({
var body = L.DomUtil.create('div', 'body', this._panel);
if (e.data.html.nodeType && e.data.html.nodeType === 1) body.appendChild(e.data.html);
else body.innerHTML = e.data.html;
var closeLink = L.DomUtil.create('li', 'storage-close-link', actionsContainer);
L.DomUtil.add('i', 'storage-close-icon', closeLink);
var closeLink = L.DomUtil.create('li', 'umap-close-link', actionsContainer);
L.DomUtil.add('i', 'umap-close-icon', closeLink);
var label = L.DomUtil.create('span', '', closeLink);
label.title = label.innerHTML = L._('Close');
if (e.actions) {
@ -46,26 +46,26 @@ L.U.UI = L.Evented.extend({
}
}
if (e.className) L.DomUtil.addClass(this._panel, e.className);
if (L.DomUtil.hasClass(this.parent, 'storage-ui')) {
if (L.DomUtil.hasClass(this.parent, 'umap-ui')) {
// Already open.
this.fire('panel:ready');
} else {
L.DomEvent.once(this._panel, 'transitionend', function (e) {
this.fire('panel:ready');
}, this);
L.DomUtil.addClass(this.parent, 'storage-ui');
L.DomUtil.addClass(this.parent, 'umap-ui');
}
L.DomEvent.on(closeLink, 'click', this.closePanel, this);
},
closePanel: function () {
this.resetPanelClassName();
L.DomUtil.removeClass(this.parent, 'storage-ui');
L.DomUtil.removeClass(this.parent, 'umap-ui');
this.fire('panel:closed');
},
alert: function (e) {
if (L.DomUtil.hasClass(this.parent, 'storage-alert')) this.ALERTS.push(e);
if (L.DomUtil.hasClass(this.parent, 'umap-alert')) this.ALERTS.push(e);
else this.popAlert(e);
},
@ -78,19 +78,19 @@ L.U.UI = L.Evented.extend({
var timeoutID,
level_class = e.level && e.level == 'info'? 'info': 'error';
this._alert.innerHTML = '';
L.DomUtil.addClass(this.parent, 'storage-alert');
L.DomUtil.addClass(this.parent, 'umap-alert');
L.DomUtil.addClass(this._alert, level_class);
var close = function () {
if (timeoutID !== this.ALERT_ID) { return;} // Another alert has been forced
this._alert.innerHTML = '';
L.DomUtil.removeClass(this.parent, 'storage-alert');
L.DomUtil.removeClass(this.parent, 'umap-alert');
L.DomUtil.removeClass(this._alert, level_class);
if (timeoutID) window.clearTimeout(timeoutID);
this.popAlert();
};
var closeLink = L.DomUtil.create('a', 'storage-close-link', this._alert);
var closeLink = L.DomUtil.create('a', 'umap-close-link', this._alert);
closeLink.href = '#';
L.DomUtil.add('i', 'storage-close-icon', closeLink);
L.DomUtil.add('i', 'umap-close-icon', closeLink);
var label = L.DomUtil.create('span', '', closeLink);
label.title = label.innerHTML = L._('Close');
L.DomEvent.on(closeLink, 'click', L.DomEvent.stop)
@ -100,7 +100,7 @@ L.U.UI = L.Evented.extend({
var action, el;
for (var i = 0; i < e.actions.length; i++) {
action = e.actions[i];
el = L.DomUtil.element('a', {'className': 'storage-action'}, this._alert);
el = L.DomUtil.element('a', {'className': 'umap-action'}, this._alert);
el.href = '#';
el.innerHTML = action.label;
L.DomEvent.on(el, 'click', L.DomEvent.stop)
@ -114,7 +114,7 @@ L.U.UI = L.Evented.extend({
tooltip: function (e) {
this.TOOLTIP_ID = Math.random();
var id = this.TOOLTIP_ID;
L.DomUtil.addClass(this.parent, 'storage-tooltip');
L.DomUtil.addClass(this.parent, 'umap-tooltip');
if (e.anchor && e.position === 'top') this.anchorTooltipTop(e.anchor);
else if (e.anchor && e.position === 'left') this.anchorTooltipLeft(e.anchor);
else this.anchorTooltipAbsolute();
@ -146,7 +146,7 @@ L.U.UI = L.Evented.extend({
closeTooltip: function (id) {
if (id && id !== this.TOOLTIP_ID) return;
this._tooltip.innerHTML = '';
L.DomUtil.removeClass(this.parent, 'storage-tooltip');
L.DomUtil.removeClass(this.parent, 'umap-tooltip');
},
getPosition: function (el) {

View file

@ -251,7 +251,7 @@ L.U.Xhr = L.Evented.extend({
}
});
// Auth links
var links = document.getElementsByClassName('storage-login-popup');
var links = document.getElementsByClassName('umap-login-popup');
Object.keys(links).forEach(function (el) {
var link = links[el];
L.DomEvent
@ -259,7 +259,7 @@ L.U.Xhr = L.Evented.extend({
.on(link, 'click', function () {
self.ui.closePanel();
var win = window.open(link.href);
window.storage_proceed = function () {
window.umap_proceed = function () {
proceed();
win.close();
};

File diff suppressed because it is too large Load diff

View file

@ -3,9 +3,9 @@ describe('L.Utorage.Controls', function(){
before(function () {
this.server = sinon.fakeServer.create();
this.server.respondWith('/datalayer/62/', JSON.stringify(RESPONSES.datalayer62_GET));
this.map = initMap({storage_id: 99});
this.map = initMap({umap_id: 99});
this.server.respond();
this.datalayer = this.map.getDataLayerByStorageId(62);
this.datalayer = this.map.getDataLayerByUmapId(62);
});
after(function () {
this.server.restore();
@ -15,10 +15,10 @@ describe('L.Utorage.Controls', function(){
describe('#databrowser()', function(){
it('should be opened at datalayer button click', function() {
var button = qs('.storage-browse-actions .storage-browse-link');
var button = qs('.umap-browse-actions .umap-browse-link');
assert.ok(button);
happen.click(button);
assert.ok(qs('#storage-ui-container .storage-browse-data'));
assert.ok(qs('#umap-ui-container .umap-browse-data'));
});
it('should contain datalayer section', function() {
@ -34,14 +34,14 @@ describe('L.Utorage.Controls', function(){
window.confirm = function () {return true;};
enableEdit();
happen.once(qs('path[fill="DarkBlue"]'), {type: 'contextmenu'});
happen.click(qs('.leaflet-contextmenu .storage-delete'));
happen.click(qs('.leaflet-contextmenu .umap-delete'));
assert.equal(qsa('#browse_data_datalayer_62 ul li').length, 2);
window.confirm = oldConfirm;
});
it('should redraw datalayer\'s features list on edit cancel', function() {
clickCancel();
happen.click(qs('.storage-browse-actions .storage-browse-link'));
happen.click(qs('.umap-browse-actions .umap-browse-link'));
assert.equal(qsa('#browse_data_datalayer_62 ul li').length, 3);
});

View file

@ -4,8 +4,8 @@ describe('L.DataLayer', function () {
before(function () {
this.server = sinon.fakeServer.create();
this.server.respondWith('GET', '/datalayer/62/', JSON.stringify(RESPONSES.datalayer62_GET));
this.map = initMap({storage_id: 99});
this.datalayer = this.map.getDataLayerByStorageId(62);
this.map = initMap({umap_id: 99});
this.datalayer = this.map.getDataLayerByUmapId(62);
this.server.respond();
enableEdit();
});
@ -44,8 +44,8 @@ describe('L.DataLayer', function () {
it('should build a form on edit button click', function () {
happen.click(editButton);
form = qs('form.storage-form');
input = qs('form.storage-form input[name="name"]');
form = qs('form.umap-form');
input = qs('form.umap-form input[name="name"]');
assert.ok(form);
assert.ok(input);
});
@ -85,15 +85,15 @@ describe('L.DataLayer', function () {
this.server.respondWith('POST', '/map/99/update/settings/', JSON.stringify({id: 99}));
this.server.respondWith('POST', '/map/99/datalayer/update/62/', [412, {}, '']);
happen.click(editButton);
input = qs('form.storage-form input[name="name"]');
input = qs('form.umap-form input[name="name"]');
input.value = 'a new name';
happen.once(input, {type: 'input'});
clickSave();
this.server.respond();
this.server.respond();
assert(L.DomUtil.hasClass(this.map._container, 'storage-alert'));
assert(L.DomUtil.hasClass(this.map._container, 'umap-alert'));
assert.notEqual(this.map.dirty_datalayers.indexOf(this.datalayer), -1);
forceButton = qs('#storage-alert-container .storage-action');
forceButton = qs('#umap-alert-container .umap-action');
assert.ok(forceButton);
});
@ -102,7 +102,7 @@ describe('L.DataLayer', function () {
happen.click(forceButton);
this.server.flush();
this.server.respond('POST', '/map/99/datalayer/update/62/', JSON.stringify(defaultDatalayerData()));
assert.notOk(qs('#storage-alert-container .storage-action'));
assert.notOk(qs('#umap-alert-container .umap-action'));
assert(this.map.continueSaving.calledOnce);
this.map.continueSaving.restore();
assert.equal(this.map.dirty_datalayers.indexOf(this.datalayer), -1);
@ -121,14 +121,14 @@ describe('L.DataLayer', function () {
});
it('should have a new layer button', function () {
newLayerButton = qs('#storage-ui-container .add-datalayer');
newLayerButton = qs('#umap-ui-container .add-datalayer');
assert.ok(newLayerButton);
});
it('should build a form on new layer button click', function () {
happen.click(newLayerButton);
form = qs('form.storage-form');
input = qs('form.storage-form input[name="name"]');
form = qs('form.umap-form');
input = qs('form.umap-form input[name="name"]');
assert.ok(form);
assert.ok(input);
});
@ -153,15 +153,15 @@ describe('L.DataLayer', function () {
assert.equal(newDatalayer.options.name, new_name);
});
it('should set storage_id on save callback', function () {
assert.notOk(newDatalayer.storage_id);
it('should set umap_id on save callback', function () {
assert.notOk(newDatalayer.umap_id);
this.server.flush();
this.server.respondWith('POST', '/map/99/update/settings/', JSON.stringify({id: 99}));
this.server.respondWith('POST', '/map/99/datalayer/create/', JSON.stringify(defaultDatalayerData({id: 63})));
clickSave();
this.server.respond();
this.server.respond(); // First respond will then trigger another Xhr request (continueSaving)
assert.equal(newDatalayer.storage_id, 63);
assert.equal(newDatalayer.umap_id, 63);
});
it('should have unset map dirty', function () {
@ -176,7 +176,7 @@ describe('L.DataLayer', function () {
it('should call update if we edit again', function () {
happen.click(editButton);
assert.notOk(this.map.isDirty);
input = qs('form.storage-form input[name="name"]');
input = qs('form.umap-form input[name="name"]');
input.value = 'a new name again but we don\'t care which';
happen.once(input, {type: 'input'});
assert.ok(this.map.isDirty);
@ -200,8 +200,8 @@ describe('L.DataLayer', function () {
it('should change icon class', function () {
happen.click(qs('[data-id="' + this.datalayer._leaflet_id +'"] .layer-edit'));
changeSelectValue(qs('form#datalayer-advanced-properties select[name=iconClass]'), 'Circle');
assert.notOk(qs('div.storage-div-icon'));
assert.ok(qs('div.storage-circle-icon'));
assert.notOk(qs('div.umap-div-icon'));
assert.ok(qs('div.umap-circle-icon'));
clickCancel();
});
@ -210,18 +210,18 @@ describe('L.DataLayer', function () {
describe('#show/hide', function () {
it('should hide features on hide', function () {
assert.ok(qs('div.storage-div-icon'));
assert.ok(qs('div.umap-div-icon'));
assert.ok(qs('path[fill="none"]'));
this.datalayer.hide();
assert.notOk(qs('div.storage-div-icon'));
assert.notOk(qs('div.umap-div-icon'));
assert.notOk(qs('path[fill="none"]'));
});
it('should show features on show', function () {
assert.notOk(qs('div.storage-div-icon'));
assert.notOk(qs('div.umap-div-icon'));
assert.notOk(qs('path[fill="none"]'));
this.datalayer.show();
assert.ok(qs('div.storage-div-icon'));
assert.ok(qs('div.umap-div-icon'));
assert.ok(qs('path[fill="none"]'));
});
@ -232,7 +232,7 @@ describe('L.DataLayer', function () {
it('should clone everything but the id and the name', function () {
enableEdit();
var clone = this.datalayer.clone();
assert.notOk(clone.storage_id);
assert.notOk(clone.umap_id);
assert.notEqual(clone.options.name, this.datalayer.name);
assert.ok(clone.options.name);
assert.equal(clone.options.color, this.datalayer.options.color);
@ -267,16 +267,16 @@ describe('L.DataLayer', function () {
},
'type': 'Feature',
'id': 1807,
'properties': {_storage_options: {}, name: 'new point from restore'}
'properties': {_umap_options: {}, name: 'new point from restore'}
});
geojson._storage.color = 'Chocolate';
geojson._umap_options.color = 'Chocolate';
this.server.respondWith('GET', '/datalayer/62/olderversion.geojson', JSON.stringify(geojson));
sinon.spy(window, 'confirm');
this.datalayer.restore('olderversion.geojson');
this.server.respond();
assert(window.confirm.calledOnce);
window.confirm.restore();
assert.equal(this.datalayer.storage_id, 62);
assert.equal(this.datalayer.umap_id, 62);
assert.ok(this.datalayer.isDirty);
assert.equal(this.datalayer._index.length, 4);
assert.ok(qs('path[fill="Chocolate"]'));

View file

@ -3,8 +3,8 @@ describe('L.Utorage.FeatureMixin', function () {
before(function () {
this.server = sinon.fakeServer.create();
this.server.respondWith('GET', '/datalayer/62/', JSON.stringify(RESPONSES.datalayer62_GET));
this.map = initMap({storage_id: 99});
this.datalayer = this.map.getDataLayerByStorageId(62);
this.map = initMap({umap_id: 99});
this.datalayer = this.map.getDataLayerByUmapId(62);
this.server.respond();
});
after(function () {
@ -36,24 +36,24 @@ describe('L.Utorage.FeatureMixin', function () {
happen.click(qs('path[fill="DarkRed"]'));
var toolbar = qs('ul.leaflet-inplace-toolbar');
assert.ok(toolbar);
link = qs('a.storage-toggle-edit', toolbar);
link = qs('a.umap-toggle-edit', toolbar);
assert.ok(link);
});
it('should open a form on popup toolbar toggle edit click', function () {
happen.click(link);
var form = qs('form#storage-feature-properties');
var input = qs('form#storage-feature-properties input[name="name"]');
var form = qs('form#umap-feature-properties');
var input = qs('form#umap-feature-properties input[name="name"]');
assert.ok(form);
assert.ok(input);
});
it('should not handle _storage_options has normal property', function () {
assert.notOk(qs('form#storage-feature-properties input[name="_storage_options"]'));
it('should not handle _umap_options has normal property', function () {
assert.notOk(qs('form#umap-feature-properties input[name="_umap_options"]'));
});
it('should give precedence to feature style over datalayer styles', function () {
var input = qs('#storage-ui-container form input[name="color"]');
var input = qs('#umap-ui-container form input[name="color"]');
assert.ok(input);
changeInputValue(input, 'DarkGreen');
assert.notOk(qs('path[fill="DarkRed"]'));
@ -64,9 +64,9 @@ describe('L.Utorage.FeatureMixin', function () {
it('should remove stroke if set to no', function () {
assert.notOk(qs('path[stroke="none"]'));
var defineButton = qs('#storage-feature-shape-properties .formbox:nth-child(4) .define');
var defineButton = qs('#umap-feature-shape-properties .formbox:nth-child(4) .define');
happen.click(defineButton);
var input = qs('#storage-feature-shape-properties input[name="stroke"]');
var input = qs('#umap-feature-shape-properties input[name="stroke"]');
assert.ok(input);
input.checked = false;
happen.once(input, {type: 'change'});
@ -76,7 +76,7 @@ describe('L.Utorage.FeatureMixin', function () {
it('should not override already set style on features', function () {
happen.click(qs('#browse_data_toggle_' + L.stamp(this.datalayer) + ' .layer-edit'));
changeInputValue(qs('#storage-ui-container form input[name=color]'), 'Chocolate');
changeInputValue(qs('#umap-ui-container form input[name=color]'), 'Chocolate');
assert.notOk(qs('path[fill="DarkBlue"]'));
assert.notOk(qs('path[fill="DarkRed"]'));
assert.notOk(qs('path[fill="Chocolate"]'));
@ -95,7 +95,7 @@ describe('L.Utorage.FeatureMixin', function () {
enableEdit();
assert.notOk(this.map.editedFeature);
happen.click(qs('path[fill="DarkBlue"]'));
happen.click(qs('ul.leaflet-inplace-toolbar a.storage-toggle-edit'));
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'));
assert.ok(this.map.editedFeature);
disableEdit();
});
@ -104,7 +104,7 @@ describe('L.Utorage.FeatureMixin', function () {
enableEdit();
assert.notOk(this.map.editedFeature);
happen.click(qs('path[fill="DarkBlue"]'));
happen.click(qs('ul.leaflet-inplace-toolbar a.storage-toggle-edit'));
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'));
assert.ok(this.map.editedFeature);
this.map.displayCaption();
window.setTimeout(function () {
@ -136,12 +136,12 @@ describe('L.Utorage.FeatureMixin', function () {
assert.equal(poly.getLatLngs()[0].length, 6);
});
it('should remove empty _storage_options from exported geojson', function () {
it('should remove empty _umap_options from exported geojson', function () {
setFeatures(this.datalayer);
assert.ok(poly);
assert.deepEqual(poly.toGeoJSON().properties, {name: 'name poly'});
assert.ok(marker);
assert.deepEqual(marker.toGeoJSON().properties, {_storage_options: {color: 'OliveDrab'}, name: 'test'});
assert.deepEqual(marker.toGeoJSON().properties, {_umap_options: {color: 'OliveDrab'}, name: 'test'});
});
});
@ -151,11 +151,11 @@ describe('L.Utorage.FeatureMixin', function () {
it('should change style on datalayer select change', function () {
enableEdit();
happen.click(qs('.manage-datalayers'));
happen.click(qs('#storage-ui-container .add-datalayer'));
changeInputValue(qs('form.storage-form input[name="name"]'), 'New layer');
happen.click(qs('#umap-ui-container .add-datalayer'));
changeInputValue(qs('form.umap-form input[name="name"]'), 'New layer');
changeInputValue(qs('form#datalayer-advanced-properties input[name=color]'), 'MediumAquaMarine');
happen.click(qs('path[fill="DarkBlue"]'));
happen.click(qs('ul.leaflet-inplace-toolbar a.storage-toggle-edit'));
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'));
var select = qs('select[name=datalayer]');
select.selectedIndex = 0;
happen.once(select, {type: 'change'});

View file

@ -4,11 +4,11 @@ describe('L.Utorage.Map', function(){
this.server = sinon.fakeServer.create();
this.server.respondWith('/datalayer/62/', JSON.stringify(RESPONSES.datalayer62_GET));
this.options = {
storage_id: 99
umap_id: 99
};
this.map = initMap({storage_id: 99});
this.map = initMap({umap_id: 99});
this.server.respond();
this.datalayer = this.map.getDataLayerByStorageId(62);
this.datalayer = this.map.getDataLayerByUmapId(62);
});
after(function () {
this.server.restore();
@ -19,7 +19,7 @@ describe('L.Utorage.Map', function(){
describe('#init()', function(){
it('should be initialized', function(){
assert.equal(this.map.options.storage_id, 99);
assert.equal(this.map.options.umap_id, 99);
});
it('should have created the edit button', function(){
@ -31,7 +31,7 @@ describe('L.Utorage.Map', function(){
});
it('should have datalayer actions div', function(){
assert.ok(qs('div.storage-browse-actions'));
assert.ok(qs('div.umap-browse-actions'));
});
it('should have icon container div', function(){
@ -47,7 +47,7 @@ describe('L.Utorage.Map', function(){
it('enable edit on click on toggle button', function () {
var el = qs('div.leaflet-control-edit-enable a');
happen.click(el);
assert.isTrue(L.DomUtil.hasClass(document.body, 'storage-edit-enabled'));
assert.isTrue(L.DomUtil.hasClass(document.body, 'umap-edit-enabled'));
});
it('should have only one datalayer in its index', function () {
@ -62,8 +62,8 @@ describe('L.Utorage.Map', function(){
var button = qs('a.update-map-settings');
assert.ok(button);
happen.click(button);
form = qs('form.storage-form');
input = qs('form[class="storage-form"] input[name="name"]');
form = qs('form.umap-form');
input = qs('form[class="umap-form"] input[name="name"]');
assert.ok(form);
assert.ok(input);
done();
@ -81,7 +81,7 @@ describe('L.Utorage.Map', function(){
});
it('should have added dirty class on map container', function () {
assert.ok(L.DomUtil.hasClass(this.map._container, 'storage-is-dirty'));
assert.ok(L.DomUtil.hasClass(this.map._container, 'umap-is-dirty'));
});
});
@ -105,7 +105,7 @@ describe('L.Utorage.Map', function(){
var button = qs('a.update-map-settings');
assert.ok(button, 'update map info button exists');
happen.click(button);
var deleteLink = qs('a.storage-delete');
var deleteLink = qs('a.umap-delete');
assert.ok(deleteLink, 'delete map button exists');
sinon.spy(window, 'confirm');
this.server.respondWith('POST', path, JSON.stringify({redirect: '#'}));
@ -123,11 +123,11 @@ describe('L.Utorage.Map', function(){
it('should build a form on click', function () {
happen.click(qs('a.upload-data'));
fileInput = qs('.storage-upload input[type="file"]');
textarea = qs('.storage-upload textarea');
submit = qs('.storage-upload input[type="button"]');
formatSelect = qs('.storage-upload select[name="format"]');
layerSelect = qs('.storage-upload select[name="datalayer"]');
fileInput = qs('.umap-upload input[type="file"]');
textarea = qs('.umap-upload textarea');
submit = qs('.umap-upload input[type="button"]');
formatSelect = qs('.umap-upload select[name="format"]');
layerSelect = qs('.umap-upload select[name="datalayer"]');
assert.ok(fileInput);
assert.ok(submit);
assert.ok(textarea);
@ -147,9 +147,9 @@ describe('L.Utorage.Map', function(){
it('should import kml from textarea', function () {
this.datalayer.empty()
happen.click(qs('a.upload-data'));
textarea = qs('.storage-upload textarea');
submit = qs('.storage-upload input[type="button"]');
formatSelect = qs('.storage-upload select[name="format"]');
textarea = qs('.umap-upload textarea');
submit = qs('.umap-upload input[type="button"]');
formatSelect = qs('.umap-upload select[name="format"]');
assert.equal(this.datalayer._index.length, 0);
textarea.value = kml_example;
changeSelectValue(formatSelect, 'kml');
@ -160,9 +160,9 @@ describe('L.Utorage.Map', function(){
it('should import gpx from textarea', function () {
this.datalayer.empty()
happen.click(qs('a.upload-data'));
textarea = qs('.storage-upload textarea');
submit = qs('.storage-upload input[type="button"]');
formatSelect = qs('.storage-upload select[name="format"]');
textarea = qs('.umap-upload textarea');
submit = qs('.umap-upload input[type="button"]');
formatSelect = qs('.umap-upload select[name="format"]');
assert.equal(this.datalayer._index.length, 0);
textarea.value = gpx_example;
changeSelectValue(formatSelect, 'gpx');
@ -173,9 +173,9 @@ describe('L.Utorage.Map', function(){
it('should import csv from textarea', function () {
this.datalayer.empty()
happen.click(qs('a.upload-data'));
textarea = qs('.storage-upload textarea');
submit = qs('.storage-upload input[type="button"]');
formatSelect = qs('.storage-upload select[name="format"]');
textarea = qs('.umap-upload textarea');
submit = qs('.umap-upload input[type="button"]');
formatSelect = qs('.umap-upload select[name="format"]');
assert.equal(this.datalayer._index.length, 0);
textarea.value = csv_example;
changeSelectValue(formatSelect, 'csv');
@ -185,10 +185,10 @@ describe('L.Utorage.Map', function(){
it('should replace content if asked so', function () {
happen.click(qs('a.upload-data'));
textarea = qs('.storage-upload textarea');
submit = qs('.storage-upload input[type="button"]');
formatSelect = qs('.storage-upload select[name="format"]');
clearFlag = qs('.storage-upload input[name="clear"]');
textarea = qs('.umap-upload textarea');
submit = qs('.umap-upload input[type="button"]');
formatSelect = qs('.umap-upload select[name="format"]');
clearFlag = qs('.umap-upload input[name="clear"]');
clearFlag.checked = true;
assert.equal(this.datalayer._index.length, 1);
textarea.value = csv_example;
@ -201,7 +201,7 @@ describe('L.Utorage.Map', function(){
it('should import GeometryCollection from textarea', function () {
this.datalayer.empty()
textarea.value = '{"type": "GeometryCollection","geometries": [{"type": "Point","coordinates": [-80.66080570220947,35.04939206472683]},{"type": "Polygon","coordinates": [[[-80.66458225250244,35.04496519190309],[-80.66344499588013,35.04603679820616],[-80.66258668899536,35.045580049697556],[-80.66387414932251,35.044280059194946],[-80.66458225250244,35.04496519190309]]]},{"type": "LineString","coordinates": [[-80.66237211227417,35.05950973022538],[-80.66269397735596,35.0592638296087],[-80.66284418106079,35.05893010615862],[-80.66308021545409,35.05833291342246],[-80.66359519958496,35.057753281001425],[-80.66387414932251,35.05740198662245],[-80.66441059112549,35.05703312589789],[-80.66486120223999,35.056787217822475],[-80.66541910171509,35.05650617911516],[-80.66563367843628,35.05631296444281],[-80.66601991653441,35.055891403570705],[-80.66619157791138,35.05545227534804],[-80.66619157791138,35.05517123204622],[-80.66625595092773,35.05489018777713],[-80.6662130355835,35.054222703761525],[-80.6662130355835,35.05392409072499],[-80.66595554351807,35.05290528508858],[-80.66569805145262,35.052044560077285],[-80.66550493240356,35.0514824490509],[-80.665762424469,35.05048117920187],[-80.66617012023926,35.04972582715769],[-80.66651344299316,35.049286665781096],[-80.66692113876343,35.0485313026898],[-80.66700696945189,35.048215102112344],[-80.66707134246826,35.04777593261294],[-80.66704988479614,35.04738946150025],[-80.66696405410767,35.04698542156371],[-80.66681385040283,35.046353007216055],[-80.66659927368164,35.04596652937105],[-80.66640615463257,35.04561518428889],[-80.6659984588623,35.045193568195565],[-80.66552639007568,35.044877354697526],[-80.6649899482727,35.04454357245502],[-80.66449642181396,35.04417465365292],[-80.66385269165039,35.04387600387859],[-80.66303730010986,35.043717894732545]]}]}';
formatSelect = qs('.storage-upload select[name="format"]');
formatSelect = qs('.umap-upload select[name="format"]');
changeSelectValue(formatSelect, 'geojson');
happen.click(submit);
assert.equal(this.datalayer._index.length, 3);
@ -234,11 +234,11 @@ describe('L.Utorage.Map', function(){
this.map.save = function(){};
happen.click(qs('a.upload-data'));
var initialLayerCount = Object.keys(this.map.datalayers).length;
formatSelect = qs('.storage-upload select[name="format"]');
textarea = qs('.storage-upload textarea');
textarea.value = '{ "type": "umap", "geometry": { "type": "Point", "coordinates": [3.0528, 50.6269] }, "properties": { "storage_id": 666, "longCredit": "the illustrious mapmaker", "shortCredit": "the mapmaker", "slideshow": {}, "captionBar": true, "dashArray": "5,5", "fillOpacity": "0.5", "fillColor": "Crimson", "fill": true, "weight": "2", "opacity": "0.9", "smoothFactor": "1", "iconClass": "Drop", "color": "Red", "limitBounds": {}, "tilelayer": { "maxZoom": 18, "url_template": "http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg", "minZoom": 0, "attribution": "Map tiles by [[http://stamen.com|Stamen Design]], under [[http://creativecommons.org/licenses/by/3.0|CC BY 3.0]]. Data by [[http://openstreetmap.org|OpenStreetMap]], under [[http://creativecommons.org/licenses/by-sa/3.0|CC BY SA]].", "name": "Watercolor" }, "licence": { "url": "", "name": "No licence set" }, "description": "Map description", "name": "Imported map", "tilelayersControl": true, "onLoadPanel": "caption", "displayPopupFooter": true, "miniMap": true, "moreControl": true, "scaleControl": true, "zoomControl": true, "scrollWheelZoom": true, "datalayersControl": true, "zoom": 6 }, "layers": [{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [4.2939, 50.8893], [4.2441, 50.8196], [4.3869, 50.7642], [4.4813, 50.7929], [4.413, 50.9119], [4.2939, 50.8893] ] ] }, "properties": { "name": "Bruxelles", "description": "polygon" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [3.0528, 50.6269] }, "properties": { "_storage_options": { "color": "Orange" }, "name": "Lille", "description": "une ville" } }], "_storage": { "displayOnLoad": true, "name": "Cities", "id": 108, "remoteData": {}, "description": "A layer with some cities", "color": "Navy", "iconClass": "Drop", "smoothFactor": "1", "dashArray": "5,1", "fillOpacity": "0.5", "fillColor": "Blue", "fill": true } }, { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [1.7715, 50.9255], [1.6589, 50.9696], [1.4941, 51.0128], [1.4199, 51.0638], [1.2881, 51.1104] ] }, "properties": { "_storage_options": { "weight": "4" }, "name": "tunnel sous la Manche" } }], "_storage": { "displayOnLoad": true, "name": "Tunnels", "id": 109, "remoteData": {} } }]}';
formatSelect = qs('.umap-upload select[name="format"]');
textarea = qs('.umap-upload textarea');
textarea.value = '{ "type": "umap", "geometry": { "type": "Point", "coordinates": [3.0528, 50.6269] }, "properties": { "umap_id": 666, "longCredit": "the illustrious mapmaker", "shortCredit": "the mapmaker", "slideshow": {}, "captionBar": true, "dashArray": "5,5", "fillOpacity": "0.5", "fillColor": "Crimson", "fill": true, "weight": "2", "opacity": "0.9", "smoothFactor": "1", "iconClass": "Drop", "color": "Red", "limitBounds": {}, "tilelayer": { "maxZoom": 18, "url_template": "http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg", "minZoom": 0, "attribution": "Map tiles by [[http://stamen.com|Stamen Design]], under [[http://creativecommons.org/licenses/by/3.0|CC BY 3.0]]. Data by [[http://openstreetmap.org|OpenStreetMap]], under [[http://creativecommons.org/licenses/by-sa/3.0|CC BY SA]].", "name": "Watercolor" }, "licence": { "url": "", "name": "No licence set" }, "description": "Map description", "name": "Imported map", "tilelayersControl": true, "onLoadPanel": "caption", "displayPopupFooter": true, "miniMap": true, "moreControl": true, "scaleControl": true, "zoomControl": true, "scrollWheelZoom": true, "datalayersControl": true, "zoom": 6 }, "layers": [{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [4.2939, 50.8893], [4.2441, 50.8196], [4.3869, 50.7642], [4.4813, 50.7929], [4.413, 50.9119], [4.2939, 50.8893] ] ] }, "properties": { "name": "Bruxelles", "description": "polygon" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [3.0528, 50.6269] }, "properties": { "_umap_options": { "color": "Orange" }, "name": "Lille", "description": "une ville" } }], "_umap_options": { "displayOnLoad": true, "name": "Cities", "id": 108, "remoteData": {}, "description": "A layer with some cities", "color": "Navy", "iconClass": "Drop", "smoothFactor": "1", "dashArray": "5,1", "fillOpacity": "0.5", "fillColor": "Blue", "fill": true } }, { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [1.7715, 50.9255], [1.6589, 50.9696], [1.4941, 51.0128], [1.4199, 51.0638], [1.2881, 51.1104] ] }, "properties": { "_umap_options": { "weight": "4" }, "name": "tunnel sous la Manche" } }], "_umap_options": { "displayOnLoad": true, "name": "Tunnels", "id": 109, "remoteData": {} } }]}';
formatSelect.value = 'umap';
submit = qs('.storage-upload input[type="button"]');
submit = qs('.umap-upload input[type="button"]');
happen.click(submit);
assert.equal(Object.keys(this.map.datalayers).length, initialLayerCount + 2);
assert.equal(this.map.options.name, "Imported map");
@ -261,11 +261,11 @@ describe('L.Utorage.Map', function(){
});
it('should only import options on the whitelist (umap format import)', function () {
assert.equal(this.map.options.storage_id, 99);
assert.equal(this.map.options.umap_id, 99);
});
it('should update title bar (umap format import)', function () {
var title = qs("#map div.storage-main-edit-toolbox h3 a.storage-click-to-edit");
var title = qs("#map div.umap-main-edit-toolbox h3 a.umap-click-to-edit");
assert.equal(title.innerHTML, "Imported map");
});
@ -276,7 +276,7 @@ describe('L.Utorage.Map', function(){
it('should update the tilelayer switcher control (umap format import)', function () {
//The tilelayer in the imported data isn't in the tilelayer list (set in _pre.js), there should be no selection on the tilelayer switcher
var selectedLayer = qs(".storage-tilelayer-switcher-container li.selected");
var selectedLayer = qs(".umap-tilelayer-switcher-container li.selected");
assert.equal(selectedLayer, null);
});

View file

@ -2,7 +2,7 @@ describe('L.Utorage.Polygon', function () {
var p2ll, map;
before(function () {
this.map = map = initMap({storage_id: 99});
this.map = map = initMap({umap_id: 99});
enableEdit();
p2ll = function (x, y) {
return map.containerPointToLatLng([x, y]);
@ -175,20 +175,20 @@ describe('L.Utorage.Polygon', function () {
describe('#addShape', function () {
it('"add shape" control should not be visible by default', function () {
assert.notOk(qs('.storage-draw-polygon-multi'));
assert.notOk(qs('.umap-draw-polygon-multi'));
});
it('"add shape" control should be visible when editing a Polygon', function () {
var layer = new L.U.Polygon(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
layer.edit();
assert.ok(qs('.storage-draw-polygon-multi'));
assert.ok(qs('.umap-draw-polygon-multi'));
});
it('"add shape" control should extend the same multi', function () {
var layer = new L.U.Polygon(this.map, [p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)], {datalayer: this.datalayer}).addTo(this.datalayer);
layer.edit();
assert.notOk(layer.isMulti());
happen.click(qs('.storage-draw-polygon-multi'));
happen.click(qs('.umap-draw-polygon-multi'));
happen.at('mousedown', 300, 300);
happen.at('mouseup', 300, 300);
happen.at('mousedown', 350, 300);

View file

@ -2,7 +2,7 @@ describe('L.Utorage.Polyline', function () {
var p2ll, map;
before(function () {
this.map = map = initMap({storage_id: 99});
this.map = map = initMap({umap_id: 99});
enableEdit();
p2ll = function (x, y) {
return map.containerPointToLatLng([x, y]);
@ -191,20 +191,20 @@ describe('L.Utorage.Polyline', function () {
describe('#addShape', function () {
it('"add shape" control should not be visible by default', function () {
assert.notOk(qs('.storage-draw-polyline-multi'));
assert.notOk(qs('.umap-draw-polyline-multi'));
});
it('"add shape" control should be visible when editing a Polyline', function () {
var layer = new L.U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
layer.edit();
assert.ok(qs('.storage-draw-polyline-multi'));
assert.ok(qs('.umap-draw-polyline-multi'));
});
it('"add shape" control should extend the same multi', function () {
var layer = new L.U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {datalayer: this.datalayer}).addTo(this.datalayer);
layer.edit();
assert.notOk(layer.isMulti());
happen.click(qs('.storage-draw-polyline-multi'));
happen.click(qs('.umap-draw-polyline-multi'));
happen.at('mousemove', 300, 300);
happen.at('click', 300, 300);
happen.at('mousemove', 350, 300);

View file

@ -4,8 +4,8 @@ describe('L.TableEditor', function () {
before(function () {
this.server = sinon.fakeServer.create();
this.server.respondWith('GET', '/datalayer/62/', JSON.stringify(RESPONSES.datalayer62_GET));
this.map = initMap({storage_id: 99});
this.datalayer = this.map.getDataLayerByStorageId(62);
this.map = initMap({umap_id: 99});
this.datalayer = this.map.getDataLayerByUmapId(62);
this.server.respond();
enableEdit();
});
@ -25,9 +25,9 @@ describe('L.TableEditor', function () {
it('should open table button click', function () {
happen.click(button);
expect(qs('#storage-ui-container div.table')).to.be.ok;
expect(qsa('#storage-ui-container div.table form').length).to.eql(3); // One per feature.
expect(qsa('#storage-ui-container div.table input').length).to.eql(3); // One per feature and per property.
expect(qs('#umap-ui-container div.table')).to.be.ok;
expect(qsa('#umap-ui-container div.table form').length).to.eql(3); // One per feature.
expect(qsa('#umap-ui-container div.table input').length).to.eql(3); // One per feature and per property.
});
});
@ -45,15 +45,15 @@ describe('L.TableEditor', function () {
};
var oldPrompt = window.prompt;
window.prompt = newPrompt;
var button = qs('#storage-ui-container .add-property');
var button = qs('#umap-ui-container .add-property');
expect(button).to.be.ok;
happen.click(button);
expect(qsa('#storage-ui-container div.table input').length).to.eql(6); // One per feature and per property.
expect(qsa('#umap-ui-container div.table input').length).to.eql(6); // One per feature and per property.
window.prompt = oldPrompt;
});
it('should populate feature property on fill', function () {
var input = qs('form#storage-feature-properties_' + L.stamp(feature) + ' input[name=newprop]');
var input = qs('form#umap-feature-properties_' + L.stamp(feature) + ' input[name=newprop]');
changeInputValue(input, 'the value');
expect(feature.properties.newprop).to.eql('the value');
});
@ -64,10 +64,10 @@ describe('L.TableEditor', function () {
};
var oldPrompt = window.prompt;
window.prompt = newPrompt;
var button = qs('#storage-ui-container div.thead div.tcell:last-of-type .storage-edit');
var button = qs('#umap-ui-container div.thead div.tcell:last-of-type .umap-edit');
expect(button).to.be.ok;
happen.click(button);
expect(qsa('#storage-ui-container div.table input').length).to.eql(6);
expect(qsa('#umap-ui-container div.table input').length).to.eql(6);
expect(feature.properties.newprop).to.be.undefined;
expect(feature.properties.newname).to.eql('the value');
window.prompt = oldPrompt;
@ -80,11 +80,11 @@ describe('L.TableEditor', function () {
};
oldConfirm = window.confirm;
window.confirm = newConfirm;
var button = qs('#storage-ui-container div.thead div.tcell:last-of-type .storage-delete');
var button = qs('#umap-ui-container div.thead div.tcell:last-of-type .umap-delete');
expect(button).to.be.ok;
happen.click(button);
FEATURE = feature;
expect(qsa('#storage-ui-container div.table input').length).to.eql(3);
expect(qsa('#umap-ui-container div.table input').length).to.eql(3);
expect(feature.properties.newname).to.be.undefined;
window.confirm = oldConfirm;
});

View file

@ -59,8 +59,8 @@ var changeSelectValue = function (path_or_select, value) {
return path_or_select;
}
var cleanAlert = function () {
L.DomUtil.removeClass(qs('#map'), 'storage-alert');
L.DomUtil.get('storage-alert-container').innerHTML = '';
L.DomUtil.removeClass(qs('#map'), 'umap-alert');
L.DomUtil.get('umap-alert-container').innerHTML = '';
UI_ALERT_ID = null; // Prevent setTimeout to be called
};
var defaultDatalayerData = function (custom) {
@ -91,7 +91,7 @@ function initMap (options) {
},
"type": "Feature",
"properties": {
"storage_id": 42,
"umap_id": 42,
"datalayers": [],
"urls": {
"map": "/map/{slug}_{pk}",
@ -184,7 +184,7 @@ var RESPONSES = {
'datalayer62_GET': {
"crs": null,
"type": "FeatureCollection",
"_storage": defaultDatalayerData(),
"_umap_options": defaultDatalayerData(),
"features": [{
"geometry": {
"type": "Point",
@ -192,7 +192,7 @@ var RESPONSES = {
},
"type": "Feature",
"id": 1807,
"properties": {_storage_options: {color: "OliveDrab"}, name: "test"}
"properties": {_umap_options: {color: "OliveDrab"}, name: "test"}
},
{
"geometry": {
@ -200,7 +200,7 @@ var RESPONSES = {
"coordinates": [[-0.5712890625, 54.47642158429295], [0.439453125, 54.610254981579146], [1.724853515625, 53.44880683542759], [4.163818359375, 53.98839506479995], [5.306396484375, 53.533778184257805], [6.591796875, 53.70971358510174], [7.042236328124999, 53.35055131839989]]
},
"type": "Feature",
"id": 20, "properties": {"_storage_options": {"fill": false}, "name": "test"}
"id": 20, "properties": {"_umap_options": {"fill": false}, "name": "test"}
},
{
"geometry": {

View file

@ -192,19 +192,19 @@ input:-moz-placeholder, :-moz-placeholder {
color: #a5a5a5;
}
#storage-ui-container textarea {
#umap-ui-container textarea {
height: 100px;
margin-bottom: 14px;
}
#storage-ui-container select {
#umap-ui-container select {
margin-bottom: 10px;
}
#storage-ui-container.warning .button {
#umap-ui-container.warning .button {
background-color: #c60f13;
border: 1px solid #7f0a0c;
}
#storage-ui-container.warning .button:hover {
#umap-ui-container.warning .button:hover {
background-color: #970b0e;
}
@ -479,7 +479,7 @@ ul.umap-autocomplete {
/* **************************** */
/* Override Leaflet.Storage */
/* **************************** */
body.content #storage-ui-container {
body.content #umap-ui-container {
/* width: 100%;
top: 0;
right: 0;
@ -491,7 +491,7 @@ body.content #storage-ui-container {
#id_editors + br + span.helptext {
display: none;
}
.storage-loader {
.umap-loader {
background-color: #79c1c0 !important;
}
.leaflet-container a.button {

View file

@ -42,12 +42,12 @@ def map_fragment(map_instance, **kwargs):
'hash': False,
'attributionControl': False,
'scrollWheelZoom': False,
'storageAttributionControl': False,
'umapAttributionControl': False,
'noControl': True,
'storage_id': map_instance.pk,
'umap_id': map_instance.pk,
'onLoadPanel': "none",
'captionBar': False,
'default_iconUrl': "%sstorage/src/img/marker.png" % settings.STATIC_URL,
'default_iconUrl': "%sumap/img/marker.png" % settings.STATIC_URL,
'slideshow': {}
})
map_settings['properties'].update(kwargs)

View file

@ -81,7 +81,7 @@ class DataLayerFactory(factory.DjangoModelFactory):
name = "test datalayer"
description = "test description"
display_on_load = True
geojson = factory.django.FileField(data="""{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[13.68896484375,48.55297816440071]},"properties":{"_storage_options":{"color":"DarkCyan","iconClass":"Ball"},"name":"Here","description":"Da place anonymous again 755"}}],"_storage":{"displayOnLoad":true,"name":"Donau","id":926}}""") # noqa
geojson = factory.django.FileField(data="""{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[13.68896484375,48.55297816440071]},"properties":{"_umap_options":{"color":"DarkCyan","iconClass":"Ball"},"name":"Here","description":"Da place anonymous again 755"}}],"_umap_options":{"displayOnLoad":true,"name":"Donau","id":926}}""") # noqa
class Meta:
model = DataLayer

View file

@ -17,7 +17,7 @@ def post_data():
"name": 'name',
"display_on_load": True,
"rank": 0,
"geojson": '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-3.1640625,53.014783245859235],[-3.1640625,51.86292391360244],[-0.50537109375,51.385495069223204],[1.16455078125,52.38901106223456],[-0.41748046875,53.91728101547621],[-2.109375,53.85252660044951],[-3.1640625,53.014783245859235]]]},"properties":{"_storage_options":{},"name":"Ho god, sounds like a polygouine"}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[1.8017578124999998,51.16556659836182],[-0.48339843749999994,49.710272582105695],[-3.1640625,50.0923932109388],[-5.60302734375,51.998410382390325]]},"properties":{"_storage_options":{},"name":"Light line"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[0.63720703125,51.15178610143037]},"properties":{"_storage_options":{},"name":"marker he"}}],"_storage":{"displayOnLoad":true,"name":"new name","id":1668,"remoteData":{},"color":"LightSeaGreen","description":"test"}}' # noqa
"geojson": '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-3.1640625,53.014783245859235],[-3.1640625,51.86292391360244],[-0.50537109375,51.385495069223204],[1.16455078125,52.38901106223456],[-0.41748046875,53.91728101547621],[-2.109375,53.85252660044951],[-3.1640625,53.014783245859235]]]},"properties":{"_umap_options":{},"name":"Ho god, sounds like a polygouine"}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[1.8017578124999998,51.16556659836182],[-0.48339843749999994,49.710272582105695],[-3.1640625,50.0923932109388],[-5.60302734375,51.998410382390325]]},"properties":{"_umap_options":{},"name":"Light line"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[0.63720703125,51.15178610143037]},"properties":{"_umap_options":{},"name":"marker he"}}],"_umap_options":{"displayOnLoad":true,"name":"new name","id":1668,"remoteData":{},"color":"LightSeaGreen","description":"test"}}' # noqa
}
@ -30,7 +30,7 @@ def test_get(client, settings, datalayer):
assert response['Cache-Control'] is not None
assert 'Content-Encoding' not in response
j = json.loads(response.content.decode())
assert '_storage' in j
assert '_umap_options' in j
assert 'features' in j
assert j['type'] == 'FeatureCollection'

View file

@ -356,7 +356,7 @@ class MapDetailMixin(object):
'tilelayers': self.get_tilelayers(),
'allowEdit': self.is_edit_allowed(),
'default_iconUrl': "%sumap/img/marker.png" % settings.STATIC_URL, # noqa
'storage_id': self.get_storage_id(),
'umap_id': self.get_umap_id(),
'licences': dict((l.name, l.json) for l in Licence.objects.all()),
}
if self.get_short_url():
@ -388,7 +388,7 @@ class MapDetailMixin(object):
def is_edit_allowed(self):
return True
def get_storage_id(self):
def get_umap_id(self):
return None
def get_geojson(self):
@ -433,7 +433,7 @@ class MapView(MapDetailMixin, DetailView):
def is_edit_allowed(self):
return self.object.can_edit(self.request.user, self.request)
def get_storage_id(self):
def get_umap_id(self):
return self.object.pk
def get_short_url(self):