From 4e97e8cfd041b70a98772198eaf6f60889507fc0 Mon Sep 17 00:00:00 2001 From: naumanshafi <83637216+naumanshafi@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:13:48 +0500 Subject: [PATCH] Release candidate (#144) * Change text on logout page * Change logout url * Timed Exams - Sticky header for timer (#140) * Timed Exams - Sticky header for timer feedback (#141) * Timed Exams - Sticky header for timer (#142) * Fix Logout Issue in Colaraz Themem Co-authored-by: M Umar Khan Co-authored-by: Muhammad Umar Khan <42294172+mumarkhan999@users.noreply.github.com> Co-authored-by: Rahat Ali --- colaraz/cms/static/js/header.js | 14 ++- colaraz/cms/templates/base.html | 4 +- colaraz/lms/static/js/header/header.js | 14 ++- .../course/layout/_courseware_preview.scss | 96 ++++++++++++++++--- colaraz/lms/templates/logout.html | 3 +- colaraz/lms/templates/main.html | 4 +- 6 files changed, 113 insertions(+), 22 deletions(-) diff --git a/colaraz/cms/static/js/header.js b/colaraz/cms/static/js/header.js index 69bef73..1a0cd7b 100644 --- a/colaraz/cms/static/js/header.js +++ b/colaraz/cms/static/js/header.js @@ -238,6 +238,18 @@ function receiveMessage(e) { return; const status = e.data; if (status.isUserLoggedIn === false || status.userName !== currentUserEmail) { - window.location.replace(edXLogoutUrl) + $.ajax({ + type: 'POST', + url: edXLogoutUrl, + data: { + email: currentUserEmail, + }, + success: function (response) { + location.reload(); + }, + error: function (response) { + console.log("Error occured while calling session api!!"); + }, + }); } } diff --git a/colaraz/cms/templates/base.html b/colaraz/cms/templates/base.html index 53ca529..248805d 100644 --- a/colaraz/cms/templates/base.html +++ b/colaraz/cms/templates/base.html @@ -269,13 +269,13 @@ var colarazCheckSessionUrl = "${getattr(settings, 'COLARAZ_CHECK_SESSION', {}).get('CHECK_SESSION_URL')}"; var colarazCheckSessionRefreshTime = ${getattr(settings, 'COLARAZ_CHECK_SESSION', {}).get('REFRESH_TIME_MILLISECONDS', 60000)}; var colarazCheckSessionKey = "${getattr(settings, 'COLARAZ_CHECK_SESSION', {}).get('COLARAZ_CHECK_SESSION_KEY')}"; - var edXLogoutUrl = "${reverse('logout')}"; + var edXLogoutUrl = "${reverse('colaraz_features:session_logout')}"; % if user.is_authenticated: % if user.id != request.session['_auth_user_id']: var currentUserEmail = "${User.objects.get(id=request.session['_auth_user_id']).email}"; % else: var currentUserEmail = "${user.email}"; - % endif + % endif % endif diff --git a/colaraz/lms/static/js/header/header.js b/colaraz/lms/static/js/header/header.js index 618a273..2e89abf 100644 --- a/colaraz/lms/static/js/header/header.js +++ b/colaraz/lms/static/js/header/header.js @@ -587,6 +587,18 @@ function receiveMessage(e) { return; const status = e.data; if (status.isUserLoggedIn === false || status.userName !== currentUserEmail) { - window.location.replace(edXLogoutUrl) + $.ajax({ + type: 'POST', + url: edXLogoutUrl, + data: { + email: currentUserEmail, + }, + success: function (response) { + location.reload(); + }, + error: function (response) { + console.log("Error occured while calling session api!!"); + }, + }); } } diff --git a/colaraz/lms/static/sass/course/layout/_courseware_preview.scss b/colaraz/lms/static/sass/course/layout/_courseware_preview.scss index d32089f..175753c 100644 --- a/colaraz/lms/static/sass/course/layout/_courseware_preview.scss +++ b/colaraz/lms/static/sass/course/layout/_courseware_preview.scss @@ -6,6 +6,11 @@ .content-wrapper { + &:before { + content: ''; + display: table; + } + .course-tabs { margin-top: 0; background: $gray-mid-border; @@ -25,6 +30,83 @@ } } +body { + + .proctored_exam_status { + margin: $baseline*.5; + width: auto; + + @include media-up(md) { + top: 100px; + position: sticky; + z-index: 12; + } + + .exam-timer { + color: $black; + padding: $baseline*.75 $baseline*.5; + + &:after { + content: ''; + display: block; + clear: both; + } + + .exam-timer-clock { + background: #fff; + border-radius: 20px; + + span { + display: inline-block; + min-width: 50px; + } + } + + .exam-timer-clock { + + #toggle_timer { + background: $primary; + border-radius: 0 20px 20px 0; + color: $text-color; + + &:hover { + background: $primary-dark; + } + } + } + + .exam-button-turn-in-exam { + background: $primary; + border-radius: 20px; + color: $text-color; + + &:hover { + background: $primary-dark; + } + } + + .exam-text { + + @include media-down(md) { + display: block; + padding-bottom: $baseline; + width: auto; + } + } + } + + &.is-fixed { + position: static; + width: auto; + + @include media-up(md) { + position: sticky; + top: 100px; + } + } + } +} + .view-in-course { table { @@ -47,20 +129,6 @@ } } - .proctored_exam_status { - margin: $baseline*.5; - width: auto; - - .exam-timer { - color: $black; - } - - &.is-fixed { - position: static; - width: auto; - } - } - .container { max-width: $container-default; } diff --git a/colaraz/lms/templates/logout.html b/colaraz/lms/templates/logout.html index 838141b..2242816 100644 --- a/colaraz/lms/templates/logout.html +++ b/colaraz/lms/templates/logout.html @@ -13,11 +13,10 @@ {% block body %}

{% trans "You have signed out." %}

-

amjad amjad amjad

{% blocktrans trimmed %} - If you are not redirected within 5 seconds, click here to go to the home page. + If you are not redirected within 5 seconds, click here to go to the login page. {% endblocktrans %}

diff --git a/colaraz/lms/templates/main.html b/colaraz/lms/templates/main.html index 042afa8..c57f7dd 100644 --- a/colaraz/lms/templates/main.html +++ b/colaraz/lms/templates/main.html @@ -475,13 +475,13 @@ var colarazCheckSessionUrl = "${getattr(settings, 'COLARAZ_CHECK_SESSION', {}).get('CHECK_SESSION_URL')}"; var colarazCheckSessionRefreshTime = ${getattr(settings, 'COLARAZ_CHECK_SESSION', {}).get('REFRESH_TIME_MILLISECONDS', 60000)}; var colarazCheckSessionKey = "${getattr(settings, 'COLARAZ_CHECK_SESSION', {}).get('COLARAZ_CHECK_SESSION_KEY')}"; - var edXLogoutUrl = "${reverse('logout')}"; + var edXLogoutUrl = "${reverse('colaraz_features:session_logout')}"; % if user.is_authenticated: % if user.id != request.session['_auth_user_id']: var currentUserEmail = "${User.objects.get(id=request.session['_auth_user_id']).email}"; % else: var currentUserEmail = "${user.email}"; - % endif + % endif % endif // Colaraz Discussion Forum API variables