Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve modal update terms of service #39

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified edx-platform/nau-basic/conf/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
24 changes: 22 additions & 2 deletions edx-platform/nau-basic/conf/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: ajuda@nau.edu.pt\n"
"POT-Creation-Date: 2024-04-12 17:01+0100\n"
"POT-Creation-Date: 2024-04-15 14:52+0100\n"
"PO-Revision-Date: 2021-06-02 21:22+0000\n"
"Last-Translator: NAU <info@nau.edu.pt>\n"
"Language: en\n"
Expand Down Expand Up @@ -675,12 +675,14 @@ msgstr ""
#. https://github.com/fccn/nau-technical/issues/83
#: edx-platform/nau-basic/cms/templates/force-translations.html:73
#: edx-platform/nau-basic/cms/templates/widgets/footer.html:26
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:60
msgid "Terms of Service"
msgstr "Terms and Conditions"

#. Translators: Change from a simply agree to I've read and agree, used by
#. Honor Code
#: edx-platform/nau-basic/cms/templates/force-translations.html:76
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:73
msgid ""
"I agree to the {platform_name} "
"{terms_of_service_link_start}{terms_of_service}{terms_of_service_link_end}"
Expand All @@ -697,6 +699,7 @@ msgstr "You must read and understood the {terms_of_service}"
#. Translators:Change from a simply agree to I've read and agree, used by Terms
#. of Service
#: edx-platform/nau-basic/cms/templates/force-translations.html:82
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:58
msgid ""
"I agree to the {platform_name} "
"{tos_link_start}{terms_of_service}{tos_link_end}"
Expand Down Expand Up @@ -899,6 +902,7 @@ msgid "Policies"
msgstr ""

#: edx-platform/nau-basic/cms/templates/widgets/footer.html:31
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:45
msgid "Privacy Policy"
msgstr ""

Expand Down Expand Up @@ -1189,7 +1193,23 @@ msgstr ""
msgid "All in Portuguese, Portugal in all languages."
msgstr ""

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:23
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:15
msgid ""
"We have updated our legal information to continue using the NAU website, "
"you will have to do so using the new terms"
msgstr ""

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:43
msgid ""
"I have read and understood the "
"{privacy_policy_link_start}{privacy_policy}{privacy_policy_link_end}"
msgstr ""

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:75
msgid "Honor Code"
msgstr ""

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:85
msgid "Accept new terms of service"
msgstr ""

Expand Down
Binary file modified edx-platform/nau-basic/conf/locale/en/LC_MESSAGES/djangojs.mo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: ajuda@nau.edu.pt\n"
"POT-Creation-Date: 2024-04-12 17:01+0100\n"
"POT-Creation-Date: 2024-04-15 14:52+0100\n"
"PO-Revision-Date: 2021-06-02 21:22+0000\n"
"Last-Translator: NAU <info@nau.edu.pt>\n"
"Language: en\n"
Expand Down
Binary file modified edx-platform/nau-basic/conf/locale/pt_PT/LC_MESSAGES/django.mo
Binary file not shown.
28 changes: 26 additions & 2 deletions edx-platform/nau-basic/conf/locale/pt_PT/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: support@edunext.co\n"
"POT-Creation-Date: 2024-04-12 17:01+0100\n"
"POT-Creation-Date: 2024-04-15 14:52+0100\n"
"PO-Revision-Date: 2021-03-12 12:49+0000\n"
"Last-Translator: NAU <info@nau.edu.pt>\n"
"Language: pt_PT\n"
Expand Down Expand Up @@ -801,12 +801,14 @@ msgstr "As respostas corretas encontram-se marcadas diretamente no problema"
#. https://github.com/fccn/nau-technical/issues/83
#: edx-platform/nau-basic/cms/templates/force-translations.html:73
#: edx-platform/nau-basic/cms/templates/widgets/footer.html:26
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:60
msgid "Terms of Service"
msgstr "Termos e Condições"

#. Translators: Change from a simply agree to I've read and agree, used by
#. Honor Code
#: edx-platform/nau-basic/cms/templates/force-translations.html:76
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:73
msgid ""
"I agree to the {platform_name} "
"{terms_of_service_link_start}{terms_of_service}{terms_of_service_link_end}"
Expand All @@ -823,6 +825,7 @@ msgstr "Deverá ler e compreender o {terms_of_service}"
#. Translators:Change from a simply agree to I've read and agree, used by Terms
#. of Service
#: edx-platform/nau-basic/cms/templates/force-translations.html:82
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:58
msgid ""
"I agree to the {platform_name} "
"{tos_link_start}{terms_of_service}{tos_link_end}"
Expand Down Expand Up @@ -1025,6 +1028,7 @@ msgid "Policies"
msgstr "Painel"

#: edx-platform/nau-basic/cms/templates/widgets/footer.html:31
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:45
msgid "Privacy Policy"
msgstr "Política de Privacidade"

Expand Down Expand Up @@ -1315,7 +1319,27 @@ msgstr "Plataforma NAU"
msgid "All in Portuguese, Portugal in all languages."
msgstr "Tudo em Português, Portugal em todas as línguas."

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:23
#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:15
msgid ""
"We have updated our legal information to continue using the NAU website, "
"you will have to do so using the new terms"
msgstr ""
"Atualizamos a nossa informação legal para continuar a usar o site da NAU,"
" você terá que o fazer usando os novos termos"

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:43
msgid ""
"I have read and understood the "
"{privacy_policy_link_start}{privacy_policy}{privacy_policy_link_end}"
msgstr ""
"Li e compreendi a "
"{privacy_policy_link_start}{privacy_policy}{privacy_policy_link_end}"

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:75
msgid "Honor Code"
msgstr ""

