From dba74f2cbf8bb549b6a7c3df359a3e033c93a071 Mon Sep 17 00:00:00 2001 From: hossainemruz Date: Tue, 23 Mar 2021 21:43:07 +0600 Subject: [PATCH] Fix courses visibility toggler button Signed-off-by: hossainemruz --- i18n/bn.toml | 7 +++++-- i18n/cn.toml | 5 ++++- i18n/de.toml | 5 ++++- i18n/en.toml | 7 +++++-- i18n/es.toml | 5 ++++- i18n/fr.toml | 5 ++++- i18n/hi.toml | 5 ++++- i18n/id.toml | 5 ++++- i18n/it.toml | 5 ++++- i18n/jp.toml | 5 ++++- i18n/ko.toml | 5 ++++- i18n/ru.toml | 5 ++++- i18n/vn.toml | 5 ++++- layouts/partials/sections/education-alt.html | 4 +++- layouts/partials/sections/education.html | 4 +++- static/js/main.js | 15 ++++++++------- 16 files changed, 68 insertions(+), 24 deletions(-) diff --git a/i18n/bn.toml b/i18n/bn.toml index 15f4daf..9e9ffc2 100644 --- a/i18n/bn.toml +++ b/i18n/bn.toml @@ -68,8 +68,11 @@ other = "অর্জিত ক্রেডিট" [extracurricular_activities] other = "পাঠক্রম বহির্ভূত কার্যক্রম" -[see_more] -other = "আরো দেখুন" +[show_more] +other = "আরো দেখান" + +[show_less] +other = "কম দেখান" [responsibilities] other = "দায়িত্বসমুহ:" diff --git a/i18n/cn.toml b/i18n/cn.toml index 2b8faf1..b83598f 100644 --- a/i18n/cn.toml +++ b/i18n/cn.toml @@ -71,9 +71,12 @@ other = "获得分数" [extracurricular_activities] other = "课外活动" -[see_more] +[show_more] other = "查看更多" +[show_less] +other = "显示较少" + # [responsibilities] # other = "Responsibilities:" diff --git a/i18n/de.toml b/i18n/de.toml index 90d48b6..3dcf4b4 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -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:" diff --git a/i18n/en.toml b/i18n/en.toml index 4b600ee..8a70ff2 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -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:" diff --git a/i18n/es.toml b/i18n/es.toml index 4648daf..378f045 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -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:" diff --git a/i18n/fr.toml b/i18n/fr.toml index 3a9c2e5..b895da4 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -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:" diff --git a/i18n/hi.toml b/i18n/hi.toml index ea0cd6c..3cf581d 100644 --- a/i18n/hi.toml +++ b/i18n/hi.toml @@ -71,9 +71,12 @@ other = "श्रेय प्राप्त किया" [extracurricular_activities] other = "अतिरिक्त पाठयक्रम गतिविधियों" -[see_more] +[show_more] other = "और देखें" +[show_less] +other = "कम दिखाएं" + # [responsibilities] # other = "Responsibilities:" diff --git a/i18n/id.toml b/i18n/id.toml index f2fa405..a528a60 100644 --- a/i18n/id.toml +++ b/i18n/id.toml @@ -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:" diff --git a/i18n/it.toml b/i18n/it.toml index 1d8ad81..cc8f843 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -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:" diff --git a/i18n/jp.toml b/i18n/jp.toml index 06f3f4d..7d6e329 100644 --- a/i18n/jp.toml +++ b/i18n/jp.toml @@ -68,9 +68,12 @@ other = "取得したクレジット" [extracurricular_activities] other = "課外活動" -[see_more] +[show_more] other = "続きを見る" +[show_less] +other = "表示を減らす" + # [responsibilities] # other = "Responsibilities:" diff --git a/i18n/ko.toml b/i18n/ko.toml index d4e3271..26dab1f 100644 --- a/i18n/ko.toml +++ b/i18n/ko.toml @@ -71,9 +71,12 @@ other = "획득한 수익" [extracurricular_activities] other = "기타 활동" -[see_more] +[show_more] other = "더보기" +[show_less] +other = "간단히보기" + # [responsibilities] # other = "Responsibilities:" diff --git a/i18n/ru.toml b/i18n/ru.toml index 6c02809..b4a8f9d 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -71,9 +71,12 @@ other = "Полученный кредит" [extracurricular_activities] other = "Внеклассные занятия" -[see_more] +[show_more] other = "Узнать больше" +[show_less] +other = "Показывай меньше" + # [responsibilities] # other = "Responsibilities:" diff --git a/i18n/vn.toml b/i18n/vn.toml index 98b5fec..029ebd6 100644 --- a/i18n/vn.toml +++ b/i18n/vn.toml @@ -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:" diff --git a/layouts/partials/sections/education-alt.html b/layouts/partials/sections/education-alt.html index 5ba1059..3864e3c 100644 --- a/layouts/partials/sections/education-alt.html +++ b/layouts/partials/sections/education-alt.html @@ -78,7 +78,9 @@ {{ end }} {{ if gt (len .takenCourses.courses) 2 }} + onclick="toggleCourseVisibility(this);" id="show-more-btn">{{ i18n "show_more"}} + {{ end }} {{ end }} diff --git a/layouts/partials/sections/education.html b/layouts/partials/sections/education.html index 21c195c..ec043f4 100644 --- a/layouts/partials/sections/education.html +++ b/layouts/partials/sections/education.html @@ -78,7 +78,9 @@ {{ end }} {{ if gt (len .takenCourses.courses ) 2 }} + onclick="toggleCourseVisibility(this);" id="show-more-btn">{{ i18n "show_more"}} + {{ end }} {{ end }} diff --git a/static/js/main.js b/static/js/main.js index 4975634..1be43a4 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -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"); } }