Files
edx-platform/lms/static/js/modules/tab.js
Michael Terry a34c8c8233 Drop remaining coffee use
This basically commits the transpiled CoffeeScript JS (with minor
cleanup) and removes coffee build support.

A tiny amount of support for xblocks exists, because external users
may have xblocks with coffee. But no coffee in our tree anyway.
2018-04-13 14:10:40 -04:00

53 lines
1.6 KiB
JavaScript

// Once generated by CoffeeScript 1.9.3, but now lives as pure JS
/* eslint-disable */
// TODO: Examine all of the xss-lint exceptions (https://openedx.atlassian.net/browse/PLAT-2084)
(function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
this.Tab = (function() {
function Tab(id1, items) {
this.id = id1;
this.items = items;
this.onShow = bind(this.onShow, this);
this.el = $("#tab_" + id);
this.render();
}
Tab.prototype.$ = function(selector) {
return $(selector, this.el);
};
Tab.prototype.render = function() {
$.each(this.items, (function(_this) {
return function(index, item) {
var tab;
tab = $('<a>').attr({
href: "#" + (_this.tabId(index))
}).html(item.title); // xss-lint: disable=javascript-jquery-html
_this.$('.navigation').append($('<li>').append(tab)); // xss-lint: disable=javascript-jquery-append
return _this.el.append($('<section>').attr({
id: _this.tabId(index)
}));
};
})(this));
return this.el.tabs({
show: this.onShow
});
};
Tab.prototype.onShow = function(element, ui) {
this.$('section.ui-tabs-hide').html('');
this.$("#" + (this.tabId(ui.index))).html(this.items[ui.index]['content']); // xss-lint: disable=javascript-jquery-html
return this.el.trigger('contentChanged');
};
Tab.prototype.tabId = function(index) {
return "tab-" + this.id + "-" + index;
};
return Tab;
})();
}).call(this);