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

Merge branch '25624-anticipate-obstacles-to-removing-turbolinks' into 'master'

Remove Turbolinks

Closes #25624

See merge request !8570
parents 3213dfd7 aa91f508
No related branches found
No related tags found
No related merge requests found
Showing
with 30 additions and 45 deletions
Loading
Loading
@@ -222,7 +222,6 @@ gem 'chronic_duration', '~> 0.10.6'
gem 'sass-rails', '~> 5.0.6'
gem 'coffee-rails', '~> 4.1.0'
gem 'uglifier', '~> 2.7.2'
gem 'gitlab-turbolinks-classic', '~> 2.5', '>= 2.5.6'
 
gem 'addressable', '~> 2.3.8'
gem 'bootstrap-sass', '~> 3.3.0'
Loading
Loading
Loading
Loading
@@ -266,8 +266,6 @@ GEM
mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3)
gitlab-markup (1.5.1)
gitlab-turbolinks-classic (2.5.6)
coffee-rails
gitlab_omniauth-ldap (1.2.1)
net-ldap (~> 0.9)
omniauth (~> 1.0)
Loading
Loading
@@ -891,7 +889,6 @@ DEPENDENCIES
github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-markup (~> 1.5.1)
gitlab-turbolinks-classic (~> 2.5, >= 2.5.6)
gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.2)
gollum-rugged_adapter (~> 0.4.2)
Loading
Loading
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, max-len */
/* global Turbolinks */
 
(function() {
this.Admin = (function() {
Loading
Loading
@@ -42,10 +41,10 @@
return $('.change-owner-link').show();
});
$('li.project_member').bind('ajax:success', function() {
return Turbolinks.visit(location.href);
return gl.utils.refreshCurrentPage();
});
$('li.group_member').bind('ajax:success', function() {
return Turbolinks.visit(location.href);
return gl.utils.refreshCurrentPage();
});
showBlacklistType = function() {
if ($("input[name='blacklist_type']:checked").val() === 'file') {
Loading
Loading
Loading
Loading
@@ -24,9 +24,7 @@
/*= require jquery.waitforimages */
/*= require jquery.atwho */
/*= require jquery.scrollTo */
/*= require jquery.turbolinks */
/*= require js.cookie */
/*= require turbolinks */
/*= require autosave */
/*= require bootstrap/affix */
/*= require bootstrap/alert */
Loading
Loading
@@ -64,7 +62,7 @@
/*= require es6-promise.auto */
 
(function () {
document.addEventListener('page:fetch', function () {
document.addEventListener('beforeunload', function () {
// Unbind scroll events
$(document).off('scroll');
// Close any open tooltips
Loading
Loading
Loading
Loading
@@ -43,6 +43,7 @@
BreakpointInstance.prototype.getBreakpointSize = function() {
var $visibleDevice;
$visibleDevice = this.visibleDevice;
// TODO: Consider refactoring in light of turbolinks removal.
// the page refreshed via turbolinks
if (!$visibleDevice().length) {
this.setup();
Loading
Loading
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-use-before-define, no-param-reassign, quotes, yoda, no-else-return, consistent-return, comma-dangle, object-shorthand, prefer-template, one-var, one-var-declaration-per-line, no-unused-vars, max-len, vars-on-top */
/* global Breakpoints */
/* global Turbolinks */
 
(function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
Loading
Loading
@@ -127,7 +126,7 @@
pageUrl += DOWN_BUILD_TRACE;
}
 
return Turbolinks.visit(pageUrl);
return gl.utils.visitUrl(pageUrl);
}
};
})(this)
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@
this.setupMapping();
 
this.cleanupWrapper = this.cleanup.bind(this);
document.addEventListener('page:fetch', this.cleanupWrapper);
document.addEventListener('beforeunload', this.cleanupWrapper);
}
 
cleanup() {
Loading
Loading
@@ -20,7 +20,7 @@
 
this.setupMapping();
 
document.removeEventListener('page:fetch', this.cleanupWrapper);
document.removeEventListener('beforeunload', this.cleanupWrapper);
}
 
setupMapping() {
Loading
Loading
/* global Turbolinks */
(() => {
class FilteredSearchManager {
constructor() {
Loading
Loading
@@ -15,13 +13,13 @@
this.dropdownManager.setDropdown();
 
this.cleanupWrapper = this.cleanup.bind(this);
document.addEventListener('page:fetch', this.cleanupWrapper);
document.addEventListener('beforeunload', this.cleanupWrapper);
}
}
 
cleanup() {
this.unbindEvents();
document.removeEventListener('page:fetch', this.cleanupWrapper);
document.removeEventListener('beforeunload', this.cleanupWrapper);
}
 
bindEvents() {
Loading
Loading
@@ -200,7 +198,9 @@
paths.push(`search=${sanitized}`);
}
 
Turbolinks.visit(`?scope=all&utf8=✓&${paths.join('&')}`);
const parameterizedUrl = `?scope=all&utf8=✓&${paths.join('&')}`;
gl.utils.visitUrl(parameterizedUrl);
}
 
getUsernameParams() {
Loading
Loading
/* eslint-disable func-names, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, prefer-rest-params, max-len, vars-on-top, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func, no-mixed-operators */
/* global fuzzaldrinPlus */
/* global Turbolinks */
 
(function() {
var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote,
Loading
Loading
@@ -723,7 +722,7 @@
if ($el.length) {
var href = $el.attr('href');
if (href && href !== '#') {
Turbolinks.visit(href);
gl.utils.visitUrl(href);
} else {
$el.first().trigger('click');
}
Loading
Loading
/* eslint-disable no-param-reassign, func-names, no-var, camelcase, no-unused-vars, object-shorthand, space-before-function-paren, no-return-assign, comma-dangle, consistent-return, one-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, wrap-iife, max-len */
/* global Issuable */
/* global Turbolinks */
 
((global) => {
var issuable_created;
Loading
Loading
@@ -119,7 +118,7 @@
issuesUrl = formAction;
issuesUrl += "" + (formAction.indexOf('?') < 0 ? '?' : '&');
issuesUrl += formData;
return Turbolinks.visit(issuesUrl);
return gl.utils.visitUrl(issuesUrl);
};
})(this),
initResetFilters: function() {
Loading
Loading
@@ -130,7 +129,7 @@
const baseIssuesUrl = target.href;
 
$form.attr('action', baseIssuesUrl);
Turbolinks.visit(baseIssuesUrl);
gl.utils.visitUrl(baseIssuesUrl);
});
},
initChecks: function() {
Loading
Loading
Loading
Loading
@@ -95,7 +95,6 @@
const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`;
 
history.replaceState({
turbolinks: true,
url: newState,
}, document.title, newState);
return newState;
Loading
Loading
Loading
Loading
@@ -76,5 +76,11 @@
hashIndex = url.indexOf('#');
return hashIndex === -1 ? null : url.substring(hashIndex + 1);
};
w.gl.utils.refreshCurrentPage = () => gl.utils.visitUrl(document.location.href);
w.gl.utils.visitUrl = (url) => {
document.location.href = url;
};
})(window);
}).call(this);
Loading
Loading
@@ -171,7 +171,6 @@
// This method is stubbed in tests.
LineHighlighter.prototype.__setLocationHash__ = function(value) {
return history.pushState({
turbolinks: false,
url: value
// We're using pushState instead of assigning location.hash directly to
// prevent the page from scrolling on the hashchange event
Loading
Loading
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback */
/* global Turbolinks */
 
(function() {
Turbolinks.enableProgressBar();
$(document).on('page:fetch', function() {
window.addEventListener('beforeunload', function() {
$('.tanuki-logo').addClass('animate');
});
$(document).on('page:change', function() {
$('.tanuki-logo').removeClass('animate');
});
}).call(this);
Loading
Loading
@@ -184,12 +184,13 @@
// Ensure parameters and hash come along for the ride
newState += location.search + location.hash;
 
// TODO: Consider refactoring in light of turbolinks removal.
// Replace the current history state with the new one without breaking
// Turbolinks' history.
//
// See https://github.com/rails/turbolinks/issues/363
window.history.replaceState({
turbolinks: true,
url: newState,
}, document.title, newState);
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,6 @@
/* global notify */
/* global notifyPermissions */
/* global merge_request_widget */
/* global Turbolinks */
 
((global) => {
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i += 1) { if (i in this && this[i] === item) return i; } return -1; };
Loading
Loading
@@ -69,13 +68,13 @@
}
 
MergeRequestWidget.prototype.clearEventListeners = function() {
return $(document).off('page:change.merge_request');
return $(document).off('DOMContentLoaded');
};
 
MergeRequestWidget.prototype.addEventListeners = function() {
var allowedPages;
allowedPages = ['show', 'commits', 'pipelines', 'changes'];
$(document).on('page:change.merge_request', (function(_this) {
$(document).on('DOMContentLoaded', (function(_this) {
return function() {
var page;
page = $('body').data('page').split(':').last();
Loading
Loading
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, consistent-return, no-new, prefer-arrow-callback, no-return-assign, one-var, one-var-declaration-per-line, object-shorthand, comma-dangle, no-else-return, newline-per-chained-call, no-shadow, vars-on-top, prefer-template, max-len */
/* global Cookies */
/* global Turbolinks */
/* global ProjectSelect */
 
(function() {
Loading
Loading
@@ -118,7 +117,7 @@
var $form = $dropdown.closest('form');
var action = $form.attr('action');
var divider = action.indexOf('?') < 0 ? '?' : '&';
Turbolinks.visit(action + '' + divider + '' + $form.serialize());
gl.utils.visitUrl(action + '' + divider + '' + $form.serialize());
}
}
});
Loading
Loading
/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len */
/* global Turbolinks */
 
(function() {
this.ProjectImport = (function() {
function ProjectImport() {
setTimeout(function() {
return Turbolinks.visit(location.href);
return gl.utils.visitUrl(location.href);
}, 5000);
}
 
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@
this.find('.js-render-math').renderMath();
};
 
$(document).on('ready page:load', function() {
$(document).on('ready load', function() {
return $('body').renderGFM();
});
}).call(this);
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, prefer-arrow-callback, consistent-return, object-shorthand, no-unused-vars, one-var, one-var-declaration-per-line, no-else-return, comma-dangle, max-len */
/* global Mousetrap */
/* global Turbolinks */
/* global findFileURL */
 
(function() {
Loading
Loading
@@ -23,7 +22,7 @@
Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], this.toggleMarkdownPreview);
if (typeof findFileURL !== "undefined" && findFileURL !== null) {
Mousetrap.bind('t', function() {
return Turbolinks.visit(findFileURL);
return gl.utils.visitUrl(findFileURL);
});
}
}
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