{{ event|picto_status }}
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html
index a8e3b86..e99f3ca 100644
--- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html
@@ -11,7 +11,7 @@
class="close"
data-target="event-{{ event.id }}"
onClick="toggleModal(event)">
- {{ event.category | small_cat }} {{ event|picto_status }} {{ event.title }}
+ {{ event.category|small_cat_recurrent:event.has_recurrences }} {{ event|picto_status }} {{ event.title }}
{% picto_from_name "map-pin" %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
index 379c729..f239b11 100644
--- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
@@ -7,7 +7,7 @@
{% picto_from_name "calendar" %}
diff --git a/src/agenda_culturel/templatetags/cat_extra.py b/src/agenda_culturel/templatetags/cat_extra.py
index 06a5024..68b66eb 100644
--- a/src/agenda_culturel/templatetags/cat_extra.py
+++ b/src/agenda_culturel/templatetags/cat_extra.py
@@ -4,6 +4,7 @@ from django.utils.safestring import mark_safe
from agenda_culturel.models import Category
import statistics
import colorsys
+from .utils_extra import *
register = template.Library()
@@ -46,9 +47,11 @@ def adjust_lightness_saturation(hex_color, shift_lightness = 0.0, scale_saturati
return rgb_to_html([r, g, b])
+def adjust_color(color, alpha = 1):
+ return color + ("0" + hex(int(alpha * 255))[2:])[-2:]
def background_color_adjust_color(color, alpha = 1):
- result = " background-color: " + color + ("0" + hex(int(alpha * 255))[2:])[-2:] + ";"
+ result = " background-color: " + adjust_color(color, alpha) + ";"
if get_relative_luminance(color) < .5:
result += " color: #fff;"
else:
@@ -79,38 +82,66 @@ def css_categories():
result += background_color_adjust_color(c["color"])
result += "}"
+ result += "." + c["css_class"] + ".circ-cat.recurrent, "
+ result += ".selected.recurrent ." + c["css_class"] + " {"
+ result += "background: none;"
+ result += "color: " + adjust_color(c["color"]) + ";"
+ result += "}"
+
result += "." + c["css_class"] + ".circ-cat:hover, "
result += "form ." + c["css_class"] + ":hover, "
result += "a.selected:hover ." + c["css_class"] + " {"
result += background_color_adjust_color(adjust_lightness_saturation(c["color"], 0.2, 1.2))
result += "}"
+ result += "." + c["css_class"] + ".circ-cat.recurrent:hover, "
+ result += ".selected.recurrent:hover ." + c["css_class"] + " {"
+ result += "background: none;"
+ result += "color: " + adjust_color(adjust_lightness_saturation(c["color"], 0.2, 1.2)) + ";"
+ result += "}"
+
+
result += ''
return mark_safe(result)
@register.filter
-def small_cat(category, url=None, contrast=True, selected=True):
+def small_cat(category, url=None, contrast=True, selected=True, recurrence=False):
name = Category.default_name if category is None else category.name
css_class = Category.default_css_class if category is None else category.css_class()
class_contrast = " contrast" if contrast else ""
class_selected = " selected" if selected else ""
+ class_recurrence = " recurrent" if recurrence else ""
+
+ content = ('' + picto_from_name("repeat", name + ' [récurrent]') + '') if recurrence else ('')
if url is None:
- return mark_safe(' ' + name + "")
+ return mark_safe('' + content + " " + name + "")
else:
- return mark_safe(' ' + name + "")
+ return mark_safe('' + content + " " + name + "")
@register.filter
def small_cat_no_selected(category, url=None):
return small_cat(category, url=url, selected=False)
@register.filter
-def circle_cat(category):
+def small_cat_recurrent(category, recurrence=False):
+ return small_cat(category, url=None, selected=True, recurrence=recurrence)
+
+
+@register.filter
+def circle_cat(category, recurrence=True):
if category is None:
- return mark_safe('')
+ c = Category.default_css_class
+ n = Category.default_name
else:
- return mark_safe('')
+ c = category.css_class()
+ n = category.name
+
+ if recurrence:
+ return mark_safe('' + picto_from_name("repeat", n + ' [récurrent]') + "")
+ else:
+ return mark_safe('')
@register.simple_tag
{{ event|picto_status }} {{ event.title }}