Skip to content

Commit

Permalink
Bug #3, fix OUOP.inject_post_activity_survey_link() JS [iet:8974552]
Browse files Browse the repository at this point in the history
* Plus extend `OUOP.tesla_results_statistics()` Javascript + CSS;
* Re-order CSS style rules ~ CSSLint (Travis)
  • Loading branch information
nfreear committed May 16, 2017
1 parent 3260498 commit e0cb8ec
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
17 changes: 9 additions & 8 deletions style/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
OU-OpenID. © Nick Freear. © The Open University.
*/

body{
font: 1em sans-serif;
body {
background-color: #f4f4f4;
color: #222;
font: 1em sans-serif;
line-height: 1.4em;
margin: 1em auto;
max-width: 40em;
min-width: 26em;
line-height: 1.4em;
}
li {
margin-top: 0.6em;
Expand All @@ -18,7 +18,8 @@ abbr {
border-bottom: 1px dotted #aaa;
cursor: help;
}
h1, h2, label, button {
h1, h2,
label, button {
color: #444;
font-weight: bold;
}
Expand All @@ -29,13 +30,13 @@ body > div {
padding: .25em 1em;
}
input, button {
background-color: #fff;
border: 1px solid #ccc;
border-radius: .25rem;
color: #373a3c;
font-size: 1em;
padding: .5rem 1rem;
text-align: center;
border-radius: .25rem;
color: #373a3c;
background-color: #fff;
border: 1px solid #ccc;
}
input#oucu {
width: 12em;
Expand Down
18 changes: 16 additions & 2 deletions style/ouop-styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ div[ data-region = drawer ] {
}

#page-header .p-a-1 {
padding: 0.1rem 1rem !important;
padding: 0.1rem 1rem !important; /* csslint allow:important */
}

.course-content ul.topics li.section .left {
Expand All @@ -37,15 +37,27 @@ div[ data-region = drawer ] {
}

// TeSLA page(s)
#page-local-tesla-views-tesla_results {

#ouop-stats {
border: 1px solid #ddd;
margin: 2em 0;
padding: 1em;
text-transform: capitalize;
width: 100%;
word-spacing: 1em;
}
}

#page-local-tesla-views-agreement {

iframe.ouop-consent-doc {
//Was: iframe[ src *= 'docs.google.com' ] {
border: 1px solid #ddd;
display: block;
height: 52em;
width: 100%;
min-width: 500px; // Small devices, min-width: 576px.
width: 100%;
}
}

Expand Down Expand Up @@ -122,7 +134,9 @@ div[ data-region = drawer ] {
label[ for = id_country ],
label[ for = id_timezone ],
label[ for = id_description_editor ] {
/* csslint ignore:start */
display: none !important;
/* csslint ignore:end */
}
}

Expand Down
21 changes: 19 additions & 2 deletions user/ouop-local-fixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,32 @@
};

OUOP.inject_post_activity_survey_link = function ($, resp) {
var $container_quiz = $('#page-mod-quiz-review #user-notifications');
var $container_quiz_rev = $('#page-mod-quiz-review #user-notifications');
var $container_quiz = $('#page-mod-quiz-view');
var $container_assign = $('#page-mod-assign-view');
var survey_url = resp.survey_urls.post.replace('{OUCU}', resp.profile.ouop_oucu);

$container_quiz.append(OUOP.alert(OUOP.str('post_survey_msg', survey_url)));
$container_quiz_rev.append(OUOP.alert(OUOP.str('post_survey_msg', survey_url)));

if ($container_assign.find('.submissionstatussubmitted').length) {
$container_assign.find('#user-notifications').append(OUOP.alert(OUOP.str('post_survey_msg', survey_url)));
$container_assign.addClass('ouop-submitted');

C.warn('ouop: post-activity-survey-link - assign');
}
else if ($container_quiz.find('.quizattemptsummary').length) {
$container_quiz.find('#user-notifications').append(OUOP.alert(OUOP.str('post_survey_msg', survey_url)));
$container_quiz.addClass('ouop-submitted');

C.warn('ouop: post-activity-survey-link - quiz-view');
}

// TODO: Is "preview" text just visible to teachers?
var continue_btn = $container_quiz.find('#region-main button').first().text();
var has_confusing_text = continue_btn && /Continue the last preview/.test(continue_btn);
if (has_confusing_text) {
$container_quiz.find('#region-main button').first().addClass('ouop-fix').text('Continue the last attempt');
}
};

OUOP.survey_return_redirect = function ($, resp) {
Expand Down Expand Up @@ -186,6 +200,9 @@
});

if ($page.length) {
var summary = '<pre id="ouop-stats">Summary: %s</pre>'.replace(/%s/, JSON.stringify(counts, null, '\t'));
$page.find('table').before(summary);

C.warn('ouop: TeSLA results stats:', counts);
}
};
Expand Down

0 comments on commit e0cb8ec

Please sign in to comment.