Skip to content

Commit a2f35f3

Browse files
chore: resolve some linting errors
1 parent 81fb856 commit a2f35f3

File tree

8 files changed

+55
-51
lines changed

8 files changed

+55
-51
lines changed

intranet/apps/announcements/forms.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ class Meta:
2424
help_texts = {
2525
"expiration_date": "By default, announcements expire after two weeks. Choose the shortest time necessary.",
2626
"notify_post": "If this box is checked, students who have signed up for notifications will receive an email.",
27-
"notify_email_all": "This will send an email notification to all of the users who can see this post. This option does NOT take users' email notification preferences into account, so please use with care.",
28-
"update_added_date": "If this announcement has already been added, update the added date to now so that the announcement is pushed to the top. If this option is not selected, the announcement will stay in its current position.",
27+
"notify_email_all": (
28+
"This will send an email notification to all of the users who can see this post. "
29+
"This option does NOT take users' email notification preferences into account, so please use with care."
30+
),
31+
"update_added_date": (
32+
"If this announcement has already been added, update the added date to now so that the announcement is pushed to the top. "
33+
"If this option is not selected, the announcement will stay in its current position."
34+
),
2935
}
3036

3137

intranet/apps/eighth/forms/activities.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List # noqa
2-
31
from django import forms
42
from django.contrib.auth import get_user_model
53

intranet/apps/eighth/views/activities.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ def settings_view(request, activity_id=None):
5959
if not (EighthSponsor.objects.filter(user=request.user).exists() or request.user in activity.club_sponsors.all()):
6060
raise Http404
6161

62-
print(activity.sponsors.all())
63-
6462
if request.method == "POST":
6563
form = ActivitySettingsForm(request.POST, instance=activity, sponsors=activity.sponsors.all())
6664
if form.is_valid():

