diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-05 18:10:05 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-05 18:10:05 +0200 |
commit | 4268fe123c1450b01aa64b29f8c8a68a9ffba5d9 (patch) | |
tree | 099baae1a0522c3cc25d3d20a24dd8380f8413b3 /chimere/widgets.py | |
parent | f98128ac47b0640d559432e61e5bffa83c02dd00 (diff) | |
parent | 2c46821d582846bd86cfe0d08a6b110cf765bc11 (diff) | |
download | Chimère-4268fe123c1450b01aa64b29f8c8a68a9ffba5d9.tar.bz2 Chimère-4268fe123c1450b01aa64b29f8c8a68a9ffba5d9.zip |
Merge branch 'v2.9'
Conflicts:
chimere/static/chimere/js/jquery.chimere.js
chimere/templates/chimere/blocks/head_chimere.html
Diffstat (limited to 'chimere/widgets.py')
-rw-r--r-- | chimere/widgets.py | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/chimere/widgets.py b/chimere/widgets.py index f735db1..8464d47 100644 --- a/chimere/widgets.py +++ b/chimere/widgets.py @@ -37,6 +37,22 @@ from django.template.loader import render_to_string import re +BASE_CSS = { + "all": ("{}ol3/ol.css".format(settings.STATIC_URL), + "{}chimere/css/forms.css".format(settings.STATIC_URL)) +} + +BASE_JS = tuple( + ["{}ol3/ol.js".format(settings.STATIC_URL)] + + list(settings.JQUERY_JS_URLS) + + ["{}chimere/js/jquery.chimere.js".format(settings.STATIC_URL)]) + +AREA_JS = tuple( + ["{}ol3/ol.js".format(settings.STATIC_URL)] + + ["{}chimere/js/edit_area.js".format(settings.STATIC_URL) + + "{}chimere/js/base.js".format(settings.STATIC_URL)]) + + def getMapJS(area_name=''): '''Variable initialization for drawing the map ''' @@ -361,12 +377,8 @@ class PointChooserWidget(forms.TextInput): Manage the edition of point on a map """ class Media: - css = { - "all": settings.MAP_CSS_URLS + - ["%schimere/css/forms.css" % settings.STATIC_URL] - } - js = settings.MAP_JS_URLS + list(settings.JQUERY_JS_URLS) + \ - ["%schimere/js/jquery.chimere.js" % settings.STATIC_URL] + css = BASE_CSS + js = BASE_JS def render(self, name, value, attrs=None, area_name='', initialized=True): ''' @@ -452,12 +464,8 @@ class RouteChooserWidget(forms.TextInput): Manage the edition of route on a map """ class Media: - css = { - "all": settings.MAP_CSS_URLS + - ["%schimere/css/forms.css" % settings.STATIC_URL] - } - js = settings.MAP_JS_URLS + list(settings.JQUERY_JS_URLS) + \ - ["%schimere/js/jquery.chimere.js" % settings.STATIC_URL] + css = BASE_CSS + js = BASE_JS def render(self, name, value, attrs=None, area_name='', routefile_id=None, initialized=True): @@ -505,13 +513,8 @@ class AreaWidget(forms.TextInput): Manage the edition of an area on the map """ class Media: - css = { - "all": settings.MAP_CSS_URLS + - ["%schimere/css/forms.css" % settings.STATIC_URL] - } - js = settings.MAP_JS_URLS + [ - "%schimere/js/edit_area.js" % settings.STATIC_URL, - "%schimere/js/base.js" % settings.STATIC_URL] + css = BASE_CSS + js = AREA_JS def get_bounding_box_from_value(self, value): ''' @@ -602,12 +605,8 @@ class PolygonChooserWidget(forms.TextInput): Manage the edition of polygon on a map """ class Media: - css = { - "all": settings.MAP_CSS_URLS + - ["%schimere/css/forms.css" % settings.STATIC_URL] - } - js = settings.MAP_JS_URLS + list(settings.JQUERY_JS_URLS) + \ - ["%schimere/js/jquery.chimere.js" % settings.STATIC_URL] + css = BASE_CSS + js = BASE_JS def render(self, name, value, attrs=None, area_name='', initialized=True): val = '' @@ -658,13 +657,8 @@ class ImportFiltrWidget(AreaWidget): Manage the edition of the import source field """ class Media: - css = { - "all": settings.MAP_CSS_URLS + - ["%schimere/css/forms.css" % settings.STATIC_URL] - } - js = settings.MAP_JS_URLS + [ - "%schimere/js/edit_area.js" % settings.STATIC_URL, - "%schimere/js/base.js" % settings.STATIC_URL] + css = BASE_CSS + js = AREA_JS def render(self, name, value, attrs=None): """ |