Revert "Pass DOM element, not jQuery object to XBlock initialisation."

This commit is contained in:
Braden MacDonald
2016-02-26 09:06:13 -08:00
committed by Adam Palay
parent 70ad954eec
commit 76e66ff30f
6 changed files with 13 additions and 14 deletions

View File

@@ -43,7 +43,7 @@ define(["jquery", "underscore", "common/js/components/utils/view_utils", "js/vie
fragmentsRendered.always(function() {
xblockElement = self.$('.xblock').first();
try {
xblock = XBlock.initializeBlock(xblockElement.get(0));
xblock = XBlock.initializeBlock(xblockElement);
self.xblock = xblock;
self.xblockReady(xblock);
if (successCallback) {

View File

@@ -5,7 +5,6 @@
'use strict';
function VisibilityEditorView(runtime, element) {
var $element = $(element);
this.getGroupAccess = function() {
var groupAccess = {},
checkboxValues,
@@ -16,12 +15,12 @@
// defined by VerificationPartitionScheme on the backend!
ALLOW_GROUP_ID = 1;
if ($element.find('.visibility-level-all').prop('checked')) {
if (element.find('.visibility-level-all').prop('checked')) {
return {};
}
// Cohort partitions (user is allowed to select more than one)
$element.find('.field-visibility-content-group input:checked').each(function(index, input) {
element.find('.field-visibility-content-group input:checked').each(function(index, input) {
checkboxValues = $(input).val().split("-");
partitionId = parseInt(checkboxValues[0], 10);
groupId = parseInt(checkboxValues[1], 10);
@@ -34,7 +33,7 @@
});
// Verification partitions (user can select exactly one)
if ($element.find('#verification-access-checkbox').prop('checked')) {
if (element.find('#verification-access-checkbox').prop('checked')) {
partitionId = parseInt($('#verification-access-dropdown').val(), 10);
groupAccess[partitionId] = [ALLOW_GROUP_ID];
}
@@ -43,19 +42,19 @@
};
// When selecting "all students and staff", uncheck the specific groups
$element.find('.field-visibility-level input').change(function(event) {
element.find('.field-visibility-level input').change(function(event) {
if ($(event.target).hasClass('visibility-level-all')) {
$element.find('.field-visibility-content-group input, .field-visibility-verification input')
element.find('.field-visibility-content-group input, .field-visibility-verification input')
.prop('checked', false);
}
});
// When selecting a specific group, deselect "all students and staff" and
// select "specific content groups" instead.`
$element.find('.field-visibility-content-group input, .field-visibility-verification input')
element.find('.field-visibility-content-group input, .field-visibility-verification input')
.change(function() {
$element.find('.visibility-level-all').prop('checked', false);
$element.find('.visibility-level-specific').prop('checked', true);
element.find('.visibility-level-all').prop('checked', false);
element.find('.visibility-level-specific').prop('checked', true);
});
}