Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
b8de0532
Commit
b8de0532
authored
Apr 28, 2015
by
Nitish Rathi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Give users the option to use mapbox v4"
parent
ebf5d597
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
22 deletions
+5
-22
db_geoa.rst
doc/db_geoa.rst
+0
-5
form-1.0.0.js
flask_admin/static/admin/js/form-1.0.0.js
+3
-7
lib.html
flask_admin/templates/bootstrap2/admin/lib.html
+0
-4
lib.html
flask_admin/templates/bootstrap3/admin/lib.html
+2
-6
No files found.
doc/db_geoa.rst
View file @
b8de0532
...
@@ -28,11 +28,6 @@ settings::
...
@@ -28,11 +28,6 @@ settings::
app = Flask(__name__)
app = Flask(__name__)
app.config['MAPBOX_MAP_ID'] = "example.abc123"
app.config['MAPBOX_MAP_ID'] = "example.abc123"
To use the v4 of their API: (Note that while 4 is parameterized here, only v3 and v4 are currently supported.)::
app.config['MAPBOX_ACCESS_TOKEN'] = "pk.def456"
app.config['MAPBOX_API_VERSION'] = 4
.. note::
.. note::
Leaflet supports loading map tiles from any arbitrary map tile provider, but
Leaflet supports loading map tiles from any arbitrary map tile provider, but
at the moment, Flask-Admin only supports Mapbox. If you want to use other
at the moment, Flask-Admin only supports Mapbox. If you want to use other
...
...
flask_admin/static/admin/js/form-1.0.0.js
View file @
b8de0532
...
@@ -73,8 +73,8 @@
...
@@ -73,8 +73,8 @@
* Process Leaflet (map) widget
* Process Leaflet (map) widget
*/
*/
function
processLeafletWidget
(
$el
,
name
)
{
function
processLeafletWidget
(
$el
,
name
)
{
if
(
!
window
.
MAPBOX_MAP_ID
||
(
window
.
MAPBOX_API_VERSION
===
4
&&
!
window
.
MAPBOX_ACCESS_TOKEN
)
)
{
if
(
!
window
.
MAPBOX_MAP_ID
)
{
console
.
error
(
"You must set MAPBOX_MAP_ID
and MAPBOX_ACCESS_TOKEN
in your Flask settings to use the map widget"
);
console
.
error
(
"You must set MAPBOX_MAP_ID in your Flask settings to use the map widget"
);
return
false
;
return
false
;
}
}
...
@@ -155,11 +155,7 @@
...
@@ -155,11 +155,7 @@
}
}
// set up tiles
// set up tiles
var
mapboxTemplateUrl
=
'http://{s}.tiles.mapbox.com/v3/'
+
MAPBOX_MAP_ID
+
'/{z}/{x}/{y}.png'
;
L
.
tileLayer
(
'http://{s}.tiles.mapbox.com/v3/'
+
MAPBOX_MAP_ID
+
'/{z}/{x}/{y}.png'
,
{
if
(
MAPBOX_API_VERSION
===
4
)
{
mapboxTemplateUrl
=
'http://{s}.tiles.mapbox.com/v4/'
+
MAPBOX_MAP_ID
+
'/{z}/{x}/{y}.png?access_token='
+
MAPBOX_ACCESS_TOKEN
;
}
L
.
tileLayer
(
mapboxTemplateUrl
,
{
attribution
:
'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>'
,
attribution
:
'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>'
,
maxZoom
:
18
maxZoom
:
18
}).
addTo
(
map
);
}).
addTo
(
map
);
...
...
flask_admin/templates/bootstrap2/admin/lib.html
View file @
b8de0532
...
@@ -187,10 +187,6 @@
...
@@ -187,10 +187,6 @@
{% if config.MAPBOX_MAP_ID %}
{% if config.MAPBOX_MAP_ID %}
<script>
<script>
window
.
MAPBOX_MAP_ID
=
"{{ config.MAPBOX_MAP_ID }}"
;
window
.
MAPBOX_MAP_ID
=
"{{ config.MAPBOX_MAP_ID }}"
;
{
%
if
config
.
get
(
MAPBOX_API_VERSION
)
==
4
%
}
window
.
MAPBOX_ACCESS_TOKEN
=
"{{ config.MAPBOX_ACCESS_TOKEN }}"
;
window
.
MAPBOX_API_VERSION
=
"{{ config.MAPBOX_API_VERSION }}"
;
{
%
endif
%
}
</script>
</script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.js') }}"
></script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.js') }}"
></script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.js') }}"
></script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.js') }}"
></script>
...
...
flask_admin/templates/bootstrap3/admin/lib.html
View file @
b8de0532
...
@@ -169,7 +169,7 @@
...
@@ -169,7 +169,7 @@
<link
href=
"{{ admin_static.url(filename='vendor/select2/select2.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/select2/select2.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/select2/select2-bootstrap3.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/select2/select2-bootstrap3.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs3.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs3.css') }}"
rel=
"stylesheet"
>
{% if config.MAPBOX_MAP_ID
and config.MAPBOX_ACCESS_TOKEN
%}
{% if config.MAPBOX_MAP_ID %}
<link
href=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.css') }}"
rel=
"stylesheet"
>
{% endif %}
{% endif %}
...
@@ -179,13 +179,9 @@
...
@@ -179,13 +179,9 @@
{% endmacro %}
{% endmacro %}
{% macro form_js() %}
{% macro form_js() %}
{% if config.MAPBOX_MAP_ID
and config.MAPBOX_ACCESS_TOKEN
%}
{% if config.MAPBOX_MAP_ID %}
<script>
<script>
window
.
MAPBOX_MAP_ID
=
"{{ config.MAPBOX_MAP_ID }}"
;
window
.
MAPBOX_MAP_ID
=
"{{ config.MAPBOX_MAP_ID }}"
;
{
%
if
config
.
get
(
'MAPBOX_API_VERSION'
)
==
4
%
}
window
.
MAPBOX_ACCESS_TOKEN
=
"{{ config.MAPBOX_ACCESS_TOKEN }}"
;
window
.
MAPBOX_API_VERSION
=
"{{ config.MAPBOX_API_VERSION }}"
;
{
%
endif
%
}
</script>
</script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.js') }}"
></script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.js') }}"
></script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.js') }}"
></script>
<script
src=
"{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.js') }}"
></script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment