Skip to content

Commit

Permalink
chore: resolve some linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed Oct 6, 2024
1 parent 81fb856 commit a2f35f3
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 51 deletions.
10 changes: 8 additions & 2 deletions intranet/apps/announcements/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class Meta:
help_texts = {
"expiration_date": "By default, announcements expire after two weeks. Choose the shortest time necessary.",
"notify_post": "If this box is checked, students who have signed up for notifications will receive an email.",
"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.",
"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.",
"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."
),
"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."
),
}


Expand Down
2 changes: 0 additions & 2 deletions intranet/apps/eighth/forms/activities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List # noqa

from django import forms
from django.contrib.auth import get_user_model

Expand Down
2 changes: 0 additions & 2 deletions intranet/apps/eighth/views/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def settings_view(request, activity_id=None):
if not (EighthSponsor.objects.filter(user=request.user).exists() or request.user in activity.club_sponsors.all()):
raise Http404

print(activity.sponsors.all())

if request.method == "POST":
form = ActivitySettingsForm(request.POST, instance=activity, sponsors=activity.sponsors.all())
if form.is_valid():
Expand Down
3 changes: 2 additions & 1 deletion intranet/static/css/dark/dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ a.club-announcement-meta-link:hover {

.announcements {
.announcement-banner {
background-color: #000000;
background-color: #000;
}

.announcement-link {
color: #a3a3a3;
}
Expand Down
3 changes: 3 additions & 0 deletions intranet/static/css/dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@
&::-webkit-scrollbar {
width: 7px;
}

&::-webkit-scrollbar-track {
background: #d6d6d6;
}

&::-webkit-scrollbar-thumb {
background: #888;
}

&::-webkit-scrollbar-thumb:hover {
background: #555;
}
Expand Down
80 changes: 40 additions & 40 deletions intranet/static/js/announcement.form.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
function zero(v) {
return v < 10 ? "0" + v : v;
}

function dateFormat(date) {
return (date.getFullYear() + "-" +
zero(date.getMonth() + 1) + "-" +
zero(date.getDate()) + " 23:59:59");
}

function dateReset(exp) {
var date = new Date();
date.setDate(date.getDate() + 14);
exp.val(dateFormat(date));
}

function date3000(exp) {
var date = new Date("3000-01-01 00:00:00");
exp.val(dateFormat(date));
}

/* global $ */
$(function() {
$("select#id_groups").selectize({
Expand Down Expand Up @@ -51,15 +72,15 @@ $(function() {
var text = editor.getData();
dates = chrono.parse(text)
.sort(function (a, b) {
var a_date = a.end ? a.end.date() : a.start.date();
var b_date = b.end ? b.end.date() : b.start.date();
return b_date.getTime() - a_date.getTime();
var aDate = a.end ? a.end.date() : a.start.date();
var bDate = b.end ? b.end.date() : b.start.date();
return bDate.getTime() - aDate.getTime();
})
.filter(function (val, ind, ary) {
if (ind) {
var a_date = val.end ? val.end.date() : val.start.date();
var b_date = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
return !ind || a_date.getTime() != b_date.getTime();
var aDate = val.end ? val.end.date() : val.start.date();
var bDate = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
return !ind || aDate.getTime() != bDate.getTime();
} else {
return true;
}
Expand All @@ -70,9 +91,9 @@ $(function() {
else
$(".exp-header").css("display", "none");
for (var i = 0; i < dates.length; i++) {
var use_date = dates[i].end ? dates[i].end.date() : dates[i].start.date();
var display_date = use_date.toDateString();
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${use_date}'>"${dates[i].text}" - ${display_date}</a></li>`);
var useDate = dates[i].end ? dates[i].end.date() : dates[i].start.date();
var displayDate = useDate.toDateString();
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${useDate}'>"${dates[i].text}" - ${displayDate}</a></li>`);
}
});

Expand All @@ -81,15 +102,15 @@ $(function() {
var text = editor.getData();
dates = chrono.parse(text)
.sort(function (a, b) {
var a_date = a.end ? a.end.date() : a.start.date();
var b_date = b.end ? b.end.date() : b.start.date();
return b_date.getTime() - a_date.getTime();
var aDate = a.end ? a.end.date() : a.start.date();
var bDate = b.end ? b.end.date() : b.start.date();
return bDate.getTime() - aDate.getTime();
})
.filter(function (val, ind, ary) {
if (ind) {
var a_date = val.end ? val.end.date() : val.start.date();
var b_date = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
return !ind || a_date.getTime() != b_date.getTime();
var aDate = val.end ? val.end.date() : val.start.date();
var bDate = ary[ind - 1].end ? ary[ind - 1].end.date() : ary[ind - 1].start.date();
return !ind || aDate.getTime() != bDate.getTime();
} else {
return true;
}
Expand All @@ -100,9 +121,9 @@ $(function() {
else
$(".exp-header").css("display", "none");
for (var i = 0; i < dates.length; i++) {
var use_date = dates[i].end ? dates[i].end.date() : dates[i].start.date();
var display_date = use_date.toDateString();
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${use_date}'>"${dates[i].text}" - ${display_date}</a></li>`);
var useDate = dates[i].end ? dates[i].end.date() : dates[i].start.date();
var displayDate = useDate.toDateString();
$(".exp-list").append(`<li><a class='exp-suggest-item' data-date='${useDate}'>"${dates[i].text}" - ${displayDate}</a></li>`);
}
});

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

$(".exp-list").on("click", "a", function () {
exp.val(dateFormat(new Date($(this).data("date"))));
})
});

$("#date-reset-btn").click(function () {
dateReset(exp);
Expand All @@ -130,24 +151,3 @@ $(function() {
date3000(exp);
});
});

function dateReset(exp) {
var date = new Date();
date.setDate(date.getDate() + 14);
exp.val(dateFormat(date));
}

function date3000(exp) {
var date = new Date("3000-01-01 00:00:00");
exp.val(dateFormat(date));
}

function dateFormat(date) {
return (date.getFullYear() + "-" +
zero(date.getMonth() + 1) + "-" +
zero(date.getDate()) + " 23:59:59");
}

function zero(v) {
return v < 10 ? "0" + v : v;
}
3 changes: 2 additions & 1 deletion intranet/static/js/dashboard/announcements.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ $(document).ready(function() {
filterClubAnnouncements();
});

if (flipToUnsubscribed) {
const params = new URLSearchParams(window.location.search);
if (params.get("flip_to") == "unsubscribed") {
$(".unsubscribed-filter").click();
}
});
Expand Down
3 changes: 0 additions & 3 deletions intranet/templates/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
{% block js %}
{{ block.super }}

<script>
const flipToUnsubscribed = "{{ request.GET.flip_to }}" == "unsubscribed";
</script>
<script src="{% static 'js/dashboard/eighth-widget.js' %}"></script>
<script src="{% static 'js/schedule.js' %}"></script>
<script src="{% static 'js/events.js' %}"></script>
Expand Down

0 comments on commit a2f35f3

Please sign in to comment.