Skip to content
Snippets Groups Projects
Commit 35c8fd55 authored by Jacob Schatz's avatar Jacob Schatz
Browse files

Update to jQuery 3.

parent 86c9c93d
No related branches found
No related tags found
No related merge requests found
Showing
with 74 additions and 74 deletions
Loading
Loading
@@ -25,19 +25,19 @@ export default class LabelsSelect {
$dropdown = $(dropdown);
$dropdownContainer = $dropdown.closest('.labels-filter');
$toggleText = $dropdown.find('.dropdown-toggle-text');
namespacePath = $dropdown.data('namespace-path');
projectPath = $dropdown.data('project-path');
namespacePath = $dropdown.data('namespacePath');
projectPath = $dropdown.data('projectPath');
labelUrl = $dropdown.data('labels');
issueUpdateURL = $dropdown.data('issueUpdate');
selectedLabel = $dropdown.data('selected');
if ((selectedLabel != null) && !$dropdown.hasClass('js-multiselect')) {
selectedLabel = selectedLabel.split(',');
}
showNo = $dropdown.data('show-no');
showAny = $dropdown.data('show-any');
showNo = $dropdown.data('showNo');
showAny = $dropdown.data('showAny');
showMenuAbove = $dropdown.data('showMenuAbove');
defaultLabel = $dropdown.data('default-label');
abilityName = $dropdown.data('ability-name');
defaultLabel = $dropdown.data('defaultLabel');
abilityName = $dropdown.data('abilityName');
$selectbox = $dropdown.closest('.selectbox');
$block = $selectbox.closest('.block');
$form = $dropdown.closest('form, .js-issuable-update');
Loading
Loading
@@ -45,11 +45,11 @@ export default class LabelsSelect {
$sidebarLabelTooltip = $block.find('.js-sidebar-labels-tooltip');
$value = $block.find('.value');
$loading = $block.find('.block-loading').fadeOut();
fieldName = $dropdown.data('field-name');
fieldName = $dropdown.data('fieldName');
useId = $dropdown.is('.js-issuable-form-dropdown, .js-filter-bulk-update, .js-label-sidebar-dropdown');
propertyName = useId ? 'id' : 'title';
initialSelected = $selectbox
.find('input[name="' + $dropdown.data('field-name') + '"]')
.find('input[name="' + $dropdown.data('fieldName') + '"]')
.map(function () {
return this.value;
}).get();
Loading
Loading
@@ -268,7 +268,7 @@ export default class LabelsSelect {
return defaultLabel;
}
},
fieldName: $dropdown.data('field-name'),
fieldName: $dropdown.data('fieldName'),
id: function(label) {
if (label.id <= 0) return label.title;
 
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ import initFlyOutNav from './fly_out_nav';
function hideEndFade($scrollingTabs) {
$scrollingTabs.each(function scrollTabsLoop() {
const $this = $(this);
$this.siblings('.fade-right').toggleClass('scrolling', $this.width() < $this.prop('scrollWidth'));
$this.siblings('.fade-right').toggleClass('scrolling', Math.round($this.width()) < $this.prop('scrollWidth'));
});
}
 
Loading
Loading
Loading
Loading
@@ -138,7 +138,7 @@ textUtils.init = function(form) {
return $('.js-md', form).off('click').on('click', function() {
var $this;
$this = $(this);
return self.updateText($this.closest('.md-area').find('textarea'), $this.data('md-tag'), $this.data('md-block'), !$this.data('md-prepend'));
return self.updateText($this.closest('.md-area').find('textarea'), $this.data('mdTag'), $this.data('mdBlock'), !$this.data('mdPrepend'));
});
};
 
Loading
Loading
Loading
Loading
@@ -83,7 +83,7 @@ LineHighlighter.prototype.clickHandler = function(event) {
var current, lineNumber, range;
event.preventDefault();
this.clearHighlight();
lineNumber = $(event.target).closest('a').data('line-number');
lineNumber = $(event.target).closest('a').data('lineNumber');
current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held,
Loading
Loading
Loading
Loading
@@ -220,7 +220,7 @@ $(() => {
$document.on('click', '.js-confirm-danger', (e) => {
const btn = $(e.target);
const form = btn.closest('form');
const text = btn.data('confirm-danger-message');
const text = btn.data('confirmDangerMessage');
e.preventDefault();
 
// eslint-disable-next-line no-new
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ export default class Members {
isSelectable(selected, $el) {
return !$el.hasClass('is-active');
},
fieldName: $btn.data('field-name'),
fieldName: $btn.data('fieldName'),
id(selected, $el) {
return $el.data('id');
},
Loading
Loading
@@ -51,7 +51,7 @@ export default class Members {
}
// eslint-disable-next-line class-methods-use-this
getMemberListItems($el) {
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`);
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('elId')}`);
 
return {
$memberListItem,
Loading
Loading
Loading
Loading
@@ -361,7 +361,7 @@ export default class MergeRequestTabs {
}
 
diffViewType() {
return $('.inline-parallel-buttons a.active').data('view-type');
return $('.inline-parallel-buttons a.active').data('viewType');
}
 
isDiffAction(action) {
Loading
Loading
Loading
Loading
@@ -24,19 +24,19 @@ export default class MilestoneSelect {
$els.each((i, dropdown) => {
let collapsedSidebarLabelTemplate, milestoneLinkNoneTemplate, milestoneLinkTemplate, selectedMilestone, selectedMilestoneDefault;
const $dropdown = $(dropdown);
const projectId = $dropdown.data('project-id');
const projectId = $dropdown.data('projectId');
const milestonesUrl = $dropdown.data('milestones');
const issueUpdateURL = $dropdown.data('issueUpdate');
const showNo = $dropdown.data('show-no');
const showAny = $dropdown.data('show-any');
const showNo = $dropdown.data('showNo');
const showAny = $dropdown.data('showAny');
const showMenuAbove = $dropdown.data('showMenuAbove');
const showUpcoming = $dropdown.data('show-upcoming');
const showStarted = $dropdown.data('show-started');
const useId = $dropdown.data('use-id');
const defaultLabel = $dropdown.data('default-label');
const defaultNo = $dropdown.data('default-no');
const issuableId = $dropdown.data('issuable-id');
const abilityName = $dropdown.data('ability-name');
const showUpcoming = $dropdown.data('showUpcoming');
const showStarted = $dropdown.data('showStarted');
const useId = $dropdown.data('useId');
const defaultLabel = $dropdown.data('defaultLabel');
const defaultNo = $dropdown.data('defaultNo');
const issuableId = $dropdown.data('issuableId');
const abilityName = $dropdown.data('abilityName');
const $selectBox = $dropdown.closest('.selectbox');
const $block = $selectBox.closest('.block');
const $sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon');
Loading
Loading
@@ -114,7 +114,7 @@ export default class MilestoneSelect {
}
},
defaultLabel: defaultLabel,
fieldName: $dropdown.data('field-name'),
fieldName: $dropdown.data('fieldName'),
text: milestone => _.escape(milestone.title),
id: (milestone) => {
if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
Loading
Loading
@@ -166,7 +166,7 @@ export default class MilestoneSelect {
}
 
if (boardsStore) {
boardsStore[$dropdown.data('field-name')] = selected.name;
boardsStore[$dropdown.data('fieldName')] = selected.name;
e.preventDefault();
} else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) {
return Issuable.filterResults($dropdown.closest('form'));
Loading
Loading
Loading
Loading
@@ -219,7 +219,7 @@ export default class Notes {
}
editNote = $textarea.closest('.note');
if (editNote.length) {
originalText = $textarea.closest('form').data('original-note');
originalText = $textarea.closest('form').data('originalNote');
newText = $textarea.val();
if (originalText !== newText) {
if (!confirm('Are you sure you want to cancel editing this comment?')) {
Loading
Loading
@@ -609,9 +609,9 @@ export default class Notes {
*/
addDiscussionNote($form, note, isNewDiffComment) {
if ($form.attr('data-resolve-all') != null) {
var projectPath = $form.data('project-path');
var discussionId = $form.data('discussion-id');
var mergeRequestId = $form.data('noteable-iid');
var projectPath = $form.data('projectPath');
var discussionId = $form.data('discussionId');
var mergeRequestId = $form.data('noteableIid');
 
if (ResolveService != null) {
ResolveService.toggleResolveForDiscussion(mergeRequestId, discussionId);
Loading
Loading
@@ -751,7 +751,7 @@ export default class Notes {
form.removeClass('current-note-edit-form');
form.find('.js-finish-edit-warning').hide();
// Replace markdown textarea text with original note text.
return form.find('.js-note-text').val(form.find('form.edit-note').data('original-note'));
return form.find('.js-note-text').val(form.find('form.edit-note').data('originalNote'));
}
 
/**
Loading
Loading
@@ -776,7 +776,7 @@ export default class Notes {
var $note, $notes;
$note = $(el);
$notes = $note.closest('.discussion-notes');
const discussionId = $('.notes', $notes).data('discussion-id');
const discussionId = $('.notes', $notes).data('discussionId');
 
if (typeof gl.diffNotesCompileComponents !== 'undefined') {
if (gl.diffNoteApps[noteElId]) {
Loading
Loading
@@ -897,7 +897,7 @@ export default class Notes {
// DiffNote
form.find('#note_position').val(dataHolder.attr('data-position'));
 
form.find('.js-note-discard').show().removeClass('js-note-discard').addClass('js-close-discussion-note-form').text(form.find('.js-close-discussion-note-form').data('cancel-text'));
form.find('.js-note-discard').show().removeClass('js-note-discard').addClass('js-close-discussion-note-form').text(form.find('.js-close-discussion-note-form').data('cancelText'));
form.find('.js-note-target-close').remove();
form.find('.js-note-new-discussion').remove();
this.setupNoteForm(form);
Loading
Loading
@@ -1037,7 +1037,7 @@ export default class Notes {
removeDiscussionNoteForm(form) {
var glForm, row;
row = form.closest('tr');
glForm = form.data('gl-form');
glForm = form.data('glForm');
glForm.destroy();
form.find('.js-note-text').data('autosave').reset();
// show the reply button (will only work for replies)
Loading
Loading
@@ -1122,8 +1122,8 @@ export default class Notes {
return discardbtn.show();
}
} else {
reopentext = reopenbtn.data('original-text');
closetext = closebtn.data('original-text');
reopentext = reopenbtn.data('originalText');
closetext = closebtn.data('originalText');
if (reopenbtn.text() !== reopentext) {
reopenbtn.text(reopentext);
}
Loading
Loading
@@ -1150,9 +1150,9 @@ export default class Notes {
 
var $originalContentEl = $note.find('.original-note-content');
var originalContent = $originalContentEl.text().trim();
var postUrl = $originalContentEl.data('post-url');
var targetId = $originalContentEl.data('target-id');
var targetType = $originalContentEl.data('target-type');
var postUrl = $originalContentEl.data('postUrl');
var targetId = $originalContentEl.data('targetId');
var targetType = $originalContentEl.data('targetType');
 
this.glForm = new GLForm($editForm.find('form'), this.enableGFM);
 
Loading
Loading
@@ -1513,9 +1513,9 @@ export default class Notes {
// If comment intends to resolve discussion, do the same.
if (isDiscussionResolve) {
$form
.attr('data-discussion-id', $submitBtn.data('discussion-id'))
.attr('data-discussion-id', $submitBtn.data('discussionId'))
.attr('data-resolve-all', 'true')
.attr('data-project-path', $submitBtn.data('project-path'));
.attr('data-project-path', $submitBtn.data('projectPath'));
}
 
// Show final note element on UI
Loading
Loading
@@ -1587,7 +1587,7 @@ export default class Notes {
this.addNoteError($form);
});
 
return $closeBtn.text($closeBtn.data('original-text'));
return $closeBtn.text($closeBtn.data('originalText'));
}
 
/**
Loading
Loading
@@ -1642,7 +1642,7 @@ export default class Notes {
this.updateNoteError();
});
 
return $closeBtn.text($closeBtn.data('original-text'));
return $closeBtn.text($closeBtn.data('originalText'));
}
}
 
Loading
Loading
Loading
Loading
@@ -3,11 +3,11 @@ import Flash from './flash';
export default function notificationsDropdown() {
$(document).on('click', '.update-notification', function updateNotificationCallback(e) {
e.preventDefault();
if ($(this).is('.is-active') && $(this).data('notification-level') === 'custom') {
if ($(this).is('.is-active') && $(this).data('notificationLevel') === 'custom') {
return;
}
 
const notificationLevel = $(this).data('notification-level');
const notificationLevel = $(this).data('notificationLevel');
const form = $(this).parents('.notification-form:first');
 
form.find('.js-notification-loading').toggleClass('fa-bell fa-spin fa-spinner');
Loading
Loading
Loading
Loading
@@ -56,7 +56,7 @@ export default {
},
 
initLoadMore() {
$(document).unbind('scroll');
$(document).off('scroll');
$(document).endlessScroll({
bottomPixels: ENDLESS_SCROLL_BOTTOM_PX,
fireDelay: ENDLESS_SCROLL_FIRE_DELAY_MS,
Loading
Loading
Loading
Loading
@@ -15,21 +15,21 @@ export default class AbuseReports {
const $messageCellElement = $(this);
const reportMessage = $messageCellElement.text();
if (reportMessage.length > MAX_MESSAGE_LENGTH) {
$messageCellElement.data('original-message', reportMessage);
$messageCellElement.data('message-truncated', 'true');
$messageCellElement.data('originalMessage', reportMessage);
$messageCellElement.data('messageTruncated', 'true');
$messageCellElement.text(truncate(reportMessage, MAX_MESSAGE_LENGTH));
}
}
 
toggleMessageTruncation() {
const $messageCellElement = $(this);
const originalMessage = $messageCellElement.data('original-message');
const originalMessage = $messageCellElement.data('originalMessage');
if (!originalMessage) return;
if ($messageCellElement.data('message-truncated') === 'true') {
$messageCellElement.data('message-truncated', 'false');
if ($messageCellElement.data('messageTruncated') === 'true') {
$messageCellElement.data('messageTruncated', 'false');
$messageCellElement.text(originalMessage);
} else {
$messageCellElement.data('message-truncated', 'true');
$messageCellElement.data('messageTruncated', 'true');
$messageCellElement.text(`${originalMessage.substr(0, (MAX_MESSAGE_LENGTH - 3))}...`);
}
}
Loading
Loading
Loading
Loading
@@ -16,9 +16,9 @@ export default function adminInit() {
$('input#user_force_random_password').on('change', function randomPasswordClick() {
const $elems = $('#user_password, #user_password_confirmation');
if ($(this).attr('checked')) {
$elems.val('').attr('disabled', true);
$elems.val('').prop('disabled', true);
} else {
$elems.removeAttr('disabled');
$elems.prop('disabled', false);
}
});
 
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ export default function initBroadcastMessagesForm() {
$('div.broadcast-message-preview').css('color', previewColor);
});
 
const previewPath = $('textarea#broadcast_message_message').data('preview-path');
const previewPath = $('textarea#broadcast_message_message').data('previewPath');
 
$('textarea#broadcast_message_message').on('input', _.debounce(function onMessageInput() {
const message = $(this).val();
Loading
Loading
Loading
Loading
@@ -71,7 +71,7 @@ export default class Project {
selected = $dropdown.data('selected');
return $dropdown.glDropdown({
data(term, callback) {
axios.get($dropdown.data('refs-url'), {
axios.get($dropdown.data('refsUrl'), {
params: {
ref: $dropdown.data('ref'),
search: term,
Loading
Loading
@@ -84,8 +84,8 @@ export default class Project {
filterable: true,
filterRemote: true,
filterByText: true,
inputFieldName: $dropdown.data('input-field-name'),
fieldName: $dropdown.data('field-name'),
inputFieldName: $dropdown.data('inputFieldName'),
fieldName: $dropdown.data('fieldName'),
renderRow: function(ref) {
var li = refListItem.cloneNode(false);
 
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ export default class Search {
this.searchInput = '.js-search-input';
this.searchClear = '.js-search-clear';
 
this.groupId = $groupDropdown.data('group-id');
this.groupId = $groupDropdown.data('groupId');
this.eventListeners();
 
$groupDropdown.glDropdown({
Loading
Loading
@@ -36,7 +36,7 @@ export default class Search {
return obj.full_name;
},
toggleLabel(obj) {
return `${($groupDropdown.data('default-label'))} ${obj.full_name}`;
return `${($groupDropdown.data('defaultLabel'))} ${obj.full_name}`;
},
clicked: () => Search.submitSearch(),
});
Loading
Loading
@@ -69,7 +69,7 @@ export default class Search {
return obj.name_with_namespace;
},
toggleLabel(obj) {
return `${($projectDropdown.data('default-label'))} ${obj.name_with_namespace}`;
return `${($projectDropdown.data('defaultLabel'))} ${obj.name_with_namespace}`;
},
clicked: () => Search.submitSearch(),
});
Loading
Loading
Loading
Loading
@@ -5,13 +5,13 @@ import ProjectSelectComboButton from './project_select_combo_button';
export default function projectSelect() {
$('.ajax-project-select').each(function(i, select) {
var placeholder;
const simpleFilter = $(select).data('simple-filter') || false;
this.groupId = $(select).data('group-id');
this.includeGroups = $(select).data('include-groups');
this.allProjects = $(select).data('all-projects') || false;
this.orderBy = $(select).data('order-by') || 'id';
this.withIssuesEnabled = $(select).data('with-issues-enabled');
this.withMergeRequestsEnabled = $(select).data('with-merge-requests-enabled');
const simpleFilter = $(select).data('simpleFilter') || false;
this.groupId = $(select).data('groupId');
this.includeGroups = $(select).data('includeGroups');
this.allProjects = $(select).data('allProjects') || false;
this.orderBy = $(select).data('orderBy') || 'id';
this.withIssuesEnabled = $(select).data('withIssuesEnabled');
this.withMergeRequestsEnabled = $(select).data('withMergeRequestsEnabled');
 
placeholder = "Search for project";
if (this.includeGroups) {
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ export default class PrometheusMetrics {
this.$missingEnvVarMetricCount = this.$missingEnvVarPanel.find('.js-env-var-count');
this.$missingEnvVarMetricsList = this.$missingEnvVarPanel.find('.js-missing-var-metrics-list');
 
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('active-metrics');
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics');
 
this.$panelToggle.on('click', e => this.handlePanelToggle(e));
}
Loading
Loading
Loading
Loading
@@ -9,8 +9,8 @@ export default class ProtectedBranchAccessDropdown {
$dropdown.glDropdown({
data,
selectable: true,
inputId: $dropdown.data('input-id'),
fieldName: $dropdown.data('field-name'),
inputId: $dropdown.data('inputId'),
fieldName: $dropdown.data('fieldName'),
toggleLabel(item, $el) {
if ($el.is('.is-active')) {
return item.text;
Loading
Loading
Loading
Loading
@@ -59,7 +59,7 @@ export default class ProtectedBranchCreate {
);
 
this.savePreviousSelection($allowedToMergeInput.val(), $allowedToPushInput.val());
this.$form.find('input[type="submit"]').attr('disabled', completedForm);
this.$form.find('input[type="submit"]').prop('disabled', completedForm);
}
 
static getProtectedBranches(term, callback) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment