umap-project 2.5.1__py3-none-any.whl → 2.6.0b0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/admin.py +6 -1
- umap/context_processors.py +2 -1
- umap/decorators.py +13 -2
- umap/forms.py +26 -2
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +252 -146
- umap/locale/ca/LC_MESSAGES/django.mo +0 -0
- umap/locale/ca/LC_MESSAGES/django.po +274 -162
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +261 -150
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +299 -187
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +215 -159
- umap/locale/en/LC_MESSAGES/django.po +211 -155
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +255 -144
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +254 -198
- umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- umap/locale/fa_IR/LC_MESSAGES/django.po +346 -234
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +216 -160
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +215 -159
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +252 -146
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +252 -146
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +254 -148
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +215 -159
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +254 -143
- umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
- umap/locale/th_TH/LC_MESSAGES/django.po +125 -70
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +256 -145
- umap/migrations/0022_add_team.py +94 -0
- umap/models.py +45 -10
- umap/settings/__init__.py +2 -0
- umap/settings/base.py +3 -2
- umap/static/umap/base.css +32 -41
- umap/static/umap/content.css +19 -25
- umap/static/umap/css/icon.css +63 -37
- umap/static/umap/css/importers.css +1 -1
- umap/static/umap/css/slideshow.css +7 -5
- umap/static/umap/css/tableeditor.css +4 -3
- umap/static/umap/img/16-white.svg +1 -4
- umap/static/umap/img/16.svg +2 -6
- umap/static/umap/img/24-white.svg +4 -4
- umap/static/umap/img/24.svg +6 -6
- umap/static/umap/img/source/16-white.svg +2 -5
- umap/static/umap/img/source/16.svg +3 -7
- umap/static/umap/img/source/24-white.svg +7 -14
- umap/static/umap/img/source/24.svg +10 -17
- umap/static/umap/js/components/alerts/alert.css +20 -8
- umap/static/umap/js/modules/autocomplete.js +3 -3
- umap/static/umap/js/modules/browser.js +4 -3
- umap/static/umap/js/modules/caption.js +9 -11
- umap/static/umap/js/modules/data/features.js +994 -0
- umap/static/umap/js/modules/data/layer.js +1210 -0
- umap/static/umap/js/modules/formatter.js +12 -3
- umap/static/umap/js/modules/global.js +21 -5
- umap/static/umap/js/modules/permissions.js +280 -0
- umap/static/umap/js/{umap.icon.js → modules/rendering/icon.js} +77 -56
- umap/static/umap/js/modules/rendering/layers/base.js +105 -0
- umap/static/umap/js/modules/rendering/layers/classified.js +484 -0
- umap/static/umap/js/modules/rendering/layers/cluster.js +103 -0
- umap/static/umap/js/modules/rendering/layers/heat.js +182 -0
- umap/static/umap/js/modules/rendering/popup.js +99 -0
- umap/static/umap/js/modules/rendering/template.js +217 -0
- umap/static/umap/js/modules/rendering/ui.js +573 -0
- umap/static/umap/js/modules/schema.js +24 -0
- umap/static/umap/js/modules/share.js +66 -45
- umap/static/umap/js/modules/sync/updaters.js +9 -10
- umap/static/umap/js/modules/tableeditor.js +7 -7
- umap/static/umap/js/modules/ui/dialog.js +8 -4
- umap/static/umap/js/modules/utils.js +22 -13
- umap/static/umap/js/umap.controls.js +79 -146
- umap/static/umap/js/umap.core.js +9 -9
- umap/static/umap/js/umap.forms.js +32 -12
- umap/static/umap/js/umap.js +65 -63
- umap/static/umap/locale/br.js +35 -35
- umap/static/umap/locale/br.json +35 -35
- umap/static/umap/locale/ca.js +50 -50
- umap/static/umap/locale/ca.json +50 -50
- umap/static/umap/locale/de.js +136 -136
- umap/static/umap/locale/de.json +136 -136
- umap/static/umap/locale/el.js +47 -47
- umap/static/umap/locale/el.json +47 -47
- umap/static/umap/locale/en.js +7 -1
- umap/static/umap/locale/en.json +7 -1
- umap/static/umap/locale/fa_IR.js +44 -44
- umap/static/umap/locale/fa_IR.json +44 -44
- umap/static/umap/locale/fr.js +8 -2
- umap/static/umap/locale/fr.json +8 -2
- umap/static/umap/locale/pt.js +17 -17
- umap/static/umap/locale/pt.json +17 -17
- umap/static/umap/locale/pt_PT.js +207 -207
- umap/static/umap/locale/pt_PT.json +207 -207
- umap/static/umap/locale/th_TH.js +25 -25
- umap/static/umap/locale/th_TH.json +25 -25
- umap/static/umap/map.css +107 -104
- umap/static/umap/nav.css +19 -10
- umap/static/umap/unittests/utils.js +230 -107
- umap/static/umap/vendors/csv2geojson/csv2geojson.js +62 -40
- umap/static/umap/vendors/markercluster/MarkerCluster.Default.css +1 -1
- umap/storage.py +1 -0
- umap/templates/404.html +5 -1
- umap/templates/500.html +3 -1
- umap/templates/auth/user_detail.html +8 -2
- umap/templates/auth/user_form.html +19 -10
- umap/templates/auth/user_stars.html +8 -2
- umap/templates/base.html +1 -0
- umap/templates/registration/login.html +18 -3
- umap/templates/umap/about.html +1 -0
- umap/templates/umap/about_summary.html +22 -7
- umap/templates/umap/components/alerts/alert.html +42 -21
- umap/templates/umap/content.html +2 -0
- umap/templates/umap/content_footer.html +6 -2
- umap/templates/umap/css.html +1 -0
- umap/templates/umap/dashboard_menu.html +15 -0
- umap/templates/umap/home.html +14 -4
- umap/templates/umap/js.html +4 -9
- umap/templates/umap/login_popup_end.html +10 -4
- umap/templates/umap/map_detail.html +8 -2
- umap/templates/umap/map_fragment.html +3 -1
- umap/templates/umap/map_init.html +2 -1
- umap/templates/umap/map_list.html +4 -3
- umap/templates/umap/map_table.html +36 -12
- umap/templates/umap/messages.html +0 -1
- umap/templates/umap/navigation.html +2 -1
- umap/templates/umap/password_change.html +5 -1
- umap/templates/umap/password_change_done.html +8 -2
- umap/templates/umap/search.html +8 -2
- umap/templates/umap/search_bar.html +1 -0
- umap/templates/umap/team_confirm_delete.html +19 -0
- umap/templates/umap/team_detail.html +27 -0
- umap/templates/umap/team_form.html +60 -0
- umap/templates/umap/user_dashboard.html +7 -9
- umap/templates/umap/user_teams.html +51 -0
- umap/tests/base.py +8 -1
- umap/tests/conftest.py +6 -0
- umap/tests/fixtures/test_circles_layer.geojson +219 -0
- umap/tests/fixtures/test_upload_georss.xml +20 -0
- umap/tests/integration/conftest.py +18 -4
- umap/tests/integration/helpers.py +12 -0
- umap/tests/integration/test_anonymous_owned_map.py +23 -0
- umap/tests/integration/test_basics.py +29 -0
- umap/tests/integration/test_caption.py +20 -0
- umap/tests/integration/test_circles_layer.py +69 -0
- umap/tests/integration/test_draw_polygon.py +110 -13
- umap/tests/integration/test_draw_polyline.py +8 -18
- umap/tests/integration/test_edit_datalayer.py +1 -1
- umap/tests/integration/test_import.py +64 -5
- umap/tests/integration/test_owned_map.py +21 -13
- umap/tests/integration/test_team.py +47 -0
- umap/tests/integration/test_tilelayer.py +19 -2
- umap/tests/integration/test_view_marker.py +28 -1
- umap/tests/integration/test_websocket_sync.py +5 -5
- umap/tests/test_datalayer.py +32 -7
- umap/tests/test_datalayer_views.py +1 -1
- umap/tests/test_map.py +30 -4
- umap/tests/test_map_views.py +2 -2
- umap/tests/test_statics.py +40 -0
- umap/tests/test_team_views.py +131 -0
- umap/tests/test_views.py +15 -1
- umap/urls.py +23 -13
- umap/views.py +116 -10
- {umap_project-2.5.1.dist-info → umap_project-2.6.0b0.dist-info}/METADATA +9 -9
- {umap_project-2.5.1.dist-info → umap_project-2.6.0b0.dist-info}/RECORD +177 -170
- umap/static/umap/js/umap.datalayer.permissions.js +0 -70
- umap/static/umap/js/umap.features.js +0 -1290
- umap/static/umap/js/umap.layer.js +0 -1837
- umap/static/umap/js/umap.permissions.js +0 -208
- umap/static/umap/js/umap.popup.js +0 -341
- umap/static/umap/test/TableEditor.js +0 -104
- umap/static/umap/vendors/leaflet/leaflet-src.js +0 -14512
- umap/static/umap/vendors/leaflet/leaflet-src.js.map +0 -1
- umap/static/umap/vendors/leaflet/leaflet.js +0 -6
- umap/static/umap/vendors/leaflet/leaflet.js.map +0 -1
- umap/static/umap/vendors/markercluster/WhereAreTheJavascriptFiles.txt +0 -5
- umap/static/umap/vendors/markercluster/leaflet.markercluster-src.js +0 -2718
- umap/static/umap/vendors/markercluster/leaflet.markercluster-src.js.map +0 -1
- umap/static/umap/vendors/toolbar/leaflet.toolbar-src.css +0 -117
- umap/static/umap/vendors/toolbar/leaflet.toolbar-src.js +0 -365
- umap/tests/integration/test_statics.py +0 -47
- {umap_project-2.5.1.dist-info → umap_project-2.6.0b0.dist-info}/WHEEL +0 -0
- {umap_project-2.5.1.dist-info → umap_project-2.6.0b0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.5.1.dist-info → umap_project-2.6.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
(function(window, document, undefined) {
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
L.Toolbar = (L.Layer || L.Class).extend({
|
|
6
|
-
statics: {
|
|
7
|
-
baseClass: 'leaflet-toolbar'
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
includes: L.Mixin.Events,
|
|
11
|
-
|
|
12
|
-
options: {
|
|
13
|
-
className: '',
|
|
14
|
-
filter: function() { return true; },
|
|
15
|
-
actions: []
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
initialize: function(options) {
|
|
19
|
-
L.setOptions(this, options);
|
|
20
|
-
this._toolbar_type = this.constructor._toolbar_class_id;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
addTo: function(map) {
|
|
24
|
-
this._arguments = [].slice.call(arguments);
|
|
25
|
-
|
|
26
|
-
map.addLayer(this);
|
|
27
|
-
|
|
28
|
-
return this;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
onAdd: function(map) {
|
|
32
|
-
var currentToolbar = map._toolbars[this._toolbar_type];
|
|
33
|
-
|
|
34
|
-
if (this._calculateDepth() === 0) {
|
|
35
|
-
if (currentToolbar) { map.removeLayer(currentToolbar); }
|
|
36
|
-
map._toolbars[this._toolbar_type] = this;
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
onRemove: function(map) {
|
|
41
|
-
/*
|
|
42
|
-
* TODO: Cleanup event listeners.
|
|
43
|
-
* For some reason, this throws:
|
|
44
|
-
* "Uncaught TypeError: Cannot read property 'dragging' of null"
|
|
45
|
-
* on this._marker when a toolbar icon is clicked.
|
|
46
|
-
*/
|
|
47
|
-
// for (var i = 0, l = this._disabledEvents.length; i < l; i++) {
|
|
48
|
-
// L.DomEvent.off(this._ul, this._disabledEvents[i], L.DomEvent.stopPropagation);
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
if (this._calculateDepth() === 0) {
|
|
52
|
-
delete map._toolbars[this._toolbar_type];
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
appendToContainer: function(container) {
|
|
57
|
-
var baseClass = this.constructor.baseClass + '-' + this._calculateDepth(),
|
|
58
|
-
className = baseClass + ' ' + this.options.className,
|
|
59
|
-
Action, action,
|
|
60
|
-
i, j, l, m;
|
|
61
|
-
|
|
62
|
-
this._container = container;
|
|
63
|
-
this._ul = L.DomUtil.create('ul', className, container);
|
|
64
|
-
|
|
65
|
-
/* Ensure that clicks, drags, etc. don't bubble up to the map. */
|
|
66
|
-
this._disabledEvents = ['click', 'mousemove', 'dblclick'];
|
|
67
|
-
|
|
68
|
-
for (j = 0, m = this._disabledEvents.length; j < m; j++) {
|
|
69
|
-
L.DomEvent.on(this._ul, this._disabledEvents[j], L.DomEvent.stopPropagation);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/* Instantiate each toolbar action and add its corresponding toolbar icon. */
|
|
73
|
-
for (i = 0, l = this.options.actions.length; i < l; i++) {
|
|
74
|
-
Action = this._getActionConstructor(this.options.actions[i]);
|
|
75
|
-
|
|
76
|
-
action = new Action();
|
|
77
|
-
action._createIcon(this, this._ul, this._arguments);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
_getActionConstructor: function(Action) {
|
|
82
|
-
var args = this._arguments,
|
|
83
|
-
toolbar = this;
|
|
84
|
-
|
|
85
|
-
return Action.extend({
|
|
86
|
-
initialize: function() {
|
|
87
|
-
Action.prototype.initialize.apply(this, args);
|
|
88
|
-
},
|
|
89
|
-
enable: function(e) {
|
|
90
|
-
/* Ensure that only one action in a toolbar will be active at a time. */
|
|
91
|
-
if (toolbar._active) { toolbar._active.disable(); }
|
|
92
|
-
toolbar._active = this;
|
|
93
|
-
|
|
94
|
-
Action.prototype.enable.call(this, e);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
/* Used to hide subToolbars without removing them from the map. */
|
|
100
|
-
_hide: function() {
|
|
101
|
-
this._ul.style.display = 'none';
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/* Used to show subToolbars without removing them from the map. */
|
|
105
|
-
_show: function() {
|
|
106
|
-
this._ul.style.display = 'block';
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
_calculateDepth: function() {
|
|
110
|
-
var depth = 0,
|
|
111
|
-
toolbar = this.parentToolbar;
|
|
112
|
-
|
|
113
|
-
while (toolbar) {
|
|
114
|
-
depth += 1;
|
|
115
|
-
toolbar = toolbar.parentToolbar;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return depth;
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
L.toolbar = {};
|
|
123
|
-
|
|
124
|
-
var toolbar_class_id = 0;
|
|
125
|
-
|
|
126
|
-
L.Toolbar.extend = function extend(props) {
|
|
127
|
-
var statics = L.extend({}, props.statics, {
|
|
128
|
-
"_toolbar_class_id": toolbar_class_id
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
toolbar_class_id += 1;
|
|
132
|
-
L.extend(props, { statics: statics });
|
|
133
|
-
|
|
134
|
-
return L.Class.extend.call(this, props);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
L.Map.addInitHook(function() {
|
|
138
|
-
this._toolbars = {};
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
L.ToolbarAction = L.Handler.extend({
|
|
142
|
-
statics: {
|
|
143
|
-
baseClass: 'leaflet-toolbar-icon'
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
options: {
|
|
147
|
-
toolbarIcon: {
|
|
148
|
-
html: '',
|
|
149
|
-
className: '',
|
|
150
|
-
tooltip: ''
|
|
151
|
-
},
|
|
152
|
-
subToolbar: new L.Toolbar()
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
initialize: function(options) {
|
|
156
|
-
var defaultIconOptions = L.ToolbarAction.prototype.options.toolbarIcon;
|
|
157
|
-
|
|
158
|
-
L.setOptions(this, options);
|
|
159
|
-
this.options.toolbarIcon = L.extend({}, defaultIconOptions, this.options.toolbarIcon);
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
enable: function(e) {
|
|
163
|
-
if (e) { L.DomEvent.preventDefault(e); }
|
|
164
|
-
if (this._enabled) { return; }
|
|
165
|
-
this._enabled = true;
|
|
166
|
-
|
|
167
|
-
if (this.addHooks) { this.addHooks(); }
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
disable: function() {
|
|
171
|
-
if (!this._enabled) { return; }
|
|
172
|
-
this._enabled = false;
|
|
173
|
-
|
|
174
|
-
if (this.removeHooks) { this.removeHooks(); }
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
_createIcon: function(toolbar, container, args) {
|
|
178
|
-
var iconOptions = this.options.toolbarIcon;
|
|
179
|
-
|
|
180
|
-
this.toolbar = toolbar;
|
|
181
|
-
this._icon = L.DomUtil.create('li', '', container);
|
|
182
|
-
this._link = L.DomUtil.create('a', '', this._icon);
|
|
183
|
-
|
|
184
|
-
this._link.innerHTML = iconOptions.html;
|
|
185
|
-
this._link.setAttribute('href', '#');
|
|
186
|
-
this._link.setAttribute('title', iconOptions.tooltip);
|
|
187
|
-
|
|
188
|
-
L.DomUtil.addClass(this._link, this.constructor.baseClass);
|
|
189
|
-
if (iconOptions.className) {
|
|
190
|
-
L.DomUtil.addClass(this._link, iconOptions.className);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
L.DomEvent.on(this._link, 'click', this.enable, this);
|
|
194
|
-
|
|
195
|
-
/* Add secondary toolbar */
|
|
196
|
-
this._addSubToolbar(toolbar, this._icon, args);
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
_addSubToolbar: function(toolbar, container, args) {
|
|
200
|
-
var subToolbar = this.options.subToolbar,
|
|
201
|
-
addHooks = this.addHooks,
|
|
202
|
-
removeHooks = this.removeHooks;
|
|
203
|
-
|
|
204
|
-
/* For calculating the nesting depth. */
|
|
205
|
-
subToolbar.parentToolbar = toolbar;
|
|
206
|
-
|
|
207
|
-
if (subToolbar.options.actions.length > 0) {
|
|
208
|
-
/* Make a copy of args so as not to pollute the args array used by other actions. */
|
|
209
|
-
args = [].slice.call(args);
|
|
210
|
-
args.push(this);
|
|
211
|
-
|
|
212
|
-
subToolbar.addTo.apply(subToolbar, args);
|
|
213
|
-
subToolbar.appendToContainer(container);
|
|
214
|
-
|
|
215
|
-
this.addHooks = function(map) {
|
|
216
|
-
if (typeof addHooks === 'function') { addHooks.call(this, map); }
|
|
217
|
-
subToolbar._show();
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
this.removeHooks = function(map) {
|
|
221
|
-
if (typeof removeHooks === 'function') { removeHooks.call(this, map); }
|
|
222
|
-
subToolbar._hide();
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
L.toolbarAction = function toolbarAction(options) {
|
|
229
|
-
return new L.ToolbarAction(options);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
L.ToolbarAction.extendOptions = function(options) {
|
|
233
|
-
return this.extend({ options: options });
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
L.Toolbar.Control = L.Toolbar.extend({
|
|
237
|
-
statics: {
|
|
238
|
-
baseClass: 'leaflet-control-toolbar ' + L.Toolbar.baseClass
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
initialize: function(options) {
|
|
242
|
-
L.Toolbar.prototype.initialize.call(this, options);
|
|
243
|
-
|
|
244
|
-
this._control = new L.Control.Toolbar(this.options);
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
onAdd: function(map) {
|
|
248
|
-
this._control.addTo(map);
|
|
249
|
-
|
|
250
|
-
L.Toolbar.prototype.onAdd.call(this, map);
|
|
251
|
-
|
|
252
|
-
this.appendToContainer(this._control.getContainer());
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
onRemove: function(map) {
|
|
256
|
-
L.Toolbar.prototype.onRemove.call(this, map);
|
|
257
|
-
if (this._control.remove) {this._control.remove();} // Leaflet 1.0
|
|
258
|
-
else {this._control.removeFrom(map);}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
L.Control.Toolbar = L.Control.extend({
|
|
263
|
-
onAdd: function() {
|
|
264
|
-
return L.DomUtil.create('div', '');
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
L.toolbar.control = function(options) {
|
|
269
|
-
return new L.Toolbar.Control(options);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// A convenience class for built-in popup toolbars.
|
|
273
|
-
|
|
274
|
-
L.Toolbar.Popup = L.Toolbar.extend({
|
|
275
|
-
statics: {
|
|
276
|
-
baseClass: 'leaflet-popup-toolbar ' + L.Toolbar.baseClass
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
options: {
|
|
280
|
-
anchor: [0, 0]
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
initialize: function(latlng, options) {
|
|
284
|
-
L.Toolbar.prototype.initialize.call(this, options);
|
|
285
|
-
|
|
286
|
-
/*
|
|
287
|
-
* Developers can't pass a DivIcon in the options for L.Toolbar.Popup
|
|
288
|
-
* (the use of DivIcons is an implementation detail which may change).
|
|
289
|
-
*/
|
|
290
|
-
this._marker = new L.Marker(latlng, {
|
|
291
|
-
icon : new L.DivIcon({
|
|
292
|
-
className: this.options.className,
|
|
293
|
-
iconAnchor: [0, 0]
|
|
294
|
-
})
|
|
295
|
-
});
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
onAdd: function(map) {
|
|
299
|
-
this._map = map;
|
|
300
|
-
this._marker.addTo(map);
|
|
301
|
-
|
|
302
|
-
L.Toolbar.prototype.onAdd.call(this, map);
|
|
303
|
-
|
|
304
|
-
this.appendToContainer(this._marker._icon);
|
|
305
|
-
|
|
306
|
-
this._setStyles();
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
onRemove: function(map) {
|
|
310
|
-
map.removeLayer(this._marker);
|
|
311
|
-
|
|
312
|
-
L.Toolbar.prototype.onRemove.call(this, map);
|
|
313
|
-
|
|
314
|
-
delete this._map;
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
setLatLng: function(latlng) {
|
|
318
|
-
this._marker.setLatLng(latlng);
|
|
319
|
-
|
|
320
|
-
return this;
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
_setStyles: function() {
|
|
324
|
-
var container = this._container,
|
|
325
|
-
toolbar = this._ul,
|
|
326
|
-
anchor = L.point(this.options.anchor),
|
|
327
|
-
icons = toolbar.querySelectorAll('.leaflet-toolbar-icon'),
|
|
328
|
-
buttonHeights = [],
|
|
329
|
-
toolbarWidth = 0,
|
|
330
|
-
toolbarHeight,
|
|
331
|
-
tipSize,
|
|
332
|
-
tipAnchor;
|
|
333
|
-
|
|
334
|
-
/* Calculate the dimensions of the toolbar. */
|
|
335
|
-
for (var i = 0, l = icons.length; i < l; i++) {
|
|
336
|
-
if (icons[i].parentNode.parentNode === toolbar) {
|
|
337
|
-
buttonHeights.push(parseInt(L.DomUtil.getStyle(icons[i], 'height'), 10));
|
|
338
|
-
toolbarWidth += Math.ceil(parseFloat(L.DomUtil.getStyle(icons[i], 'width')));
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
toolbar.style.width = toolbarWidth + 'px';
|
|
342
|
-
|
|
343
|
-
/* Create and place the toolbar tip. */
|
|
344
|
-
this._tipContainer = L.DomUtil.create('div', 'leaflet-toolbar-tip-container', container);
|
|
345
|
-
this._tipContainer.style.width = toolbarWidth + 'px';
|
|
346
|
-
|
|
347
|
-
this._tip = L.DomUtil.create('div', 'leaflet-toolbar-tip', this._tipContainer);
|
|
348
|
-
|
|
349
|
-
/* Set the tipAnchor point. */
|
|
350
|
-
toolbarHeight = Math.max.apply(undefined, buttonHeights);
|
|
351
|
-
tipSize = parseInt(L.DomUtil.getStyle(this._tip, 'width'), 10);
|
|
352
|
-
tipAnchor = new L.Point(toolbarWidth/2, toolbarHeight + 0.7071*tipSize);
|
|
353
|
-
|
|
354
|
-
/* The anchor option allows app developers to adjust the toolbar's position. */
|
|
355
|
-
container.style.marginLeft = (anchor.x - tipAnchor.x) + 'px';
|
|
356
|
-
container.style.marginTop = (anchor.y - tipAnchor.y) + 'px';
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
L.toolbar.popup = function(options) {
|
|
361
|
-
return new L.Toolbar.Popup(options);
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
})(window, document);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
import shutil
|
|
3
|
-
import tempfile
|
|
4
|
-
from copy import deepcopy
|
|
5
|
-
|
|
6
|
-
import pytest
|
|
7
|
-
from django.core.management import call_command
|
|
8
|
-
from django.utils.translation import override
|
|
9
|
-
from playwright.sync_api import expect
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.fixture
|
|
13
|
-
def staticfiles(settings):
|
|
14
|
-
static_root = tempfile.mkdtemp(prefix="test_static")
|
|
15
|
-
settings.STATIC_ROOT = static_root
|
|
16
|
-
# Make sure settings are properly reset after the test
|
|
17
|
-
settings.STORAGES = deepcopy(settings.STORAGES)
|
|
18
|
-
settings.STORAGES["staticfiles"]["BACKEND"] = (
|
|
19
|
-
"umap.storage.UmapManifestStaticFilesStorage"
|
|
20
|
-
)
|
|
21
|
-
try:
|
|
22
|
-
call_command("collectstatic", "--noinput")
|
|
23
|
-
yield
|
|
24
|
-
finally:
|
|
25
|
-
shutil.rmtree(static_root)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_javascript_have_been_loaded(
|
|
29
|
-
map, live_server, datalayer, page, settings, staticfiles
|
|
30
|
-
):
|
|
31
|
-
datalayer.settings["displayOnLoad"] = False
|
|
32
|
-
datalayer.save()
|
|
33
|
-
map.settings["properties"]["defaultView"] = "latest"
|
|
34
|
-
map.save()
|
|
35
|
-
with override("fr"):
|
|
36
|
-
url = f"{live_server.url}{map.get_absolute_url()}"
|
|
37
|
-
assert "/fr/" in url
|
|
38
|
-
page.goto(url)
|
|
39
|
-
# Hash is defined, so map is initialized
|
|
40
|
-
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
|
|
41
|
-
expect(page).to_have_url(re.compile(r".*/fr/"))
|
|
42
|
-
# Should be in French, so hashed locale file has been loaded correctly
|
|
43
|
-
button = page.get_by_role("button", name="Explorateur")
|
|
44
|
-
expect(button).to_be_visible()
|
|
45
|
-
button.click()
|
|
46
|
-
layers = page.locator(".umap-browser .datalayer")
|
|
47
|
-
expect(layers).to_have_count(1)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|