Skip to content

Commit

Permalink
💻 Option to hide explore page in customize class (#5453)
Browse files Browse the repository at this point in the history
Fixes #5427 

**How to test**
1. Log in as a teacher
2. Go to `for-teachers`
3. Go to customize class of a class with students
4. Select 'Disable explore page'
5. Log in as a student of that class
6. See if the Explore page is hidden


<img width="1406" alt="Screenshot 2024-04-22 at 16 24 58" src="https://github.com/hedyorg/hedy/assets/48122190/cb41d6f2-95a2-46bf-99df-7f34195bac35">
  • Loading branch information
Annelein authored Apr 22, 2024
1 parent c56a94c commit 65ee552
Show file tree
Hide file tree
Showing 57 changed files with 197 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
cdn, classes, database, for_teachers, s3_logger, parsons,
profile, programs, querylog, quiz, statistics,
translating, tags, surveys, public_adventures, user_activity, feedback)
from website.auth import (current_user, is_admin, is_teacher, is_second_teacher, has_public_profile,
from website.auth import (current_user, hide_explore, is_admin, is_teacher, is_second_teacher, has_public_profile,
login_user_from_token_cookie, requires_login, requires_login_redirect, requires_teacher,
forget_current_user)
from website.log_fetcher import log_fetcher
Expand Down Expand Up @@ -435,7 +435,8 @@ def enrich_context_with_user_info():
user = current_user()
data = {'username': user.get('username', ''),
'is_teacher': is_teacher(user), 'is_second_teacher': is_second_teacher(user),
'is_admin': is_admin(user), 'has_public_profile': has_public_profile(user)}
'is_admin': is_admin(user), 'has_public_profile': has_public_profile(user),
'hide_explore': hide_explore(g.user)}
return data


Expand Down
3 changes: 3 additions & 0 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@ msgstr ""
msgid "disable"
msgstr ""

msgid "disable_explore_page"
msgstr ""

msgid "disable_parsons"
msgstr ""

Expand Down
7 changes: 7 additions & 0 deletions templates/customize-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ <h3 class="px-4"><u>{{_('other_settings')}}</u></h3>
if "hide_parsons" in customizations['other_settings'] %}checked{% endif %}>
</td>
</tr>
<tr>
<td class="text-left border-t border-r border-gray-400">{{_('disable_explore_page')}}</td>
<td class="border-t border-gray-400">
<input class="other_settings_checkbox" id="hide_explore" type="checkbox" {%
if "hide_explore" in customizations['other_settings'] %}checked{% endif %}>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
4 changes: 3 additions & 1 deletion templates/incl/menubar.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<li class="ltr:mr-2 rtl:ml-2"><a href="/" class="inline-block w-10 lg:w-12"><img src="{{static('/images/Hedy-logo-96x96-round.png')}}" height="48px" width="48px" alt="{{_('hedy_logo_alt')}}"></a></li>
<li class="flex-initial menubar-item{% if current_page == 'start' %} active{% endif %}"><a class="menubar-text" href="/" title="{{_('nav_start')}}">{{_('nav_start')}}</a></li>
<li class="flex-initial menubar-item{% if current_page == 'hedy' %} active{% endif %}"><a class="menubar-text" id="hedybutton" href="/hedy" title="{{_('nav_hedy')}}">{{_('nav_hedy')}}</a></li>
<li class="flex-initial truncate menubar-item{% if current_page == 'explore' %} active{% endif %}"><a class="menubar-text" id="explorebutton" href="/explore" title="{{_('nav_explore')}}">{{_('nav_explore')}}</a></li>
{% if not hide_explore %}
<li class="flex-initial truncate menubar-item{% if current_page == 'explore' %} active{% endif %}"><a class="menubar-text" id="explorebutton" href="/explore" title="{{_('nav_explore')}}">{{_('nav_explore')}}</a></li>
{% endif %}
{% if is_teacher or is_second_teacher %}
<li class="flex-initial truncate menubar-item{% if current_page == 'for-teachers' %} active{% endif %}"><a class="menubar-text" href="/for-teachers" title="{{_('for_teachers')}}">{{_('for_teachers')}}</a></li>
<li class="flex-initial truncate menubar-item{% if current_page == 'teacher-manual' %} active{% endif %}"><a class="menubar-text" href="/for-teachers/manual" title="{{_('teacher_manual')}}">{{_('teacher_manual')}}</a></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { loginForTeacher } from '../../tools/login/login.js'
import { loginForStudent, loginForTeacher } from '../../tools/login/login.js'
import { ensureClass } from "../../tools/classes/class";

describe('customize class page', () => {
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('customize class page', () => {
.should('have.value', 'quiz')
});

it.only('disblae all quizes', () => {
it.only('disable all quizes', () => {
cy.intercept('/for-teachers/customize-class/*').as('updateCustomizations');

cy.get("#hide_quiz")
Expand All @@ -114,7 +114,7 @@ describe('customize class page', () => {
.should("not.exist")
});

it('disblae all parsons', () => {
it('disable all parsons', () => {
cy.intercept('/for-teachers/customize-class/*').as('updateCustomizations');

cy.get("#hide_parsons")
Expand All @@ -132,4 +132,20 @@ describe('customize class page', () => {
cy.get('[data-cy="level-1"] [data-cy="parsons"]')
.should("not.exist")
});

it('hide explore page', () => {
cy.intercept('/for-teachers/customize-class/*').as('updateCustomizations');

cy.get("#hide_explore")
.should("not.be.checked")
.click()

cy.get("#hide_explore")
.should("be.checked")

cy.wait(1000)
cy.wait('@updateCustomizations').should('have.nested.property', 'response.statusCode', 200);
loginForStudent();
cy.get("#explorebutton").should("not.exist")
});
});
3 changes: 3 additions & 0 deletions translations/ar/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ msgstr "افتتح مباشرة"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

msgid "disable_parsons"
msgstr "عطل كل الأحجيات"

Expand Down
3 changes: 3 additions & 0 deletions translations/bg/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/bn/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/ca/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ msgstr "Obrir directament"
msgid "disable"
msgstr "Desactiva"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/cs/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/cy/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/da/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/de/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ msgstr "Direkt öffnen"
msgid "disable"
msgstr "Deaktivieren"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/el/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ msgstr "Άμεσα ανοιχτό"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr "Disable explore page"

msgid "disable_parsons"
msgstr "Disable all puzzles"

Expand Down
3 changes: 3 additions & 0 deletions translations/eo/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@ msgstr "Rekte malfermi"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/es/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ msgstr "Directamente abierto"
msgid "disable"
msgstr "Deshabilitado"

msgid "disable_explore_page"
msgstr ""

msgid "disable_parsons"
msgstr "Desactivar todos los rompecabezas"

Expand Down
3 changes: 3 additions & 0 deletions translations/et/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/fa/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/fi/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/fr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ msgstr "Ouvrir immédiatement"
msgid "disable"
msgstr "Désactiver"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/fy/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/he/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/hi/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/hu/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/ia/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/id/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@ msgstr "Terbuka langsung"
msgid "disable"
msgstr "Nonaktif"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/it/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/ja/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/kmr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/ko/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ msgstr "직접 열림"
msgid "disable"
msgstr "사용 안 함"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/mi/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/nb_NO/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,9 @@ msgstr "Åpne på direkten"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/nl/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ msgstr "Gelijk open"
msgid "disable"
msgstr "Deactiveren"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
3 changes: 3 additions & 0 deletions translations/pa_PK/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ msgstr "Directly open"
msgid "disable"
msgstr "Disable"

msgid "disable_explore_page"
msgstr ""

#, fuzzy
msgid "disable_parsons"
msgstr "Disable all puzzles"
Expand Down
Loading

0 comments on commit 65ee552

Please sign in to comment.