Fix generate_js_locale paths

This commit is contained in:
Yohan Boniface 2018-06-02 14:00:13 +02:00
parent 887a9fc7e0
commit a0bff73401
5 changed files with 9 additions and 16 deletions

View file

@ -1,6 +1,6 @@
{
"name": "leaflet-storage",
"version": "0.8.2",
"name": "umap",
"version": "1.0.0-alpha.1",
"description": "Manage map and features with Leaflet and expose them for backend storage through an API.",
"directories": {
"test": "test"

View file

@ -16,8 +16,7 @@ class Command(BaseCommand):
code = to_locale(code)
if self.verbosity > 0:
print("Processing", name)
path = finders.find('storage/src/locale/{code}.json'.format(
code=code))
path = finders.find('umap/locale/{code}.json'.format(code=code))
if not path:
print("No file for", code, "Skipping")
else:
@ -27,11 +26,8 @@ class Command(BaseCommand):
self.render(code, f.read())
def render(self, code, json):
path = os.path.join(
settings.STATIC_ROOT,
"storage/src/locale/",
"{code}.js".format(code=code)
)
path = os.path.join(settings.STATIC_ROOT,
"umap/locale/{code}.js".format(code=code))
with io.open(path, "w", encoding="utf-8") as f:
content = render_to_string('umap/locale.js', {
"locale": json,

View file

@ -87,14 +87,8 @@ MEDIA_URL = '/uploads/'
STATIC_ROOT = os.path.join('static')
MEDIA_ROOT = os.path.join('uploads')
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, 'static'),
)
STATICFILES_FINDERS = [
'compressor.finders.CompressorFinder',
# 'npm.finders.NpmFinder',
] + STATICFILES_FINDERS
# =============================================================================

View file

@ -0,0 +1,3 @@
var locale = {{ locale|safe }};
L.registerLocale("{{ locale_code }}", locale);
L.setLocale("{{ locale_code }}");

View file

@ -355,7 +355,7 @@ class MapDetailMixin(object):
'urls': _urls_for_js(),
'tilelayers': self.get_tilelayers(),
'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(),
'licences': dict((l.name, l.json) for l in Licence.objects.all()),
}