Fix generate_js_locale paths
This commit is contained in:
parent
887a9fc7e0
commit
a0bff73401
5 changed files with 9 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "leaflet-storage",
|
"name": "umap",
|
||||||
"version": "0.8.2",
|
"version": "1.0.0-alpha.1",
|
||||||
"description": "Manage map and features with Leaflet and expose them for backend storage through an API.",
|
"description": "Manage map and features with Leaflet and expose them for backend storage through an API.",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
|
|
|
@ -16,8 +16,7 @@ class Command(BaseCommand):
|
||||||
code = to_locale(code)
|
code = to_locale(code)
|
||||||
if self.verbosity > 0:
|
if self.verbosity > 0:
|
||||||
print("Processing", name)
|
print("Processing", name)
|
||||||
path = finders.find('storage/src/locale/{code}.json'.format(
|
path = finders.find('umap/locale/{code}.json'.format(code=code))
|
||||||
code=code))
|
|
||||||
if not path:
|
if not path:
|
||||||
print("No file for", code, "Skipping")
|
print("No file for", code, "Skipping")
|
||||||
else:
|
else:
|
||||||
|
@ -27,11 +26,8 @@ class Command(BaseCommand):
|
||||||
self.render(code, f.read())
|
self.render(code, f.read())
|
||||||
|
|
||||||
def render(self, code, json):
|
def render(self, code, json):
|
||||||
path = os.path.join(
|
path = os.path.join(settings.STATIC_ROOT,
|
||||||
settings.STATIC_ROOT,
|
"umap/locale/{code}.js".format(code=code))
|
||||||
"storage/src/locale/",
|
|
||||||
"{code}.js".format(code=code)
|
|
||||||
)
|
|
||||||
with io.open(path, "w", encoding="utf-8") as f:
|
with io.open(path, "w", encoding="utf-8") as f:
|
||||||
content = render_to_string('umap/locale.js', {
|
content = render_to_string('umap/locale.js', {
|
||||||
"locale": json,
|
"locale": json,
|
||||||
|
|
|
@ -87,14 +87,8 @@ MEDIA_URL = '/uploads/'
|
||||||
STATIC_ROOT = os.path.join('static')
|
STATIC_ROOT = os.path.join('static')
|
||||||
MEDIA_ROOT = os.path.join('uploads')
|
MEDIA_ROOT = os.path.join('uploads')
|
||||||
|
|
||||||
|
|
||||||
STATICFILES_DIRS = (
|
|
||||||
os.path.join(PROJECT_DIR, 'static'),
|
|
||||||
)
|
|
||||||
|
|
||||||
STATICFILES_FINDERS = [
|
STATICFILES_FINDERS = [
|
||||||
'compressor.finders.CompressorFinder',
|
'compressor.finders.CompressorFinder',
|
||||||
# 'npm.finders.NpmFinder',
|
|
||||||
] + STATICFILES_FINDERS
|
] + STATICFILES_FINDERS
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
3
umap/templates/umap/locale.js
Normal file
3
umap/templates/umap/locale.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
var locale = {{ locale|safe }};
|
||||||
|
L.registerLocale("{{ locale_code }}", locale);
|
||||||
|
L.setLocale("{{ locale_code }}");
|
|
@ -355,7 +355,7 @@ class MapDetailMixin(object):
|
||||||
'urls': _urls_for_js(),
|
'urls': _urls_for_js(),
|
||||||
'tilelayers': self.get_tilelayers(),
|
'tilelayers': self.get_tilelayers(),
|
||||||
'allowEdit': self.is_edit_allowed(),
|
'allowEdit': self.is_edit_allowed(),
|
||||||
'default_iconUrl': "%sstorage/src/img/marker.png" % settings.STATIC_URL, # noqa
|
'default_iconUrl': "%sumap/img/marker.png" % settings.STATIC_URL, # noqa
|
||||||
'storage_id': self.get_storage_id(),
|
'storage_id': self.get_storage_id(),
|
||||||
'licences': dict((l.name, l.json) for l in Licence.objects.all()),
|
'licences': dict((l.name, l.json) for l in Licence.objects.all()),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue