Skip to content

Commit

Permalink
Bug #8, add course_add_tesla_result_links() Javascript [iet:1031695…
Browse files Browse the repository at this point in the history
…9][iet:10316817]

[ci skip]
  • Loading branch information
nfreear committed Mar 19, 2018
1 parent 4c8fa37 commit 963cb3f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions js/src/local-fixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = function ($, resp) {
inject_long_texts($, resp);
quiz_word_count($, resp);

course_add_tesla_result_links($, resp);

$(window.document).ajaxSuccess(function (ev, xhr, settings) {
if (settings.url.match(/enrollment_ajax.php/)) {
console.warn('> enrollment_ajax:', xhr.responseText, xhr.status, ev.namespace);
Expand Down Expand Up @@ -180,3 +182,18 @@ function fix_pilot_fallback_link($, resp) {

// console.warn('>> ouop-pilot-fallback-link: ', $link, m_inst);
}

function course_add_tesla_result_links($, resp) {
var $cm_edit_menus = $('.path-course-view .section-cm-edit-actions[ data-owner ]');
var use_lti = resp.config.lti_results;

$cm_edit_menus.each(function (idx, el) {
var cmid = $(this).data('owner').replace(/#module-/, '');
var $link = $(this).find('a.editing_update.cm-edit-action');
var url = '/local/tesla/views/tesla_results.php?cmid=' + cmid + (use_lti ? '' : '&noredirect=1');

$link.after('<a href="%s" class="dropdown-item tesla-r">TeSLA results</a>'.replace(/%s/, url));

console.warn('course-add-tesla-result-links, cmid:', cmid, url, resp.config.lti_results);
});
}

0 comments on commit 963cb3f

Please sign in to comment.