Skip to content

Commit

Permalink
Merge pull request #1072 from openedx/alangsto/test_revert
Browse files Browse the repository at this point in the history
Revert eslint migration
  • Loading branch information
alangsto authored Sep 15, 2022
2 parents bea9fd6 + c7d6511 commit 3c03735
Show file tree
Hide file tree
Showing 35 changed files with 14,764 additions and 10,781 deletions.
11 changes: 2 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@edx/eslint-config",
"extends": "eslint-config-edx-es5",
"globals": {
"sinon": false,
"setFixtures": false,
Expand All @@ -8,13 +8,6 @@
"Backbone": false,
"gettext": false,
"Promise": false,
"edx": true,
"$": true,
"jQuery": true,
"spyOn": true,
"jasmine": true
},
"rules": {
"object-shorthand": [0, "always", { "ignoreConstructors": true }]
"edx": true
}
}
2 changes: 1 addition & 1 deletion .eslintrc.worker.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@edx/eslint-config",
"extends": "eslint-config-edx",
"env": {
"worker": true
}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[4.12.1] - 2022-09-15
~~~~~~~~~~~~~~~~~~~~~
* Revert Phantom JS and eslint migration made in version 4.11.0

[4.12.0] - 2022-08-29
~~~~~~~~~~~~~~~~~~~~~
* Improved ``developing.rst`` docs for installing and running the mockprock proctoring provider.
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '4.12.0'
__version__ = '4.12.1'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
edx = edx || {};
(Backbone => {
'use strict';
(function(Backbone) {
'use strict';

edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};
edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};

edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection = Backbone.Collection.extend({
/* model for a collection of ProctoredExamAllowance */
model: edx.instructor_dashboard.proctoring.ProctoredExamAllowanceModel,
url: '/api/edx_proctoring/v1/proctored_exam/',
});
const proctoredExamAllowanceCollection = edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection;
this.edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection = proctoredExamAllowanceCollection;
edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection = Backbone.Collection.extend({
/* model for a collection of ProctoredExamAllowance */
model: edx.instructor_dashboard.proctoring.ProctoredExamAllowanceModel,
url: '/api/edx_proctoring/v1/proctored_exam/'
});
this.edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection =
edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection;
}).call(this, Backbone);
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
edx = edx || {};
(Backbone => {
'use strict';
(function(Backbone) {
'use strict';

edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};
edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};

edx.instructor_dashboard.proctoring.ProctoredExamAttemptGroupedCollection = Backbone.Collection.extend({
/* model for a collection of ProctoredExamAttempt */
model: edx.instructor_dashboard.proctoring.ProctoredExamAttemptModel,
url: '/api/edx_proctoring/v1/proctored_exam/attempt/grouped/course_id/',
});
const groupedCollection = edx.instructor_dashboard.proctoring.ProctoredExamAttemptGroupedCollection;
this.edx.instructor_dashboard.proctoring.ProctoredExamAttemptGroupedCollection = groupedCollection;
edx.instructor_dashboard.proctoring.ProctoredExamAttemptGroupedCollection = Backbone.Collection.extend({
/* model for a collection of ProctoredExamAttempt */
model: edx.instructor_dashboard.proctoring.ProctoredExamAttemptModel,
url: '/api/edx_proctoring/v1/proctored_exam/attempt/grouped/course_id/'
});
this.edx.instructor_dashboard.proctoring.ProctoredExamAttemptGroupedCollection =
edx.instructor_dashboard.proctoring.ProctoredExamAttemptGroupedCollection;
}).call(this, Backbone);
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* globals ProctoredExamModel:false */
edx = edx || {};
(Backbone => {
'use strict';
(function(Backbone) {
'use strict';

edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};
edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};

edx.instructor_dashboard.proctoring.ProctoredExamCollection = Backbone.Collection.extend({
/* model for a collection of ProctoredExamAllowance */
model: ProctoredExamModel,
url: '/api/edx_proctoring/v1/proctored_exam/exam/course_id/',
});
const proctoredExamCollection = edx.instructor_dashboard.proctoring.ProctoredExamCollection;
this.edx.instructor_dashboard.proctoring.ProctoredExamCollection = proctoredExamCollection;
edx.instructor_dashboard.proctoring.ProctoredExamCollection = Backbone.Collection.extend({
/* model for a collection of ProctoredExamAllowance */
model: ProctoredExamModel,
url: '/api/edx_proctoring/v1/proctored_exam/exam/course_id/'
});
this.edx.instructor_dashboard.proctoring.ProctoredExamCollection =
edx.instructor_dashboard.proctoring.ProctoredExamCollection;
}).call(this, Backbone);
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
edx = edx || {};
(Backbone => {
'use strict';
(function(Backbone) {
'use strict';

edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};
edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};

edx.instructor_dashboard.proctoring.ProctoredExamOnboardingCollection = Backbone.Collection.extend({
url: '/api/edx_proctoring/v1/user_onboarding/status/course_id/',
});
const proctoredExamOnboardingCollection = edx.instructor_dashboard.proctoring.ProctoredExamOnboardingCollection;
this.edx.instructor_dashboard.proctoring.ProctoredExamOnboardingCollection = proctoredExamOnboardingCollection;
edx.instructor_dashboard.proctoring.ProctoredExamOnboardingCollection = Backbone.Collection.extend({
url: '/api/edx_proctoring/v1/user_onboarding/status/course_id/'
});
this.edx.instructor_dashboard.proctoring.ProctoredExamOnboardingCollection =
edx.instructor_dashboard.proctoring.ProctoredExamOnboardingCollection;
}).call(this, Backbone);
158 changes: 79 additions & 79 deletions edx_proctoring/static/proctoring/js/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,95 +3,95 @@
// It has been slightly modified to fit the needs of the edx-proctoring library.
edx = edx || {};