#: edx-platform/nau-basic/lms/templates/modal-update-terms-of-service.html:85
msgid "Accept new terms of service"
msgstr "Aceito os novos termos de serviço"

Expand Down
Binary file modified edx-platform/nau-basic/conf/locale/pt_PT/LC_MESSAGES/djangojs.mo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: ajuda@nau.edu.pt\n"
"POT-Creation-Date: 2024-04-12 17:01+0100\n"
"POT-Creation-Date: 2024-04-15 14:52+0100\n"
"PO-Revision-Date: 2021-06-02 21:22+0000\n"
"Last-Translator: NAU <info@nau.edu.pt>\n"
"Language: pt_PT\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
display: flex;
flex-direction: column;
align-items: center;
.modal-update-terms-of-service-checks {
margin-top: 1rem;
}
.button-modal {
margin-top: 1rem;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,88 @@
## mako

## Pop up / modal that opens when the user needs to give this consent to the new terms of service of the platform.

<%page expression_filter="h"/>
<%namespace name='static' file='static_content.html'/>
<%!
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference
from django.utils.translation import gettext as _
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangolib.markup import HTML, Text
from common.djangoapps.edxmako.shortcuts import marketing_link
%>
<%
options_modal = configuration_helpers.get_value("MODAL_UPDATE_TERMS_OF_SERVICE", {})
modal_tos_date = options_modal.get("date_iso_8601", None)
modal_tos_text = options_modal.get("text", {}).get(LANGUAGE_CODE, "We have updated our terms of service")
modal_tos_text = options_modal.get("text", {}).get(LANGUAGE_CODE, _("We have updated our legal information to continue using the NAU website, you will have to do so using the new terms"))
%>

<%doc>
Pop up / modal that opens when the user needs to give this consent to the new terms of service of the platform.

To configure this you have to include a similar snippet on your site configuration.

"MODAL_UPDATE_TERMS_OF_SERVICE": {
"date_iso_8601": "2021-06-08",
"text": {
"pt-pt": "<h2>Atualizamos os <a href='https://www.nau.edu.pt/sobre/tos-privacidade-honra/' target='_blank'>termos de serviço</a>. Recomendamos que os analise cuidadosamente. Se continuar a usar o site da NAU, você o fará de acordo com os novos termos.</h2>",
"en": "<h2>We have updated our <a href='https://www.nau.edu.pt/sobre/tos-privacidade-honra/' target='_blank'>terms of service</a>. We recommend that you review them carefully. If you continue to use the main Nau site, you do so under the new terms.</h2>"
}
},
</%doc>

%if modal_tos_date is not None:
## The javascript code bellow displays the modal if need
<div class="modal-update-terms-of-service-container" style="display: none;">
<div class="modal-update-terms-of-service-content">
${modal_tos_text | n}
<button class="btn btn-primary button-modal">${_('Accept new terms of service')}</button>
<div class="modal-update-terms-of-service-checks">

% if settings.REGISTRATION_EXTRA_FIELDS.get('data_authorization', 'hidden') != 'hidden':
<p>
<label>
<input type="checkbox" id="data_authorization" name="data_authorization" />
${_("I have read and understood the {privacy_policy_link_start}{privacy_policy}{privacy_policy_link_end}").format(
platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
privacy_policy=_("Privacy Policy"),
privacy_policy_link_start=HTML("<a href='{terms_link}' rel='noopener' target='_blank'>").format(
terms_link=marketing_link("PRIVACY")
),
privacy_policy_link_end=HTML("</a>") ) | n }
</label>
</p>
% endif

% if settings.REGISTRATION_EXTRA_FIELDS.get('terms_of_service', 'hidden') != 'hidden':
<p>
<label>
<input type="checkbox" id="terms_of_service" name="terms_of_service" />
${_("I agree to the {platform_name} {tos_link_start}{terms_of_service}{tos_link_end}").format(
platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=_("Terms of Service"),
tos_link_start=HTML("<a href='{terms_link}' rel='noopener' target='_blank'>").format(
terms_link=marketing_link("TOS")
),
tos_link_end=HTML("</a>") ) | n }
</label>
</p>
% endif

% if settings.REGISTRATION_EXTRA_FIELDS.get('honor_code', 'hidden') != 'hidden':
<p>
<label>
<input type="checkbox" id="honor_code" name="honor_code" />
${_("I agree to the {platform_name} {terms_of_service_link_start}{terms_of_service}{terms_of_service_link_end}").format(
platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=_("Honor Code"),
terms_of_service_link_start=HTML("<a href='{terms_link}' rel='noopener' target='_blank'>").format(
terms_link=marketing_link("HONOR")
),
terms_of_service_link_end=HTML("</a>") ) | n }
</label>
</p>
% endif

</div>
<button class="btn btn-primary button-modal" disabled>${_('Accept new terms of service')}</button>
</div>
</div>

Expand Down Expand Up @@ -67,7 +129,18 @@
events();
}

function checkAllInputChecksClicked() {
var all_checked = true;
$('.modal-update-terms-of-service-container input:checkbox').each(function() {
if (!$(this).is(':checked')) {
all_checked = false;
}
});
$('.button-modal').attr('disabled', !all_checked);
}

function events() {
$('.modal-update-terms-of-service-container input:checkbox').on('click', checkAllInputChecksClicked);
$('.button-modal').on('click', function(){
hideModal();
updatePreference();
Expand Down
Loading