Skip to content

Commit

Permalink
Prepend forms assets (instead of extend) if PLUGINS['forms'] already …
Browse files Browse the repository at this point in the history
…exists
  • Loading branch information
leplatrem committed Sep 27, 2013
1 parent bfcbc08 commit 6eb451d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CHANGELOG
* Fix syntax error if form widget translations contains quotes.
* Fix dependency error if Leaflet is loaded after the form widget in the DOM.
* Respect plugins declaration order using OrderedDicts
* Prepend forms assets (instead of extend) if PLUGINS['forms'] already exists.

0.8.0 (2013-09-18)
------------------
Expand Down
7 changes: 4 additions & 3 deletions leaflet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@

PLUGIN_ALL = 'ALL'
PLUGINS_DEFAULT = '__default__'
PLUGIN_FORMS = 'forms'

# Add plugins required for forms (not auto-included)
PLUGIN_FORMS = 'forms'
# Assets will be preprended to any existing entry in PLUGINS['forms']
_forms_js = ['leaflet/draw/leaflet.draw.js',
'leaflet/leaflet.extras.js',
'leaflet/leaflet.forms.js']
_forms_css = ['leaflet/draw/leaflet.draw.css']
_forms_plugins = PLUGINS.setdefault(PLUGIN_FORMS, {})
_forms_plugins.setdefault('js', []).extend(_forms_js)
_forms_plugins.setdefault('css', []).extend(_forms_css)
_forms_plugins['js'] = _forms_js + _forms_plugins.get('js', [])
_forms_plugins['css'] = _forms_css + _forms_plugins.get('css', [])
_forms_plugins.setdefault('auto-include', False)
PLUGINS[PLUGIN_FORMS] = _forms_plugins

Expand Down

0 comments on commit 6eb451d

Please sign in to comment.