This repository was archived by the owner on Feb 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +44
-6
lines changed
templates/workshops/dashboard Expand file tree Collapse file tree 4 files changed +44
-6
lines changed Original file line number Diff line number Diff line change 22from ophasebase .dashboard_components import CountdownWidget
33from staff .dashboard_widgets import StaffCountWidget
44from students .dashboard_widgets import StudentCountWidget
5+ from workshops .dashboard_widgets import WorkshopCountWidget
56
67
78class DashboardWidgets ():
89 active_widgets = [
910 CountdownWidget (),
1011 StaffCountWidget (),
1112 StudentCountWidget (),
13+ WorkshopCountWidget (),
1214 ExamWidget ()
1315 ]
Original file line number Diff line number Diff line change 1+ from django .utils .translation import ugettext_lazy as _
2+
3+ from dashboard .components import TemplateWidgetComponent
4+ from ophasebase .models import Ophase
5+ from workshops .models import Workshop
6+
7+ class WorkshopCountWidget (TemplateWidgetComponent ):
8+ name = _ ('Workshops' )
9+ template_name = "workshops/dashboard/widget_workshops.html"
10+ status = 'info'
11+
12+ def get_context_data (self ):
13+ context = super ().get_context_data ()
14+ current_ophase = Ophase .current ()
15+ if current_ophase is not None :
16+ workshops = Workshop .get_current ()
17+ context ['num_workshops' ] = workshops .count ()
18+ context ['filled_slots' ] = sum (w .how_often for w in workshops )
19+ context ['num_workshop_tutors' ] = len (set (w .tutor_mail for w in workshops ))
20+ return context
Original file line number Diff line number Diff line change 77msgstr ""
88"Project-Id-Version : \n "
99"Report-Msgid-Bugs-To : \n "
10- "POT-Creation-Date : 2016-07-11 14:12 +0200\n "
11- "PO-Revision-Date : 2016-07-11 14:13 +0200\n "
10+ "POT-Creation-Date : 2016-07-11 15:06 +0200\n "
11+ "PO-Revision-Date : 2016-07-11 15:06 +0200\n "
1212"Last-Translator : \n "
1313"Language-Team : \n "
1414"Language : en\n "
@@ -17,6 +17,11 @@ msgstr ""
1717"Content-Transfer-Encoding : 8bit\n "
1818"X-Generator : Poedit 1.8.8\n "
1919
20+ #: dashboard_widgets.py:8 models.py:32
21+ #: templates/workshops/dashboard/widget_workshops.html:3
22+ msgid "Workshops"
23+ msgstr "Workshops"
24+
2025#: models.py:11
2126msgid "Workshopslot"
2227msgstr "Workshop slot"
@@ -41,10 +46,6 @@ msgstr "End"
4146msgid "Workshop"
4247msgstr "Workshop"
4348
44- #: models.py:32
45- msgid "Workshops"
46- msgstr "Workshops"
47-
4849#: models.py:35
4950msgid "Name"
5051msgstr "Name"
@@ -208,6 +209,14 @@ msgstr ""
208209"An email was sent to the submitted address. If you do not receive the email "
209210"or when there are changes regarding your workshop, please write an email to"
210211
212+ #: templates/workshops/dashboard/widget_workshops.html:4
213+ msgid "Gefüllte Slots"
214+ msgstr "Filled slots"
215+
216+ #: templates/workshops/dashboard/widget_workshops.html:5
217+ msgid "Workshoptutoren"
218+ msgstr "Workshop tutors"
219+
211220#: templates/workshops/workshop_form.html:14
212221msgid "Zurücksetzen"
213222msgstr "Reset"
Original file line number Diff line number Diff line change 1+ {% load i18n %}< table class ="table " id ="workshops_table ">
2+ < tbody >
3+ < tr > < td > {% trans "Workshops" %}:</ td > < td > {{ num_workshops }}</ td > </ tr >
4+ < tr > < td > {% trans "Gefüllte Slots" %}:</ td > < td > {{ filled_slots }}</ td > </ tr >
5+ < tr > < td > {% trans "Workshoptutoren" %}:</ td > < td > {{ num_workshop_tutors }}</ td > </ tr >
6+ </ tbody >
7+ </ table >
You can’t perform that action at this time.
0 commit comments