intranet/static/css/dark/dashboard.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ a.club-announcement-meta-link:hover {
5454

5555
.announcements {
5656
.announcement-banner {
57-
background-color: #000000;
57+
background-color: #000;
5858
}
59+
5960
.announcement-link {
6061
color: #a3a3a3;
6162
}

intranet/static/css/dashboard.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,15 @@
7373
&::-webkit-scrollbar {
7474
width: 7px;
7575
}
76+
7677
&::-webkit-scrollbar-track {
7778
background: #d6d6d6;
7879
}
80+
7981
&::-webkit-scrollbar-thumb {
8082
background: #888;
8183
}
84+
8285
&::-webkit-scrollbar-thumb:hover {
8386
background: #555;
8487
}

intranet/static/js/announcement.form.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
function zero(v) {
2+
return v < 10 ? "0" + v : v;
3+
}
4+
5+
function dateFormat(date) {
6+
return (date.getFullYear() + "-" +
7+
zero(date.getMonth() + 1) + "-" +
8+
zero(date.getDate()) + " 23:59:59");
9+
}
10+
11+
function dateReset(exp) {
12+
var date = new Date();
13+
date.setDate(date.getDate() + 14);
14+
exp.val(dateFormat(date));
15+
}
16+
17+
function date3000(exp) {
18+
var date = new Date("3000-01-01 00:00:00");
19+
exp.val(dateFormat(date));
20+
}
21+
122
/* global $ */
223
$(function() {
324
$("select#id_groups").selectize({
@@ -51,15 +72,15 @@ $(function() {
5172
var text = editor.getData();
5273
dates = chrono.parse(text)
5374
.sort(function (a, b) {
54-
var a_date = a.end ? a.end.date() : a.start.date();
55-
var b_date = b.end ? b.end.date() : b.start.date();
56-
return b_date.getTime() - a_date.getTime();
75+
var aDate = a.end ? a.end.date() : a.start.date();
76+
var bDate = b.end ? b.end.date() : b.start.date();
77+
return bDate.getTime() - aDate.getTime();
5778
})
5879
.filter(function (val, ind, ary) {
5980
if (ind) {
60-
var a_date = val.end ? val.end.date() : val.start.date();
61-
var b_date = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
62-
return !ind || a_date.getTime() != b_date.getTime();
81+
var aDate = val.end ? val.end.date() : val.start.date();
82+
var bDate = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
83+
return !ind || aDate.getTime() != bDate.getTime();
6384
} else {
6485
return true;
6586
}
@@ -70,9 +91,9 @@ $(function() {
7091
else
7192
$(".exp-header").css("display", "none");
7293
for (var i = 0; i < dates.length; i++) {
73-
var use_date = dates[i].end ? dates[i].end.date() : dates[i].start.date();
74-
var display_date = use_date.toDateString();
75-
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${use_date}'>"${dates[i].text}" - ${display_date}</a></li>`);
94+
var useDate = dates[i].end ? dates[i].end.date() : dates[i].start.date();
95+
var displayDate = useDate.toDateString();
96+
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${useDate}'>"${dates[i].text}" - ${displayDate}</a></li>`);
7697
}
7798
});
7899

@@ -81,15 +102,15 @@ $(function() {
81102
var text = editor.getData();
82103
dates = chrono.parse(text)
83104
.sort(function (a, b) {
84-
var a_date = a.end ? a.end.date() : a.start.date();
85-
var b_date = b.end ? b.end.date() : b.start.date();
86-
return b_date.getTime() - a_date.getTime();
105+
var aDate = a.end ? a.end.date() : a.start.date();
106+
var bDate = b.end ? b.end.date() : b.start.date();
107+
return bDate.getTime() - aDate.getTime();
87108
})
88109
.filter(function (val, ind, ary) {
89110
if (ind) {
90-
var a_date = val.end ? val.end.date() : val.start.date();
91-
var b_date = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
92-
return !ind || a_date.getTime() != b_date.getTime();
111+
var aDate = val.end ? val.end.date() : val.start.date();
112+
var bDate = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
113+
return !ind || aDate.getTime() != bDate.getTime();
93114
} else {
94115
return true;
95116
}
@@ -100,9 +121,9 @@ $(function() {
100121
else
101122
$(".exp-header").css("display", "none");
102123
for (var i = 0; i < dates.length; i++) {
103-
var use_date = dates[i].end ? dates[i].end.date() : dates[i].start.date();
104-
var display_date = use_date.toDateString();
105-
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${use_date}'>"${dates[i].text}" - ${display_date}</a></li>`);
124+
var useDate = dates[i].end ? dates[i].end.date() : dates[i].start.date();
125+
var displayDate = useDate.toDateString();
126+
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${useDate}'>"${dates[i].text}" - ${displayDate}</a></li>`);
106127
}
107128
});
108129

@@ -120,7 +141,7 @@ $(function() {
120141

121142
$(".exp-list").on("click", "a", function () {
122143
exp.val(dateFormat(new Date($(this).data("date"))));
123-
})
144+
});
124145

125146
$("#date-reset-btn").click(function () {
126147
dateReset(exp);
@@ -130,24 +151,3 @@ $(function() {
130151
date3000(exp);
131152
});
132153
});
133-
134-
function dateReset(exp) {
135-
var date = new Date();
136-
date.setDate(date.getDate() + 14);
137-
exp.val(dateFormat(date));
138-
}
139-
140-
function date3000(exp) {
141-
var date = new Date("3000-01-01 00:00:00");
142-
exp.val(dateFormat(date));
143-
}
144-
145-
function dateFormat(date) {
146-
return (date.getFullYear() + "-" +
147-
zero(date.getMonth() + 1) + "-" +
148-
zero(date.getDate()) + " 23:59:59");
149-
}
150-
151-
function zero(v) {
152-
return v < 10 ? "0" + v : v;
153-
}

intranet/static/js/dashboard/announcements.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ $(document).ready(function() {
6262
filterClubAnnouncements();
6363
});
6464

65-
if (flipToUnsubscribed) {
65+
const params = new URLSearchParams(window.location.search);
66+
if (params.get("flip_to") == "unsubscribed") {
6667
$(".unsubscribed-filter").click();
6768
}
6869
});

intranet/templates/dashboard/dashboard.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
{% block js %}
3131
{{ block.super }}
3232

33-
<script>
34-
const flipToUnsubscribed = "{{ request.GET.flip_to }}" == "unsubscribed";
35-
</script>
3633
<script src="{% static 'js/dashboard/eighth-widget.js' %}"></script>
3734
<script src="{% static 'js/schedule.js' %}"></script>
3835
<script src="{% static 'js/events.js' %}"></script>

0 commit comments

Comments
 (0)