($ => {
'use strict';
(function($) {
'use strict';

const keyCodes = {
TAB: 9,
ESCAPE: 27,
SPACE: 32,
ARROWUP: 38,
ARROWDOWN: 40,
};
var keyCodes = {
TAB: 9,
ESCAPE: 27,
SPACE: 32,
ARROWUP: 38,
ARROWDOWN: 40
};

edx.dashboard = edx.dashboard || {};
edx.dashboard.dropdown = {};
edx.dashboard = edx.dashboard || {};
edx.dashboard.dropdown = {};

edx.dashboard.dropdown.toggleExamAttemptActionDropdownMenu = event => {
const $target = $(event.currentTarget);
const { dashboardIndex } = $target.data();
const $dropdown = $($target.data('dropdownSelector') || `#actions-dropdown-${dashboardIndex}`);
const $dropdownButton = $($target.data('dropdownButtonSelector') || `#actions-dropdown-link-${dashboardIndex}`);
const ariaExpandedState = ($dropdownButton.attr('aria-expanded') === 'true');
const menuItems = $dropdown.find('a');
edx.dashboard.dropdown.toggleExamAttemptActionDropdownMenu = function(event) {
var $target = $(event.currentTarget),
dashboardIndex = $target.data().dashboardIndex,
$dropdown = $($target.data('dropdownSelector') || '#actions-dropdown-' + dashboardIndex),
$dropdownButton = $($target.data('dropdownButtonSelector') || '#actions-dropdown-link-' + dashboardIndex),
ariaExpandedState = ($dropdownButton.attr('aria-expanded') === 'true'),
menuItems = $dropdown.find('a');

const catchKeyPress = (object, keyPressEvent) => {
// get currently focused item
const $focusedItem = $(':focus');
var catchKeyPress = function(object, keyPressEvent) {
// get currently focused item
var $focusedItem = $(':focus');

// get the index of the currently focused item
const focusedItemIndex = menuItems.index($focusedItem);
// get the index of the currently focused item
var focusedItemIndex = menuItems.index($focusedItem);

// var to store next focused item index
let itemToFocusIndex;
// var to store next focused item index
var itemToFocusIndex;

// if space or escape key pressed
if (keyPressEvent.which === keyCodes.SPACE || keyPressEvent.which === keyCodes.ESCAPE) {
$dropdownButton.click();
keyPressEvent.preventDefault();
} else if (keyPressEvent.which === keyCodes.AWRROWUP
|| (keyPressEvent.which === keyCodes.TAB && keyPressEvent.shiftKey)) {
// if up arrow key pressed or shift+tab
// if first item go to last
if (focusedItemIndex === 0 || focusedItemIndex === -1) {
menuItems.last().focus();
} else {
itemToFocusIndex = focusedItemIndex - 1;
menuItems.get(itemToFocusIndex).focus();
}
keyPressEvent.preventDefault();
} else if (keyPressEvent.which === keyCodes.ARROWDOWN || keyPressEvent.which === keyCodes.TAB) {
// if down arrow key pressed or tab key
// if last item go to first
if (focusedItemIndex === menuItems.length - 1 || focusedItemIndex === -1) {
menuItems.first().focus();
// if space or escape key pressed
if (keyPressEvent.which === keyCodes.SPACE || keyPressEvent.which === keyCodes.ESCAPE) {
$dropdownButton.click();
keyPressEvent.preventDefault();
} else if (keyPressEvent.which === keyCodes.AWRROWUP ||
(keyPressEvent.which === keyCodes.TAB && keyPressEvent.shiftKey)) {
// if up arrow key pressed or shift+tab
// if first item go to last
if (focusedItemIndex === 0 || focusedItemIndex === -1) {
menuItems.last().focus();
} else {
itemToFocusIndex = focusedItemIndex - 1;
menuItems.get(itemToFocusIndex).focus();
}
keyPressEvent.preventDefault();
} else if (keyPressEvent.which === keyCodes.ARROWDOWN || keyPressEvent.which === keyCodes.TAB) {
// if down arrow key pressed or tab key
// if last item go to first
if (focusedItemIndex === menuItems.length - 1 || focusedItemIndex === -1) {
menuItems.first().focus();
} else {
itemToFocusIndex = focusedItemIndex + 1;
menuItems.get(itemToFocusIndex).focus();
}
keyPressEvent.preventDefault();
}
};

// Toggle the visibility control for the selected element and set the focus
$dropdown.toggleClass('is-visible');
if ($dropdown.hasClass('is-visible')) {
$dropdown.attr('tabindex', -1);
$dropdown.focus();
} else {
itemToFocusIndex = focusedItemIndex + 1;
menuItems.get(itemToFocusIndex).focus();
$dropdown.removeAttr('tabindex');
$dropdownButton.focus();
}
keyPressEvent.preventDefault();
}
};

// Toggle the visibility control for the selected element and set the focus
$dropdown.toggleClass('is-visible');
if ($dropdown.hasClass('is-visible')) {
$dropdown.attr('tabindex', -1);
$dropdown.focus();
} else {
$dropdown.removeAttr('tabindex');
$dropdownButton.focus();
}
// Inform the ARIA framework that the dropdown has been expanded
$dropdownButton.attr('aria-expanded', !ariaExpandedState);

// Inform the ARIA framework that the dropdown has been expanded
$dropdownButton.attr('aria-expanded', !ariaExpandedState);

// catch keypresses when inside dropdownMenu (we want to catch spacebar;
// escape; up arrow or shift+tab; and down arrow or tab)
$dropdown.on('keydown', e => {
catchKeyPress($(this), e);
});
event.stopPropagation();
};
// catch keypresses when inside dropdownMenu (we want to catch spacebar;
// escape; up arrow or shift+tab; and down arrow or tab)
$dropdown.on('keydown', function(e) {
catchKeyPress($(this), e);
});
event.stopPropagation();
};

edx.dashboard.dropdown.bindToggleButtons = selector => {
$(selector).bind(
'click',
edx.dashboard.dropdown.toggleExamAttemptActionDropdownMenu,
);
};
edx.dashboard.dropdown.bindToggleButtons = function(selector) {
$(selector).bind(
'click',
edx.dashboard.dropdown.toggleExamAttemptActionDropdownMenu
);
};

$(document).ready(() => {
edx.dashboard.dropdown.bindToggleButtons('.action-more');
});
})(jQuery);
$(document).ready(function() {
edx.dashboard.dropdown.bindToggleButtons('.action-more');
});
}(jQuery));
Loading

0 comments on commit 3c03735

Please sign in to comment.