Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
0544f72c
Verified
Commit
0544f72c
authored
1 year ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add default color for calendar feeds
parent
f41c2731
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!339
Fix some bugs with displaying lesson events
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/chronos/models.py
+10
-1
10 additions, 1 deletion
aleksis/apps/chronos/models.py
aleksis/apps/chronos/preferences.py
+31
-1
31 additions, 1 deletion
aleksis/apps/chronos/preferences.py
with
41 additions
and
2 deletions
aleksis/apps/chronos/models.py
+
10
−
1
View file @
0544f72c
...
...
@@ -67,7 +67,7 @@ from aleksis.core.mixins import (
SchoolTermRelatedExtensibleModel
,
)
from
aleksis.core.models
import
CalendarEvent
,
DashboardWidget
,
Group
,
Person
,
Room
,
SchoolTerm
from
aleksis.core.util.core_helpers
import
has_person
from
aleksis.core.util.core_helpers
import
get_site_preferences
,
has_person
class
ValidityRange
(
ExtensibleModel
):
...
...
@@ -1476,6 +1476,10 @@ class LessonEvent(CalendarEvent):
"""
Get the description of the lesson event.
"""
return
render_to_string
(
"
chronos/lesson_event_description.txt
"
,
{
"
event
"
:
reference_object
})
@classmethod
def
get_color
(
cls
,
request
:
HttpRequest
|
None
=
None
)
->
str
:
return
get_site_preferences
()[
"
chronos__lesson_color
"
]
@classmethod
def
value_color
(
cls
,
reference_object
:
LessonEvent
,
request
:
HttpRequest
|
None
=
None
)
->
str
:
"""
Get the color of the lesson event.
"""
...
...
@@ -1522,6 +1526,7 @@ class LessonEvent(CalendarEvent):
"
amends
"
:
cls
.
value_meta
(
reference_object
.
amends
,
request
)
if
reference_object
.
amends
else
None
,
"
title
"
:
reference_object
.
title
,
"
teachers
"
:
[
{
"
id
"
:
t
.
pk
,
...
...
@@ -1627,6 +1632,10 @@ class SupervisionEvent(LessonEvent):
"
chronos/supervision_event_description.txt
"
,
{
"
event
"
:
reference_object
}
)
@classmethod
def
get_color
(
cls
,
request
:
HttpRequest
|
None
=
None
)
->
str
:
return
get_site_preferences
()[
"
chronos__supervision_color
"
]
@classmethod
def
get_objects
(
cls
,
request
:
HttpRequest
|
None
=
None
,
params
:
dict
[
str
,
any
]
|
None
=
None
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/preferences.py
+
31
−
1
View file @
0544f72c
...
...
@@ -2,8 +2,14 @@ from datetime import time
from
django.utils.translation
import
gettext_lazy
as
_
from
colorfield.widgets
import
ColorWidget
from
dynamic_preferences.preferences
import
Section
from
dynamic_preferences.types
import
BooleanPreference
,
IntegerPreference
,
TimePreference
from
dynamic_preferences.types
import
(
BooleanPreference
,
IntegerPreference
,
StringPreference
,
TimePreference
,
)
from
aleksis.core.registries
import
person_preferences_registry
,
site_preferences_registry
...
...
@@ -107,3 +113,27 @@ class SendNotificationsPerson(BooleanPreference):
name
=
"
send_notifications
"
default
=
True
verbose_name
=
_
(
"
Send notifications for current timetable changes
"
)
@site_preferences_registry.register
class
LessonEventFeedColor
(
StringPreference
):
"""
Color for the lesson calendar feed.
"""
section
=
chronos
name
=
"
lesson_color
"
default
=
"
#a7ffeb
"
verbose_name
=
_
(
"
Lesson calendar feed color
"
)
widget
=
ColorWidget
required
=
True
@site_preferences_registry.register
class
SupervisionEventFeedColor
(
StringPreference
):
"""
Color for the supervision calendar feed.
"""
section
=
chronos
name
=
"
supervision_color
"
default
=
"
#e6ee9c
"
verbose_name
=
_
(
"
Supervision calendar feed color
"
)
widget
=
ColorWidget
required
=
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment