Fix courses visibility toggler button (#257)

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
Emruz Hossain 2021-03-23 21:46:41 +06:00 committed by GitHub
parent cf88e95782
commit 2af89479be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 68 additions and 24 deletions

View file

@ -68,8 +68,11 @@ other = "অর্জিত ক্রেডিট"
[extracurricular_activities]
other = "পাঠক্রম বহির্ভূত কার্যক্রম"
[see_more]
other = "আরো দেখুন"
[show_more]
other = "আরো দেখান"
[show_less]
other = "কম দেখান"
[responsibilities]
other = "দায়িত্বসমুহ:"

View file

@ -71,9 +71,12 @@ other = "获得分数"
[extracurricular_activities]
other = "课外活动"
[see_more]
[show_more]
other = "查看更多"
[show_less]
other = "显示较少"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Krediet verkregen"
[extracurricular_activities]
other = "Buitenschoolse activiteiten"
[see_more]
[show_more]
other = "Bekijk meer"
[show_less]
other = "Laat minder zien"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,8 +71,11 @@ other = "Obtained Credit"
[extracurricular_activities]
other = "Extracurricular Activities"
[see_more]
other = "See More"
[show_more]
other = "Show More"
[show_less]
other = "Show Less"
[responsibilities]
other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Crédito obtenido"
[extracurricular_activities]
other = "Actividades extracurriculares"
[see_more]
[show_more]
other = "Ver más"
[show_less]
other = "Muestra menos"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Crédit obtenu"
[extracurricular_activities]
other = "Activités extra-scolaires"
[see_more]
[show_more]
other = "En savoir plus"
[show_less]
other = "Montrer moins"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "श्रेय प्राप्त किया"
[extracurricular_activities]
other = "अतिरिक्त पाठयक्रम गतिविधियों"
[see_more]
[show_more]
other = "और देखें"
[show_less]
other = "कम दिखाएं"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Memperoleh Kredit"
[extracurricular_activities]
other = "Kegiatan ekstrakulikuler"
[see_more]
[show_more]
other = "Lihat Selengkapnya"
[show_less]
other = "Tampilkan Lebih Sedikit"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Credito ottenuto"
[extracurricular_activities]
other = "Attività extracurriculari"
[see_more]
[show_more]
other = "Vedi altro"
[show_less]
other = "Mostra meno"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -68,9 +68,12 @@ other = "取得したクレジット"
[extracurricular_activities]
other = "課外活動"
[see_more]
[show_more]
other = "続きを見る"
[show_less]
other = "表示を減らす"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "획득한 수익"
[extracurricular_activities]
other = "기타 활동"
[see_more]
[show_more]
other = "더보기"
[show_less]
other = "간단히보기"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Полученный кредит"
[extracurricular_activities]
other = "Внеклассные занятия"
[see_more]
[show_more]
other = "Узнать больше"
[show_less]
other = "Показывай меньше"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -71,9 +71,12 @@ other = "Tín dụng thu được"
[extracurricular_activities]
other = "Các hoạt động ngoại khóa"
[see_more]
[show_more]
other = "Xem thêm"
[show_less]
other = "Hiện ít hơn"
# [responsibilities]
# other = "Responsibilities:"

View file

@ -78,7 +78,9 @@
{{ end }}
{{ if gt (len .takenCourses.courses) 2 }}
<button type="button" class="btn btn-link show-more-btn pt-0 {{ if .takenCourses.showGrades }}ml-1{{ else }}ml-2{{ end }}"
onclick="showMoreCourses(this);">{{ i18n "see_more"}}</button>
onclick="toggleCourseVisibility(this);" id="show-more-btn">{{ i18n "show_more"}}</button>
<button type="button" class="btn btn-link show-more-btn hidden pt-0 {{ if .takenCourses.showGrades }}ml-1{{ else }}ml-2{{ end }}"
onclick="toggleCourseVisibility(this);" id="show-less-btn">{{ i18n "show_less"}}</button>
{{ end }}
</div>
{{ end }}

View file

@ -78,7 +78,9 @@
{{ end }}
{{ if gt (len .takenCourses.courses ) 2 }}
<button type="button" class="btn btn-link show-more-btn pt-0 {{ if .takenCourses.showGrades }}ml-1{{ else }}ml-2{{ end }}"
onclick="showMoreCourses(this);">{{ i18n "see_more"}}</button>
onclick="toggleCourseVisibility(this);" id="show-more-btn">{{ i18n "show_more"}}</button>
<button type="button" class="btn btn-link show-more-btn hidden pt-0 {{ if .takenCourses.showGrades }}ml-1{{ else }}ml-2{{ end }}"
onclick="toggleCourseVisibility(this);" id="show-less-btn">{{ i18n "show_less"}}</button>
{{ end }}
</div>
{{ end }}

View file

@ -139,7 +139,7 @@ function toggleTOC() {
}
// Show more rows in the taken courses table
function showMoreCourses(elem) {
function toggleCourseVisibility(elem) {
// find the courses
let courses = elem.parentNode.getElementsByClassName("course");
@ -154,11 +154,12 @@ function showMoreCourses(elem) {
}
}
// toggle the button text
let btnText = elem.innerText;
if (btnText == "Show More") {
elem.innerText = "Show Less";
} else {
elem.innerText = "Show More";
// toggle the current button visibility
elem.classList.toggle("hidden");
// toggle the alternate button visibility
if (elem.id === "show-more-btn"){
document.getElementById("show-less-btn").classList.toggle("hidden");
}else{
document.getElementById("show-more-btn").classList.toggle("hidden");
}
}