Skip to content

Commit 8f6b305

Browse files
authored
Merge pull request #1005 from thecourseforum/issue-991-icon-fixes
Issue 991 icon fixes
2 parents 09e00d4 + f25c94c commit 8f6b305

File tree

7 files changed

+102
-10
lines changed

7 files changed

+102
-10
lines changed

tcf_website/static/icons/icons.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,27 @@
182182
background-position: center;
183183
}
184184

185+
.fa-chevron-up-white {
186+
width: 1em;
187+
height: 1em;
188+
background-image: url("../icons/img/fa-chevron-up.svg");
189+
background-repeat: no-repeat;
190+
background-size: contain;
191+
background-position: center;
192+
filter: invert(1);
193+
}
194+
195+
.fa-chevron-down-white {
196+
width: 1em;
197+
height: 1em;
198+
background-image: url("../icons/img/fa-chevron-down.svg");
199+
background-repeat: no-repeat;
200+
background-size: contain;
201+
background-position: center;
202+
filter: invert(1);
203+
}
204+
205+
185206
.fa-thumbs-up {
186207
width: 1em;
187208
height: 1em;
@@ -294,3 +315,18 @@
294315
background-size: contain;
295316
background-position: center;
296317
}
318+
319+
.fa-flask {
320+
background-image: url("../icons/img/fa-flask.svg");
321+
background-repeat: no-repeat;
322+
background-size: contain;
323+
background-position: center;
324+
}
325+
326+
.invert-to-light {
327+
filter: invert(1);
328+
}
329+
330+
.invert-to-dark {
331+
filter: invert(0);
332+
}
Lines changed: 1 addition & 0 deletions
Loading

tcf_website/templates/browse/browse.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,24 @@ <h2 class="font-weight-light mt-4">Browse by Department</h2>
3232
</div>
3333
</div>
3434
{% endblock %}
35+
36+
{% block js %}
37+
<script>
38+
document.addEventListener("DOMContentLoaded", function () {
39+
document.querySelectorAll(".card-header").forEach(header => {
40+
header.addEventListener("click", function () {
41+
let schoolId = this.id.replace("header-", "").trim(); // Extract school ID
42+
43+
let icon = document.getElementById(`chevron-${schoolId}`); // Find the icon
44+
45+
if (icon) {
46+
icon.classList.toggle("fa-chevron-down-white");
47+
icon.classList.toggle("fa-chevron-up-white");
48+
} else {
49+
console.warn("Icon not found for school ID:", schoolId);
50+
}
51+
});
52+
});
53+
});
54+
</script>
55+
{% endblock %}
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<div class="school card mb-3">
22
<div class="card-header pt-3" data-toggle="collapse"
3-
data-target="#school-{{ school.id }}" aria-expanded="true">
3+
data-target="#school-{{ school.id }}" aria-expanded="true"
4+
id="header-{{ school.id }}">
45
<div class="float-left">
5-
<h3 class="card-title mb-0 alignleft">{{school.name}}</h3>
6+
<h3 class="card-title mb-0 alignleft">{{ school.name }}</h3>
67
</div>
78
<div class="float-right">
8-
<h3><i class="fa fa-chevron-down"></i></h3>
9+
<i class="fa fa-chevron-down-white" id="chevron-{{ school.id }}"></i>
910
</div>
1011
<div class="clearfix"></div>
1112
</div>
1213
<div class="school-body collapse show" id="school-{{ school.id }}">
1314
<ul class="department-list">
1415
{% for d in school.department_set.all|dictsort:"name" %}
1516
<li>
16-
<a href="{% url 'department' dept_id=d.pk %}">{{d}}</a>
17+
<a href="{% url 'department' dept_id=d.pk %}">{{ d }}</a>
1718
</li>
1819
{% endfor %}
1920
</ul>
2021
</div>
21-
</div>
22+
</div>

