summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-03-12 10:45:18 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-03-12 10:45:18 +0100
commit4c3071db2a009e41af87bfada2fcb27ffc70d474 (patch)
treedf68fe781f3d3cadc6088d39f7078e15fe6a3dce
parenta5bd515c200f91d1e17b535726b2689a9eefaa08 (diff)
downloadChimère-4c3071db2a009e41af87bfada2fcb27ffc70d474.tar.bz2
Chimère-4c3071db2a009e41af87bfada2fcb27ffc70d474.zip
Manage options "show directory" and "show inside popup" in db
-rw-r--r--chimere/actions.py10
-rw-r--r--chimere/migrations/0013_auto_20180312_1030.py29
-rw-r--r--chimere/models.py5
-rw-r--r--chimere/templatetags/chimere_tags.py2
-rw-r--r--settings.py5
5 files changed, 41 insertions, 10 deletions
diff --git a/chimere/actions.py b/chimere/actions.py
index 1425e14..f965e9b 100644
--- a/chimere/actions.py
+++ b/chimere/actions.py
@@ -53,10 +53,6 @@ default_actions = [
Action('edit-polygon', 'chimere:editpolygon', _('Add a new polygon'))),
)]
-if hasattr(settings, 'CHIMERE_DIRECTORY') and settings.CHIMERE_DIRECTORY:
- default_actions.append((Action('categories', 'chimere:category-directory',
- _('Directory')), []))
-
if settings.CHIMERE_FEEDS:
default_actions.append((Action('rss', 'chimere:feeds-form',
_('RSS feeds')), []))
@@ -77,6 +73,12 @@ def actions(area_name=''):
q = Area.objects.filter(default=True)
if q.count():
area = q.all()[0]
+ if area.show_directory:
+ acts.insert(
+ len(acts) - 3,
+ (Action('categories', 'chimere:category-directory',
+ _('Directory')), [])
+ )
real_acts = []
for act, childs in acts:
diff --git a/chimere/migrations/0013_auto_20180312_1030.py b/chimere/migrations/0013_auto_20180312_1030.py
new file mode 100644
index 0000000..21ae571
--- /dev/null
+++ b/chimere/migrations/0013_auto_20180312_1030.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.5 on 2018-03-12 10:30
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('chimere', '0012_area_favicon'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='icon',
+ options={'ordering': ['name'], 'verbose_name': 'Icon'},
+ ),
+ migrations.AddField(
+ model_name='area',
+ name='show_directory',
+ field=models.BooleanField(default=True, verbose_name='Show directory'),
+ ),
+ migrations.AddField(
+ model_name='area',
+ name='use_popup_for_detail',
+ field=models.BooleanField(default=True, verbose_name='Use popup for detail'),
+ ),
+ ]
diff --git a/chimere/models.py b/chimere/models.py
index faf0f7a..4ff6ab7 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -1987,6 +1987,11 @@ class Area(models.Model, SimpleArea):
null=True)
order = models.IntegerField(_("Order"), unique=True)
available = models.BooleanField(_("Available"))
+ use_popup_for_detail = models.BooleanField(
+ _("Use popup for detail"), default=True)
+ show_directory = models.BooleanField(
+ _("Show directory"), default=True
+ )
# logo = models.ImageField(_("Logo"), upload_to='logos', blank=True,
# null=True)
favicon = models.ImageField(_(u"Favicon"), blank=True, null=True)
diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py
index ec6fcd7..08ff177 100644
--- a/chimere/templatetags/chimere_tags.py
+++ b/chimere/templatetags/chimere_tags.py
@@ -220,7 +220,6 @@ def map(context, map_id='map'):
'map_id': map_id,
"STATIC_URL": settings.STATIC_URL,
"enable_clustering": settings.CHIMERE_ENABLE_CLUSTERING,
- "popupContentFull": settings.CHIMERE_CONTENT_INSIDE_POPUP
}
context_data['MOBILE'] = context['MOBILE']
context_data['routing'] = 'true' \
@@ -251,6 +250,7 @@ def map(context, map_id='map'):
pass
subcat_layer = SubCategory.objects.filter(as_layer=True, available=True)
if area:
+ context_data["popupContentFull"] = area.use_popup_for_detail
context_data['json_overlays'] = [
area_overlay.overlay for area_overlay in
AreaOverlays.objects.filter(
diff --git a/settings.py b/settings.py
index 41d6999..8344266 100644
--- a/settings.py
+++ b/settings.py
@@ -60,11 +60,6 @@ CHIMERE_DAYS_BEFORE_EVENT = 30
CHIMERE_ALL_DATED_ARE_FRONT = True
# allow feeds
CHIMERE_FEEDS = True
-# display a directory of items
-CHIMERE_DIRECTORY = True
-
-# content inside the popup or on a specific window
-CHIMERE_CONTENT_INSIDE_POPUP = False
# display picture inside the description by default or inside a galery?
CHIMERE_MINIATURE_BY_DEFAULT = False