1. Benoît Allard
  2. msgboard

Commits

Benoit Allard  committed 1c08fa3

tweak CSS rendering on the calendar table

  • Participants
  • Parent commits 3d383e5
  • Branches default

Comments (0)

Files changed (4)

File msgboard/jinjafilters.py

View file
  • Ignore whitespace
     day=date.today()
     day.replace(month=month)
     return day.strftime('%B')
-
-@app.template_filter()
-def userclass(day, user):
-    acts = Action.query.filter_by(user_id=user.id)\
-                       .filter_by(date=day).all()
-    classes = []
-    for act in acts:
-        if act.id==1: # ziek
-            return 'away'
-    return classes
-        
-            

File msgboard/static/style.css

View file
  • Ignore whitespace
 
 textarea {
   width: 100%;
-}
+}
+
+.month{
+  empty-cells:show;
+}
+
+.month .present {
+  background-color: #00ee00;
+}
+
+.month .away {
+  background-color: #dd0000;
+}
+
+.month .out {
+  color: #CCC;
+}
+
+.month .weekend {
+  background-color: #999;
+}
+
+.empty {
+  text-decoration: none;
+  display: block;
+}

File msgboard/templates/layout.html

View file
  • Ignore whitespace
        <h2>Anonymous</h2>
     {% endif %}
   {% endif %}
+  <a href="{{ url_for('show') }}">Calendar</a>
   {% for message in get_flashed_messages() %}
     <div class=flash>{{ message|render_flash|safe }}</div>
   {% else %}

File msgboard/templates/show.html

View file
  • Ignore whitespace
 {% extends "layout.html" %}
 {% block body %}
 <h3>{{ month.month|monthname }} {{ month.year }}</h3>
-<table>
+<table class="month">
   <thead>
   <tr>
-    <th></th>
+    <th /><th />
     {% for org in organisations %}
-      <th colspan="{{ org.users|count }}">{{ org.name }}</th>
+      <th colspan="{{ org.users|count }}" class="org">{{ org.name }}</th>
     {% endfor %}
   </tr>
   <tr>
-    <th></th>
+    <th /><th />
     {% for user in users %}
       <th> {{ user.username }}</th>
     {% endfor %}
   <tbody>
   {% for day in month.days() %}
   <tr class="{{ day|dayclass(month.month)|join(' ') }}">
+    {% if day.isoweekday() == 1 %}
+    <td rowspan=7>{{ day.isocalendar()[1] }}</td>
+    {% endif %}
     <td>{{ day.day }}</td>
     {% for user in users %}
-      <td class="{{ day|userclass(user)|join(' ') }}">
+      <td class="{{ 'away' if user.isaway(day) else 'present' if day.isoweekday() not in (6, 7) }}">
       {% if user.username == session.username %}
-        <a href="#" onClick="show()"> </a>
+        <a href="#" onClick="show()" class="empty" title="Add action...">&nbsp;</a>
       {% endif %}
       </td>
     {% endfor %}