tcf_website/templates/course/course_professor.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
{% block styles %}
77
<link rel="stylesheet" href="{% static 'course/course_professor.css' %}"/>
8-
<link rel="stylesheet" href="{% static 'icons/icons.css' %}"/>
98
{% endblock %}
109

1110
{% block content %}
@@ -131,7 +130,7 @@ <h2 class="mr-md-3">{{ course.title }}</h2>
131130
<div class="info-container">
132131
<div class="info-row">
133132
<div class="info-title">
134-
<i class="fas fa-book"></i>&nbsp;Reading
133+
<i class="fa fa-book invert-to-dark"></i>&nbsp;Reading
135134
</div>
136135
<div class="info-bar">
137136
<div class="progress">
@@ -144,7 +143,7 @@ <h2 class="mr-md-3">{{ course.title }}</h2>
144143
</div>
145144
<div class="info-row">
146145
<div class="info-title">
147-
<i class="fas fa-pencil-alt"></i>&nbsp;Writing
146+
<i class="fa fa-pencil invert-to-dark"></i>&nbsp;Writing
148147
</div>
149148
<div class="info-bar">
150149
<div class="progress">
@@ -157,7 +156,7 @@ <h2 class="mr-md-3">{{ course.title }}</h2>
157156
</div>
158157
<div class="info-row">
159158
<div class="info-title">
160-
<i class="fas fa-user-friends"></i>&nbsp;Groupwork
159+
<i class="fa fa-user-friends"></i>&nbsp;Groupwork
161160
</div>
162161
<div class="info-bar">
163162
<div class="progress">
@@ -170,7 +169,7 @@ <h2 class="mr-md-3">{{ course.title }}</h2>
170169
</div>
171170
<div class="info-row">
172171
<div class="info-title">
173-
<i class="fas fa-flask"></i>&nbsp;Other
172+
<i class="fa fa-flask invert-to-dark"></i>&nbsp;Other
174173
</div>
175174
<div class="info-bar">
176175
<div class="progress">

tcf_website/templates/landing/landing.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,25 @@ <h5>Follow
349349
{% block js %}
350350
<!-- <script type="module" src="{% static 'landing/feedbackform.js' %}"></script> -->
351351
<script type="text/javascript">
352+
353+
document.addEventListener("DOMContentLoaded", function () {
354+
document.querySelectorAll(".faqs-content h5").forEach(header => {
355+
header.addEventListener("click", function () {
356+
let icon = this.querySelector("i.fas"); // Find the <i> inside the h5
357+
358+
if (icon) {
359+
icon.classList.toggle("fa-chevron-down");
360+
icon.classList.toggle("fa-chevron-up");
361+
} else {
362+
console.warn("Chevron icon not found in FAQ header:", this);
363+
}
364+
});
365+
});
366+
367+
// Update copyright year at the bottom of landing page
368+
$(".year").text(new Date().getFullYear());
369+
});
370+
352371
// Update copyright year at the bottom of landing page
353372
$(".year").text(new Date().getFullYear());
354373
</script>

tcf_website/templates/search/search.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ <h3 class="mr-3">Departments</h3>
167167

168168
{% block js %}
169169
<script>
170+
document.addEventListener("DOMContentLoaded", function () {
171+
document.querySelectorAll(".hover-tcf-orange").forEach(header => {
172+
header.addEventListener("click", function () {
173+
let icon = this.querySelector("i.fas.fa-chevron-down, i.fas.fa-chevron-up");
174+
console.log("Icon found:", icon);
175+
176+
if (icon) {
177+
icon.classList.toggle("fa-chevron-down");
178+
icon.classList.toggle("fa-chevron-up");
179+
} else {
180+
console.warn("Icon not found.");
181+
}
182+
});
183+
});
184+
});
170185
// Search results should display some content at all times
171186
// Thus the current open accordion will not be able to close itself
172187
$('[data-toggle="collapse"]').on('click',function(e) {

0 commit comments

Comments
 (0)