diff --git a/aleksis/core/assets/app.js b/aleksis/core/assets/app.js index dafceaa5e5aae60dcf917c1ab6378554003e3eda..ed2e2caafa8f6cd2078f956d05600c844f4cf842 100644 --- a/aleksis/core/assets/app.js +++ b/aleksis/core/assets/app.js @@ -18,7 +18,7 @@ const i18n = new VueI18n({ locale: "en", fallbackLocale: "en", messages, - dateTimeFormats + dateTimeFormats, }); // Using this function, apps can register their locale files diff --git a/aleksis/core/assets/components/notifications/NotificationItem.vue b/aleksis/core/assets/components/notifications/NotificationItem.vue index 04e916f0894d023fe2c6d9162607851477a30952..b1dea65c167df9417803a6e7c532309acce75325 100644 --- a/aleksis/core/assets/components/notifications/NotificationItem.vue +++ b/aleksis/core/assets/components/notifications/NotificationItem.vue @@ -7,7 +7,9 @@ <v-list-item :input-value="!notification.read"> <v-list-item-avatar> <v-icon - :class="notification.read ? 'grey lighten-1' : 'primary white--text'" + :class=" + notification.read ? 'grey lighten-1' : 'primary white--text' + " dark > mdi-{{ notification.icon.toLowerCase().replaceAll("_", "-") }} @@ -26,11 +28,13 @@ <v-chip x-small outlined>{{ notification.sender }}</v-chip> · <v-tooltip bottom> - <template v-slot:activator="{ on, attrs }"> - <span - v-bind="attrs" - v-on="on" - >{{ $d(new Date(notification.created), dateFormat(new Date(notification.created))) }}</span> + <template #activator="{ on, attrs }"> + <span v-bind="attrs" v-on="on">{{ + $d( + new Date(notification.created), + dateFormat(new Date(notification.created)) + ) + }}</span> </template> <span>{{ $d(new Date(notification.created), "long") }}</span> </v-tooltip> @@ -39,7 +43,7 @@ <v-list-item-action> <v-tooltip bottom> - <template v-slot:activator="{ on, attrs }"> + <template #activator="{ on, attrs }"> <v-btn icon color="secondary" @@ -55,7 +59,7 @@ </v-tooltip> <v-tooltip bottom> - <template v-slot:activator="{ on, attrs }"> + <template #activator="{ on, attrs }"> <v-btn icon color="accent" @@ -86,12 +90,16 @@ export default { methods: { dateFormat(date) { let now = new Date(); - if (now.getFullYear() === date.getFullYear() && now.getMonth() === date.getMonth() && now.getDate() === date.getDate()) { - return "timeOnly" + if ( + now.getFullYear() === date.getFullYear() && + now.getMonth() === date.getMonth() && + now.getDate() === date.getDate() + ) { + return "timeOnly"; } else { - return "short" + return "short"; } - } - } + }, + }, }; </script> diff --git a/aleksis/core/assets/components/notifications/NotificationList.vue b/aleksis/core/assets/components/notifications/NotificationList.vue index 9c011acf526408c3e2a1cf1e40f1219cfb3bedcc..7e16ee197f93ff3c4f68e6d1275e2a175272c64f 100644 --- a/aleksis/core/assets/components/notifications/NotificationList.vue +++ b/aleksis/core/assets/components/notifications/NotificationList.vue @@ -1,29 +1,57 @@ <template> <ApolloQuery - :query="require('./myNotifications.graphql')" - :poll-interval="1000" + :query="require('./myNotifications.graphql')" + :poll-interval="1000" > <template #default="{ result: { error, data, loading } }"> - <v-menu offset-y :close-on-content-click="false" max-width="min(600px, 80vw)" width="min-content" - max-height="90%"> - <template v-slot:activator="{ on, attrs }"> - <v-btn icon color="primary" v-bind="attrs" v-on="on" :loading="loading"> - <v-icon color="white" v-if="data && data.myNotifications.unreadNotificationsCount > 0"> + <v-menu + offset-y + :close-on-content-click="false" + max-width="min(600px, 80vw)" + width="min-content" + max-height="90%" + > + <template #activator="{ on, attrs }"> + <v-btn + icon + color="primary" + v-bind="attrs" + v-on="on" + :loading="loading" + > + <v-icon + color="white" + v-if="data && data.myNotifications.unreadNotificationsCount > 0" + > mdi-bell-badge-outline </v-icon> <v-icon color="white" v-else>mdi-bell-outline</v-icon> </v-btn> </template> <v-list nav three-line dense class="overflow-y-auto"> - <template v-if="data && data.myNotifications && data.myNotifications.notifications.length"> + <template + v-if=" + data && + data.myNotifications && + data.myNotifications.notifications.length + " + > <v-subheader>{{ $t("notifications.notifications") }}</v-subheader> - <template v-for="notification in data.myNotifications.notifications"> + <template + v-for="notification in data.myNotifications.notifications" + > <NotificationItem - :key="notification.id" - :notification="notification" + :key="notification.id" + :notification="notification" /> <v-divider - v-if="notification !== data.myNotifications.notifications[data.myNotifications.notifications.length - 1]" + v-if=" + notification !== + data.myNotifications.notifications[ + data.myNotifications.notifications.length - 1 + ] + " + :key="notification.id + '-divider'" ></v-divider> </template> </template> diff --git a/aleksis/core/assets/dateTimeFormats.js b/aleksis/core/assets/dateTimeFormats.js index 03d6b60af218fca1e6a86caa0bc458464a2cd47a..eb9131f979e96413e9f869255dc960022fb9d592 100644 --- a/aleksis/core/assets/dateTimeFormats.js +++ b/aleksis/core/assets/dateTimeFormats.js @@ -1,24 +1,44 @@ const dateTimeFormats = { - en: { - short: { - year: "numeric", month: "short", day: "numeric" - }, - long: { - year: "numeric", month: "long", day: "numeric", weekday: "long", hour: "numeric", minute: "numeric" - }, - timeOnly: { - hour: "numeric", minute: "numeric", second: "numeric" - } - }, de: { - short: { - year: "numeric", month: "short", day: "numeric" - }, long: { - year: "numeric", month: "long", day: "numeric", weekday: "long", hour: "numeric", minute: "numeric" - }, - timeOnly: { - hour: "numeric", minute: "numeric", second: "numeric" - } - } -} + en: { + short: { + year: "numeric", + month: "short", + day: "numeric", + }, + long: { + year: "numeric", + month: "long", + day: "numeric", + weekday: "long", + hour: "numeric", + minute: "numeric", + }, + timeOnly: { + hour: "numeric", + minute: "numeric", + second: "numeric", + }, + }, + de: { + short: { + year: "numeric", + month: "short", + day: "numeric", + }, + long: { + year: "numeric", + month: "long", + day: "numeric", + weekday: "long", + hour: "numeric", + minute: "numeric", + }, + timeOnly: { + hour: "numeric", + minute: "numeric", + second: "numeric", + }, + }, +}; export default dateTimeFormats; diff --git a/aleksis/core/models.py b/aleksis/core/models.py index 82af52097e7dc2f5d074b3863ec55bf64497c280..9bf3f0d12eb8bf7f9b9b7c03319647903acf6ea8 100644 --- a/aleksis/core/models.py +++ b/aleksis/core/models.py @@ -749,7 +749,9 @@ class Notification(ExtensibleModel, TimeStampedModel): description = models.TextField(max_length=500, verbose_name=_("Description")) link = models.URLField(blank=True, verbose_name=_("Link")) - icon = models.CharField(max_length=50, choices=ICONS, verbose_name=_("Icon"), default="information-outline") + icon = models.CharField( + max_length=50, choices=ICONS, verbose_name=_("Icon"), default="information-outline" + ) send_at = models.DateTimeField(default=timezone.now, verbose_name=_("Send notification at")) diff --git a/aleksis/core/views.py b/aleksis/core/views.py index 0fec1b61162f2522d949458f8ede0ea547d72a80..f09631ddb50cc874ec0e9573a3e6bcdc58690fd6 100644 --- a/aleksis/core/views.py +++ b/aleksis/core/views.py @@ -239,8 +239,6 @@ def index(request: HttpRequest) -> HttpResponse: return render(request, "core/index.html", context) - - def about(request: HttpRequest) -> HttpResponse: """About page listing all apps.""" context = {}