SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit f3a1fa03 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Merge branch 'dev_JSC_20181122_potfels'

parents d480744e 63af6619
No related branches found
No related tags found
No related merge requests found
{% extends 'colleges/base.html' %}
{% load scipost_extras %}
{% load colleges_extras %}
{% load bootstrap %}
......@@ -69,7 +70,7 @@ $(document).ready(function($) {
<div class="single d-inline" data-specialization="{{expertise|lower}}" data-toggle="tooltip" data-placement="bottom" title="{{expertise|get_specialization_display}}">{{expertise|get_specialization_code}}</div>
{% endfor %}
</td>
<td>{{ potfel.get_status_display }}</td>
<td style="color: #ffffff; background-color:{{ potfel.status|potfelstatuscolor }};">{{ potfel.get_status_display }}</td>
</tr>
{% empty %}
<tr>
......
__copyright__ = "Copyright 2016-2018, Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
from django import template
from ..constants import (
POTENTIAL_FELLOWSHIP_IDENTIFIED, POTENTIAL_FELLOWSHIP_INVITED, POTENTIAL_FELLOWSHIP_REINVITED,
POTENTIAL_FELLOWSHIP_MULTIPLY_REINVITED, POTENTIAL_FELLOWSHIP_DECLINED,
POTENTIAL_FELLOWSHIP_UNRESPONSIVE, POTENTIAL_FELLOWSHIP_RETIRED, POTENTIAL_FELLOWSHIP_DECEASED,
POTENTIAL_FELLOWSHIP_INTERESTED, POTENTIAL_FELLOWSHIP_REGISTERED,
POTENTIAL_FELLOWSHIP_ACTIVE_IN_COLLEGE, POTENTIAL_FELLOWSHIP_SCIPOST_EMERITUS
)
from common.utils import hslColorWheel
register = template.Library()
@register.filter(name='potfelstatuscolor')
def potfelstatuscolor(status):
color = '#333333'
if status == POTENTIAL_FELLOWSHIP_IDENTIFIED:
color = hslColorWheel(12, 8)
elif status == POTENTIAL_FELLOWSHIP_INVITED:
color = hslColorWheel(12, 9)
elif status == POTENTIAL_FELLOWSHIP_REINVITED:
color = hslColorWheel(12, 10)
elif status == POTENTIAL_FELLOWSHIP_MULTIPLY_REINVITED:
color = hslColorWheel(12, 11)
elif status == POTENTIAL_FELLOWSHIP_DECLINED:
color = hslColorWheel(12, 0)
elif status == POTENTIAL_FELLOWSHIP_UNRESPONSIVE:
color = hslColorWheel(12, 1)
elif status == POTENTIAL_FELLOWSHIP_RETIRED:
color = hslColorWheel(12, 1, 75)
elif status == POTENTIAL_FELLOWSHIP_DECEASED:
color = hslColorWheel(12, 1, 10)
elif status == POTENTIAL_FELLOWSHIP_INTERESTED:
color = hslColorWheel(12, 2)
elif status == POTENTIAL_FELLOWSHIP_REGISTERED:
color = hslColorWheel(12, 3)
elif status == POTENTIAL_FELLOWSHIP_ACTIVE_IN_COLLEGE:
color = hslColorWheel(12, 4)
elif status == POTENTIAL_FELLOWSHIP_SCIPOST_EMERITUS:
color = hslColorWheel(12, 4, 40, 40)
return color
......@@ -7,6 +7,22 @@ from django.core.mail import EmailMultiAlternatives
from django.template import loader
def hslColorWheel(N=10, index=0, saturation=50, lightness=50):
"""
Distributes colors into N values around a color wheel,
according to hue-saturation-lightness (HSL).
index takes values from 0 to N-1.
"""
hue = int(index * 360/N % 360)
saturation = max(saturation, 0)
saturation = min(saturation, 100)
lightness = max(lightness, 0)
lightness = min(lightness, 100)
return 'hsl(%s, %s%%, %s%%)' % (str(hue), str(saturation), str(lightness))
def workdays_between(datetime_from, datetime_until):
"""Return number of complete workdays.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment