Commit 538a6875 authored by Jacob Schatz's avatar Jacob Schatz

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

Remove Turbolinks

Closes #25624

See merge request !8570
parents 3213dfd7 aa91f508
...@@ -222,7 +222,6 @@ gem 'chronic_duration', '~> 0.10.6' ...@@ -222,7 +222,6 @@ gem 'chronic_duration', '~> 0.10.6'
gem 'sass-rails', '~> 5.0.6' gem 'sass-rails', '~> 5.0.6'
gem 'coffee-rails', '~> 4.1.0' gem 'coffee-rails', '~> 4.1.0'
gem 'uglifier', '~> 2.7.2' gem 'uglifier', '~> 2.7.2'
gem 'gitlab-turbolinks-classic', '~> 2.5', '>= 2.5.6'
gem 'addressable', '~> 2.3.8' gem 'addressable', '~> 2.3.8'
gem 'bootstrap-sass', '~> 3.3.0' gem 'bootstrap-sass', '~> 3.3.0'
......
...@@ -266,8 +266,6 @@ GEM ...@@ -266,8 +266,6 @@ GEM
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-markup (1.5.1) gitlab-markup (1.5.1)
gitlab-turbolinks-classic (2.5.6)
coffee-rails
gitlab_omniauth-ldap (1.2.1) gitlab_omniauth-ldap (1.2.1)
net-ldap (~> 0.9) net-ldap (~> 0.9)
omniauth (~> 1.0) omniauth (~> 1.0)
...@@ -891,7 +889,6 @@ DEPENDENCIES ...@@ -891,7 +889,6 @@ DEPENDENCIES
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-markup (~> 1.5.1) gitlab-markup (~> 1.5.1)
gitlab-turbolinks-classic (~> 2.5, >= 2.5.6)
gitlab_omniauth-ldap (~> 1.2.1) gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.2) gollum-lib (~> 4.2)
gollum-rugged_adapter (~> 0.4.2) gollum-rugged_adapter (~> 0.4.2)
......
/* 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 */ /* 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() { (function() {
this.Admin = (function() { this.Admin = (function() {
...@@ -42,10 +41,10 @@ ...@@ -42,10 +41,10 @@
return $('.change-owner-link').show(); return $('.change-owner-link').show();
}); });
$('li.project_member').bind('ajax:success', function() { $('li.project_member').bind('ajax:success', function() {
return Turbolinks.visit(location.href); return gl.utils.refreshCurrentPage();
}); });
$('li.group_member').bind('ajax:success', function() { $('li.group_member').bind('ajax:success', function() {
return Turbolinks.visit(location.href); return gl.utils.refreshCurrentPage();
}); });
showBlacklistType = function() { showBlacklistType = function() {
if ($("input[name='blacklist_type']:checked").val() === 'file') { if ($("input[name='blacklist_type']:checked").val() === 'file') {
......
...@@ -24,9 +24,7 @@ ...@@ -24,9 +24,7 @@
/*= require jquery.waitforimages */ /*= require jquery.waitforimages */
/*= require jquery.atwho */ /*= require jquery.atwho */
/*= require jquery.scrollTo */ /*= require jquery.scrollTo */
/*= require jquery.turbolinks */
/*= require js.cookie */ /*= require js.cookie */
/*= require turbolinks */
/*= require autosave */ /*= require autosave */
/*= require bootstrap/affix */ /*= require bootstrap/affix */
/*= require bootstrap/alert */ /*= require bootstrap/alert */
...@@ -64,7 +62,7 @@ ...@@ -64,7 +62,7 @@
/*= require es6-promise.auto */ /*= require es6-promise.auto */
(function () { (function () {
document.addEventListener('page:fetch', function () { document.addEventListener('beforeunload', function () {
// Unbind scroll events // Unbind scroll events
$(document).off('scroll'); $(document).off('scroll');
// Close any open tooltips // Close any open tooltips
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
BreakpointInstance.prototype.getBreakpointSize = function() { BreakpointInstance.prototype.getBreakpointSize = function() {
var $visibleDevice; var $visibleDevice;
$visibleDevice = this.visibleDevice; $visibleDevice = this.visibleDevice;
// TODO: Consider refactoring in light of turbolinks removal.
// the page refreshed via turbolinks // the page refreshed via turbolinks
if (!$visibleDevice().length) { if (!$visibleDevice().length) {
this.setup(); this.setup();
......
/* 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 */ /* 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 Breakpoints */
/* global Turbolinks */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
...@@ -127,7 +126,7 @@ ...@@ -127,7 +126,7 @@
pageUrl += DOWN_BUILD_TRACE; pageUrl += DOWN_BUILD_TRACE;
} }
return Turbolinks.visit(pageUrl); return gl.utils.visitUrl(pageUrl);
} }
}; };
})(this) })(this)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
this.setupMapping(); this.setupMapping();
this.cleanupWrapper = this.cleanup.bind(this); this.cleanupWrapper = this.cleanup.bind(this);
document.addEventListener('page:fetch', this.cleanupWrapper); document.addEventListener('beforeunload', this.cleanupWrapper);
} }
cleanup() { cleanup() {
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
this.setupMapping(); this.setupMapping();
document.removeEventListener('page:fetch', this.cleanupWrapper); document.removeEventListener('beforeunload', this.cleanupWrapper);
} }
setupMapping() { setupMapping() {
......
/* global Turbolinks */
(() => { (() => {
class FilteredSearchManager { class FilteredSearchManager {
constructor() { constructor() {
...@@ -15,13 +13,13 @@ ...@@ -15,13 +13,13 @@
this.dropdownManager.setDropdown(); this.dropdownManager.setDropdown();
this.cleanupWrapper = this.cleanup.bind(this); this.cleanupWrapper = this.cleanup.bind(this);
document.addEventListener('page:fetch', this.cleanupWrapper); document.addEventListener('beforeunload', this.cleanupWrapper);
} }
} }
cleanup() { cleanup() {
this.unbindEvents(); this.unbindEvents();
document.removeEventListener('page:fetch', this.cleanupWrapper); document.removeEventListener('beforeunload', this.cleanupWrapper);
} }
bindEvents() { bindEvents() {
...@@ -200,7 +198,9 @@ ...@@ -200,7 +198,9 @@
paths.push(`search=${sanitized}`); paths.push(`search=${sanitized}`);
} }
Turbolinks.visit(`?scope=all&utf8=✓&${paths.join('&')}`); const parameterizedUrl = `?scope=all&utf8=✓&${paths.join('&')}`;
gl.utils.visitUrl(parameterizedUrl);
} }
getUsernameParams() { getUsernameParams() {
......
/* 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 */ /* 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 fuzzaldrinPlus */
/* global Turbolinks */
(function() { (function() {
var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote, var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote,
...@@ -723,7 +722,7 @@ ...@@ -723,7 +722,7 @@
if ($el.length) { if ($el.length) {
var href = $el.attr('href'); var href = $el.attr('href');
if (href && href !== '#') { if (href && href !== '#') {
Turbolinks.visit(href); gl.utils.visitUrl(href);
} else { } else {
$el.first().trigger('click'); $el.first().trigger('click');
} }
......
/* 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 */ /* 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 Issuable */
/* global Turbolinks */
((global) => { ((global) => {
var issuable_created; var issuable_created;
...@@ -119,7 +118,7 @@ ...@@ -119,7 +118,7 @@
issuesUrl = formAction; issuesUrl = formAction;
issuesUrl += "" + (formAction.indexOf('?') < 0 ? '?' : '&'); issuesUrl += "" + (formAction.indexOf('?') < 0 ? '?' : '&');
issuesUrl += formData; issuesUrl += formData;
return Turbolinks.visit(issuesUrl); return gl.utils.visitUrl(issuesUrl);
}; };
})(this), })(this),
initResetFilters: function() { initResetFilters: function() {
...@@ -130,7 +129,7 @@ ...@@ -130,7 +129,7 @@
const baseIssuesUrl = target.href; const baseIssuesUrl = target.href;
$form.attr('action', baseIssuesUrl); $form.attr('action', baseIssuesUrl);
Turbolinks.visit(baseIssuesUrl); gl.utils.visitUrl(baseIssuesUrl);
}); });
}, },
initChecks: function() { initChecks: function() {
......
...@@ -95,7 +95,6 @@ ...@@ -95,7 +95,6 @@
const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`; const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`;
history.replaceState({ history.replaceState({
turbolinks: true,
url: newState, url: newState,
}, document.title, newState); }, document.title, newState);
return newState; return newState;
......
...@@ -76,5 +76,11 @@ ...@@ -76,5 +76,11 @@
hashIndex = url.indexOf('#'); hashIndex = url.indexOf('#');
return hashIndex === -1 ? null : url.substring(hashIndex + 1); 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); })(window);
}).call(this); }).call(this);
...@@ -171,7 +171,6 @@ ...@@ -171,7 +171,6 @@
// This method is stubbed in tests. // This method is stubbed in tests.
LineHighlighter.prototype.__setLocationHash__ = function(value) { LineHighlighter.prototype.__setLocationHash__ = function(value) {
return history.pushState({ return history.pushState({
turbolinks: false,
url: value url: value
// We're using pushState instead of assigning location.hash directly to // We're using pushState instead of assigning location.hash directly to
// prevent the page from scrolling on the hashchange event // prevent the page from scrolling on the hashchange event
......
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback */ /* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback */
/* global Turbolinks */
(function() { (function() {
Turbolinks.enableProgressBar(); window.addEventListener('beforeunload', function() {
$(document).on('page:fetch', function() {
$('.tanuki-logo').addClass('animate'); $('.tanuki-logo').addClass('animate');
}); });
$(document).on('page:change', function() {
$('.tanuki-logo').removeClass('animate');
});
}).call(this); }).call(this);
...@@ -184,12 +184,13 @@ ...@@ -184,12 +184,13 @@
// Ensure parameters and hash come along for the ride // Ensure parameters and hash come along for the ride
newState += location.search + location.hash; newState += location.search + location.hash;
// TODO: Consider refactoring in light of turbolinks removal.
// Replace the current history state with the new one without breaking // Replace the current history state with the new one without breaking
// Turbolinks' history. // Turbolinks' history.
// //
// See https://github.com/rails/turbolinks/issues/363 // See https://github.com/rails/turbolinks/issues/363
window.history.replaceState({ window.history.replaceState({
turbolinks: true,
url: newState, url: newState,
}, document.title, newState); }, document.title, newState);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* global notify */ /* global notify */
/* global notifyPermissions */ /* global notifyPermissions */
/* global merge_request_widget */ /* global merge_request_widget */
/* global Turbolinks */
((global) => { ((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; }; 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; };
...@@ -69,13 +68,13 @@ ...@@ -69,13 +68,13 @@
} }
MergeRequestWidget.prototype.clearEventListeners = function() { MergeRequestWidget.prototype.clearEventListeners = function() {
return $(document).off('page:change.merge_request'); return $(document).off('DOMContentLoaded');
}; };
MergeRequestWidget.prototype.addEventListeners = function() { MergeRequestWidget.prototype.addEventListeners = function() {
var allowedPages; var allowedPages;
allowedPages = ['show', 'commits', 'pipelines', 'changes']; allowedPages = ['show', 'commits', 'pipelines', 'changes'];
$(document).on('page:change.merge_request', (function(_this) { $(document).on('DOMContentLoaded', (function(_this) {
return function() { return function() {
var page; var page;
page = $('body').data('page').split(':').last(); page = $('body').data('page').split(':').last();
......
/* 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 */ /* 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 Cookies */
/* global Turbolinks */
/* global ProjectSelect */ /* global ProjectSelect */
(function() { (function() {
...@@ -118,7 +117,7 @@ ...@@ -118,7 +117,7 @@
var $form = $dropdown.closest('form'); var $form = $dropdown.closest('form');
var action = $form.attr('action'); var action = $form.attr('action');
var divider = action.indexOf('?') < 0 ? '?' : '&'; var divider = action.indexOf('?') < 0 ? '?' : '&';
Turbolinks.visit(action + '' + divider + '' + $form.serialize()); gl.utils.visitUrl(action + '' + divider + '' + $form.serialize());
} }
} }
}); });
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len */
/* global Turbolinks */
(function() { (function() {
this.ProjectImport = (function() { this.ProjectImport = (function() {
function ProjectImport() { function ProjectImport() {
setTimeout(function() { setTimeout(function() {
return Turbolinks.visit(location.href); return gl.utils.visitUrl(location.href);
}, 5000); }, 5000);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
this.find('.js-render-math').renderMath(); this.find('.js-render-math').renderMath();
}; };
$(document).on('ready page:load', function() { $(document).on('ready load', function() {
return $('body').renderGFM(); return $('body').renderGFM();
}); });
}).call(this); }).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 */ /* 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 Mousetrap */
/* global Turbolinks */
/* global findFileURL */ /* global findFileURL */
(function() { (function() {
...@@ -23,7 +22,7 @@ ...@@ -23,7 +22,7 @@
Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], this.toggleMarkdownPreview); Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], this.toggleMarkdownPreview);
if (typeof findFileURL !== "undefined" && findFileURL !== null) { if (typeof findFileURL !== "undefined" && findFileURL !== null) {
Mousetrap.bind('t', function() { Mousetrap.bind('t', function() {
return Turbolinks.visit(findFileURL); return gl.utils.visitUrl(findFileURL);
}); });
} }
} }
......
/* eslint-disable func-names, space-before-function-paren, max-len, no-var, one-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, one-var-declaration-per-line, quotes, prefer-arrow-callback, consistent-return, prefer-template, no-mixed-operators */ /* eslint-disable func-names, space-before-function-paren, max-len, no-var, one-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, one-var-declaration-per-line, quotes, prefer-arrow-callback, consistent-return, prefer-template, no-mixed-operators */
/* global Mousetrap */ /* global Mousetrap */
/* global Turbolinks */
/* global ShortcutsNavigation */ /* global ShortcutsNavigation */
/* global sidebar */ /* global sidebar */
...@@ -80,7 +79,7 @@ ...@@ -80,7 +79,7 @@
ShortcutsIssuable.prototype.editIssue = function() { ShortcutsIssuable.prototype.editIssue = function() {
var $editBtn; var $editBtn;
$editBtn = $('.issuable-edit'); $editBtn = $('.issuable-edit');
return Turbolinks.visit($editBtn.attr('href')); return gl.utils.visitUrl($editBtn.attr('href'));
}; };
ShortcutsIssuable.prototype.openSidebarDropdown = function(name) { ShortcutsIssuable.prototype.openSidebarDropdown = function(name) {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
.on('click', sidebarToggleSelector, () => this.toggleSidebar()) .on('click', sidebarToggleSelector, () => this.toggleSidebar())
.on('click', pinnedToggleSelector, () => this.togglePinnedState()) .on('click', pinnedToggleSelector, () => this.togglePinnedState())
.on('click', 'html, body', (e) => this.handleClickEvent(e)) .on('click', 'html, body', (e) => this.handleClickEvent(e))
.on('page:change', () => this.renderState()) .on('DOMContentLoaded', () => this.renderState())
.on('todo:toggle', (e, count) => this.updateTodoCount(count)); .on('todo:toggle', (e, count) => this.updateTodoCount(count));
this.renderState(); this.renderState();
} }
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
destroy() { destroy() {
this.cancel(); this.cancel();
document.removeEventListener('visibilitychange', this.handleVisibilityChange); document.removeEventListener('visibilitychange', this.handleVisibilityChange);
$(document).off('visibilitychange').off('page:before-unload'); $(document).off('visibilitychange').off('beforeunload');
} }
/* private */ /* private */
...@@ -111,8 +111,9 @@ ...@@ -111,8 +111,9 @@
} }
initPageUnloadHandling() { initPageUnloadHandling() {
// TODO: Consider refactoring in light of turbolinks removal.
// prevent interval continuing after page change, when kept in cache by Turbolinks // prevent interval continuing after page change, when kept in cache by Turbolinks
$(document).on('page:before-unload', () => this.cancel()); $(document).on('beforeunload', () => this.cancel());
} }
handleVisibilityChange(e) { handleVisibilityChange(e) {
......
/* eslint-disable class-methods-use-this, no-new, func-names, prefer-template, no-unneeded-ternary, object-shorthand, space-before-function-paren, comma-dangle, quote-props, consistent-return, no-else-return, no-param-reassign, max-len */ /* eslint-disable class-methods-use-this, no-new, func-names, prefer-template, no-unneeded-ternary, object-shorthand, space-before-function-paren, comma-dangle, quote-props, consistent-return, no-else-return, no-param-reassign, max-len */
/* global UsersSelect */ /* global UsersSelect */
/* global Turbolinks */
((global) => { ((global) => {
class Todos { class Todos {
...@@ -34,7 +33,7 @@ ...@@ -34,7 +33,7 @@
$('form.filter-form').on('submit', function (event) { $('form.filter-form').on('submit', function (event) {
event.preventDefault(); event.preventDefault();
Turbolinks.visit(this.action + '&' + $(this).serialize()); gl.utils.visitUrl(this.action + '&' + $(this).serialize());
}); });
} }
...@@ -142,7 +141,7 @@ ...@@ -142,7 +141,7 @@
}; };
url = gl.utils.mergeUrlParams(pageParams, url); url = gl.utils.mergeUrlParams(pageParams, url);
} }
return Turbolinks.visit(url); return gl.utils.visitUrl(url);
} }
} }
...@@ -156,7 +155,7 @@ ...@@ -156,7 +155,7 @@
e.preventDefault(); e.preventDefault();
return window.open(todoLink, '_blank'); return window.open(todoLink, '_blank');
} else { } else {
return Turbolinks.visit(todoLink); return gl.utils.visitUrl(todoLink);
} }
} }
} }
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, max-len */
/* global Turbolinks */
(function() { (function() {
this.TreeView = (function() { this.TreeView = (function() {
function TreeView() { function TreeView() {
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
e.preventDefault(); e.preventDefault();
return window.open(path, '_blank'); return window.open(path, '_blank');
} else { } else {
return Turbolinks.visit(path); return gl.utils.visitUrl(path);
} }
} }
}); });
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
} else if (e.which === 13) { } else if (e.which === 13) {
path = $('.tree-item.selected .tree-item-file-name a').attr('href'); path = $('.tree-item.selected .tree-item-file-name a').attr('href');
if (path) { if (path) {
return Turbolinks.visit(path); return gl.utils.visitUrl(path);
} }
} }
}); });
......
...@@ -149,7 +149,6 @@ content on the Users#show page. ...@@ -149,7 +149,6 @@ content on the Users#show page.
new_state = new_state.replace(/\/+$/, ''); new_state = new_state.replace(/\/+$/, '');
new_state += this._location.search + this._location.hash; new_state += this._location.search + this._location.hash;
history.replaceState({ history.replaceState({
turbolinks: true,
url: new_state url: new_state
}, document.title, new_state); }, document.title, new_state);
return new_state; return new_state;
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
gl.VueGlPagination = Vue.extend({ gl.VueGlPagination = Vue.extend({
props: { props: {
// TODO: Consider refactoring in light of turbolinks removal.
/** /**
This function will take the information given by the pagination component This function will take the information given by the pagination component
And make a new Turbolinks call And make a new Turbolinks call
...@@ -20,7 +22,7 @@ ...@@ -20,7 +22,7 @@
Here is an example `change` method: Here is an example `change` method:
change(pagenum, apiScope) { change(pagenum, apiScope) {
Turbolinks.visit(`?scope=${apiScope}&p=${pagenum}`); gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`);
}, },
*/ */
......
/* global Vue, Turbolinks, gl */ /* global Vue, gl */
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
((gl) => { ((gl) => {
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
}, },
methods: { methods: {
change(pagenum, apiScope) { change(pagenum, apiScope) {
Turbolinks.visit(`?scope=${apiScope}&p=${pagenum}`); gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`);
}, },
author(pipeline) { author(pipeline) {
if (!pipeline.commit) return { avatar_url: '', web_url: '', username: '' }; if (!pipeline.commit) return { avatar_url: '', web_url: '', username: '' };
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
window.removeEventListener('beforeunload', removeIntervals); window.removeEventListener('beforeunload', removeIntervals);
window.removeEventListener('focus', startIntervals); window.removeEventListener('focus', startIntervals);
window.removeEventListener('blur', removeIntervals); window.removeEventListener('blur', removeIntervals);
document.removeEventListener('page:fetch', removeAll); document.removeEventListener('beforeunload', removeAll);
}; };
window.addEventListener('beforeunload', removeIntervals); window.addEventListener('beforeunload', removeIntervals);
window.addEventListener('focus', startIntervals); window.addEventListener('focus', startIntervals);
window.addEventListener('blur', removeIntervals); window.addEventListener('blur', removeIntervals);
document.addEventListener('page:fetch', removeAll); document.addEventListener('beforeunload', removeAll);
}; };
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
@import "framework/modal.scss"; @import "framework/modal.scss";
@import "framework/nav.scss"; @import "framework/nav.scss";
@import "framework/pagination.scss"; @import "framework/pagination.scss";
@import "framework/progress.scss";
@import "framework/panels.scss"; @import "framework/panels.scss";
@import "framework/selects.scss"; @import "framework/selects.scss";
@import "framework/sidebar.scss"; @import "framework/sidebar.scss";
......
html.turbolinks-progress-bar::before {
background-color: $progress-color!important;
height: 2px!important;
box-shadow: 0 0 10px $progress-color, 0 0 5px $progress-color;
}
module JavascriptHelper module JavascriptHelper
def page_specific_javascript_tag(js) def page_specific_javascript_tag(js)
javascript_include_tag asset_path(js), { "data-turbolinks-track" => true } javascript_include_tag asset_path(js)
end end
end end
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
- providers.each do |provider| - providers.each do |provider|
%span.light %span.light
- has_icon = provider_has_icon?(provider) - has_icon = provider_has_icon?(provider)
= link_to provider_image_tag(provider), omniauth_authorize_path(:user, provider), method: :post, class: (has_icon ? 'oauth-image-link' : 'btn'), "data-no-turbolink" => "true" = link_to provider_image_tag(provider), omniauth_authorize_path(:user, provider), method: :post, class: (has_icon ? 'oauth-image-link' : 'btn')
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
rather than Git. Please convert rather than Git. Please convert
= link_to 'them to Git,', 'https://www.atlassian.com/git/tutorials/migrating-overview' = link_to 'them to Git,', 'https://www.atlassian.com/git/tutorials/migrating-overview'
and go through the and go through the
= link_to 'import flow', status_import_bitbucket_path, 'data-no-turbolink' => 'true' = link_to 'import flow', status_import_bitbucket_path
again. again.
.js-importer-status{ data: { jobs_import_path: "#{jobs_import_bitbucket_path}", import_path: "#{import_bitbucket_path}" } } .js-importer-status{ data: { jobs_import_path: "#{jobs_import_bitbucket_path}", import_path: "#{import_bitbucket_path}" } }
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
- if content_for?(:page_specific_javascripts) - if content_for?(:page_specific_javascripts)
= yield :page_specific_javascripts = yield :page_specific_javascripts
= yield :project_javascripts
= csrf_meta_tags = csrf_meta_tags
- unless browser.safari? - unless browser.safari?
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
%body{ class: "#{user_application_theme}", data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}" } } %body{ class: "#{user_application_theme}", data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}" } }
= Gon::Base.render_data = Gon::Base.render_data
-# Ideally this would be inside the head, but turbolinks only evaluates page-specific JS in the body.
= yield :scripts_body_top
= render "layouts/header/default", title: header_title = render "layouts/header/default", title: header_title
= render 'layouts/page', sidebar: sidebar, nav: nav = render 'layouts/page', sidebar: sidebar, nav: nav
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
- header_title project_title(@project) unless header_title - header_title project_title(@project) unless header_title
- nav "project" - nav "project"
- content_for :scripts_body_top do - content_for :project_javascripts do
- project = @target_project || @project - project = @target_project || @project
- if @project_wiki && @page - if @project_wiki && @page
- preview_markdown_path = namespace_project_wiki_preview_markdown_path(project.namespace, project, @page.slug) - preview_markdown_path = namespace_project_wiki_preview_markdown_path(project.namespace, project, @page.slug)
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
= link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'provider-btn' do = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'provider-btn' do
Disconnect Disconnect
- else - else
= link_to omniauth_authorize_path(:user, provider), method: :post, class: 'provider-btn not-active', "data-no-turbolink" => "true" do = link_to omniauth_authorize_path(:user, provider), method: :post, class: 'provider-btn not-active' do
Connect Connect
%hr %hr
- if current_user.can_change_username? - if current_user.can_change_username?
......
...@@ -108,10 +108,10 @@ ...@@ -108,10 +108,10 @@
= render "projects/commit/change", type: 'cherry-pick', commit: @merge_request.merge_commit, title: @merge_request.title = render "projects/commit/change", type: 'cherry-pick', commit: @merge_request.merge_commit, title: @merge_request.title
:javascript :javascript
var merge_request; $(function () {
new MergeRequest({
merge_request = new MergeRequest({
action: "#{controller.action_name}" action: "#{controller.action_name}"
}); });
});
var mrRefreshWidgetUrl = "#{mr_widget_refresh_url(@merge_request)}"; var mrRefreshWidgetUrl = "#{mr_widget_refresh_url(@merge_request)}";
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
= icon('github', text: 'GitHub') = icon('github', text: 'GitHub')
%div %div
- if bitbucket_import_enabled? - if bitbucket_import_enabled?
= link_to status_import_bitbucket_path, class: "btn import_bitbucket #{'how_to_import_link' unless bitbucket_import_configured?}", "data-no-turbolink" => "true" do = link_to status_import_bitbucket_path, class: "btn import_bitbucket #{'how_to_import_link' unless bitbucket_import_configured?}" do
= icon('bitbucket', text: 'Bitbucket') = icon('bitbucket', text: 'Bitbucket')
- unless bitbucket_import_configured? - unless bitbucket_import_configured?
= render 'bitbucket_import_modal' = render 'bitbucket_import_modal'
......
...@@ -92,5 +92,5 @@ ...@@ -92,5 +92,5 @@
new SubscriptionSelect(); new SubscriptionSelect();
$('form.filter-form').on('submit', function (event) { $('form.filter-form').on('submit', function (event) {
event.preventDefault(); event.preventDefault();
Turbolinks.visit(this.action + '&' + $(this).serialize()); gl.utils.visitUrl(this.action + '&' + $(this).serialize());
}); });
---
title: Remove turbolinks.
merge_request: !8570
author:
...@@ -501,6 +501,9 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -501,6 +501,9 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I fill in merge request search with "Fe"' do step 'I fill in merge request search with "Fe"' do
fill_in 'issuable_search', with: "Fe" fill_in 'issuable_search', with: "Fe"
page.within '.merge-requests-holder' do
find('.merge-request')
end
end end
step 'I click the "Target branch" dropdown' do step 'I click the "Target branch" dropdown' do
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
}); });
}); });
return load = function() { return load = function() {
return $(document).trigger('page:load'); return $(document).trigger('load');
}; };
}); });
}).call(this); }).call(this);
...@@ -34,11 +34,5 @@ ...@@ -34,11 +34,5 @@
$('#required5').val('1').change(); $('#required5').val('1').change();
return expect($('.submit')).not.toBeDisabled(); return expect($('.submit')).not.toBeDisabled();
}); });
return it('is called on page:load event', function() {
var spy;
spy = spyOn($.fn, 'requiresInput');
$(document).trigger('page:load');
return expect(spy).toHaveBeenCalled();
});
}); });
}).call(this); }).call(this);
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
secondTab.click(); secondTab.click();
expect(historySpy).toHaveBeenCalledWith({ expect(historySpy).toHaveBeenCalledWith({
turbolinks: true,
url: newState, url: newState,
}, document.title, newState); }, document.title, newState);
}); });
......
/* eslint-disable no-new */ /* eslint-disable no-new */
/* global Build */ /* global Build */
/* global Turbolinks */
//= require lib/utils/datetime_utility //= require lib/utils/datetime_utility
//= require lib/utils/url_utility
//= require build //= require build
//= require breakpoints //= require breakpoints
//= require jquery.nicescroll //= require jquery.nicescroll
//= require turbolinks
describe('Build', () => { describe('Build', () => {
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1`; const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1`;
...@@ -167,7 +166,7 @@ describe('Build', () => { ...@@ -167,7 +166,7 @@ describe('Build', () => {
}); });
it('reloads the page when the build is done', () => { it('reloads the page when the build is done', () => {
spyOn(Turbolinks, 'visit'); spyOn(gl.utils, 'visitUrl');
jasmine.clock().tick(4001); jasmine.clock().tick(4001);
const [{ success, context }] = $.ajax.calls.argsFor(1); const [{ success, context }] = $.ajax.calls.argsFor(1);
...@@ -177,7 +176,7 @@ describe('Build', () => { ...@@ -177,7 +176,7 @@ describe('Build', () => {
append: true, append: true,
}); });
expect(Turbolinks.visit).toHaveBeenCalledWith(BUILD_URL); expect(gl.utils.visitUrl).toHaveBeenCalledWith(BUILD_URL);
}); });
}); });
}); });
......
/* global Turbolinks */ //= require lib/utils/url_utility
//= require turbolinks
//= require lib/utils/common_utils //= require lib/utils/common_utils
//= require filtered_search/filtered_search_token_keys //= require filtered_search/filtered_search_token_keys
//= require filtered_search/filtered_search_tokenizer //= require filtered_search/filtered_search_tokenizer
...@@ -38,7 +36,7 @@ ...@@ -38,7 +36,7 @@
it('should search with a single word', () => { it('should search with a single word', () => {
getInput().value = 'searchTerm'; getInput().value = 'searchTerm';
spyOn(Turbolinks, 'visit').and.callFake((url) => { spyOn(gl.utils, 'visitUrl').and.callFake((url) => {
expect(url).toEqual(`${defaultParams}&search=searchTerm`); expect(url).toEqual(`${defaultParams}&search=searchTerm`);
}); });
...@@ -48,7 +46,7 @@ ...@@ -48,7 +46,7 @@
it('should search with multiple words', () => { it('should search with multiple words', () => {
getInput().value = 'awesome search terms'; getInput().value = 'awesome search terms';
spyOn(Turbolinks, 'visit').and.callFake((url) => { spyOn(gl.utils, 'visitUrl').and.callFake((url) => {
expect(url).toEqual(`${defaultParams}&search=awesome+search+terms`); expect(url).toEqual(`${defaultParams}&search=awesome+search+terms`);
}); });
...@@ -58,7 +56,7 @@ ...@@ -58,7 +56,7 @@
it('should search with special characters', () => { it('should search with special characters', () => {
getInput().value = '~!@#$%^&*()_+{}:<>,.?/'; getInput().value = '~!@#$%^&*()_+{}:<>,.?/';
spyOn(Turbolinks, 'visit').and.callFake((url) => { spyOn(gl.utils, 'visitUrl').and.callFake((url) => {
expect(url).toEqual(`${defaultParams}&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`); expect(url).toEqual(`${defaultParams}&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`);
}); });
......
/* eslint-disable comma-dangle, no-param-reassign, no-unused-expressions, max-len */ /* eslint-disable comma-dangle, no-param-reassign, no-unused-expressions, max-len */
/* global Turbolinks */
/*= require jquery */ /*= require jquery */
/*= require gl_dropdown */ /*= require gl_dropdown */
/*= require turbolinks */
/*= require lib/utils/common_utils */ /*= require lib/utils/common_utils */
/*= require lib/utils/type_utility */ /*= require lib/utils/type_utility */
//= require lib/utils/url_utility
(() => { (() => {
const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link'; const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link';
...@@ -113,13 +112,13 @@ ...@@ -113,13 +112,13 @@
expect(this.dropdownContainerElement).toHaveClass('open'); expect(this.dropdownContainerElement).toHaveClass('open');
const randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0; const randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0;
navigateWithKeys('down', randomIndex, () => { navigateWithKeys('down', randomIndex, () => {
spyOn(Turbolinks, 'visit').and.stub(); spyOn(gl.utils, 'visitUrl').and.stub();
navigateWithKeys('enter', null, () => { navigateWithKeys('enter', null, () => {
expect(this.dropdownContainerElement).not.toHaveClass('open'); expect(this.dropdownContainerElement).not.toHaveClass('open');
const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement); const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement);
expect(link).toHaveClass('is-active'); expect(link).toHaveClass('is-active');
const linkedLocation = link.attr('href'); const linkedLocation = link.attr('href');
if (linkedLocation && linkedLocation !== '#') expect(Turbolinks.visit).toHaveBeenCalledWith(linkedLocation); if (linkedLocation && linkedLocation !== '#') expect(gl.utils.visitUrl).toHaveBeenCalledWith(linkedLocation);
}); });
}); });
}); });
......
/* global Issuable */ /* global Issuable */
/* global Turbolinks */
//= require lib/utils/url_utility
//= require issuable //= require issuable
//= require turbolinks
(() => { (() => {
const BASE_URL = '/user/project/issues?scope=all&state=closed'; const BASE_URL = '/user/project/issues?scope=all&state=closed';
...@@ -42,39 +41,39 @@ ...@@ -42,39 +41,39 @@
}); });
it('should contain only the default parameters', () => { it('should contain only the default parameters', () => {
spyOn(Turbolinks, 'visit'); spyOn(gl.utils, 'visitUrl');
Issuable.filterResults($filtersForm); Issuable.filterResults($filtersForm);
expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + DEFAULT_PARAMS); expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + DEFAULT_PARAMS);
}); });
it('should filter for the phrase "broken"', () => { it('should filter for the phrase "broken"', () => {
spyOn(Turbolinks, 'visit'); spyOn(gl.utils, 'visitUrl');
updateForm({ search: 'broken' }, $filtersForm); updateForm({ search: 'broken' }, $filtersForm);
Issuable.filterResults($filtersForm); Issuable.filterResults($filtersForm);
const params = `${DEFAULT_PARAMS}&search=broken`; const params = `${DEFAULT_PARAMS}&search=broken`;
expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + params); expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + params);
}); });
it('should keep query parameters after modifying filter', () => { it('should keep query parameters after modifying filter', () => {
spyOn(Turbolinks, 'visit'); spyOn(gl.utils, 'visitUrl');
// initial filter // initial filter
updateForm({ milestone_title: 'v1.0' }, $filtersForm); updateForm({ milestone_title: 'v1.0' }, $filtersForm);
Issuable.filterResults($filtersForm); Issuable.filterResults($filtersForm);
let params = `${DEFAULT_PARAMS}&milestone_title=v1.0`; let params = `${DEFAULT_PARAMS}&milestone_title=v1.0`;
expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + params); expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + params);
// update filter // update filter
updateForm({ label_name: 'Frontend' }, $filtersForm); updateForm({ label_name: 'Frontend' }, $filtersForm);
Issuable.filterResults($filtersForm); Issuable.filterResults($filtersForm);
params = `${DEFAULT_PARAMS}&milestone_title=v1.0&label_name=Frontend`; params = `${DEFAULT_PARAMS}&milestone_title=v1.0&label_name=Frontend`;
expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + params); expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + params);
}); });
}); });
}); });
......
...@@ -99,7 +99,6 @@ ...@@ -99,7 +99,6 @@
}); });
newState = this.subject('commits'); newState = this.subject('commits');
expect(this.spies.history).toHaveBeenCalledWith({ expect(this.spies.history).toHaveBeenCalledWith({
turbolinks: true,
url: newState url: newState
}, document.title, newState); }, document.title, newState);
}); });
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
/*= require lib/utils/common_utils */ /*= require lib/utils/common_utils */
/*= require lib/utils/type_utility */ /*= require lib/utils/type_utility */
/*= require fuzzaldrin-plus */ /*= require fuzzaldrin-plus */
/*= require turbolinks */
/*= require jquery.turbolinks */
(function() { (function() {
var addBodyAttributes, assertLinks, dashboardIssuesPath, dashboardMRsPath, groupIssuesPath, groupMRsPath, groupName, mockDashboardOptions, mockGroupOptions, mockProjectOptions, projectIssuesPath, projectMRsPath, projectName, userId, widget; var addBodyAttributes, assertLinks, dashboardIssuesPath, dashboardMRsPath, groupIssuesPath, groupMRsPath, groupName, mockDashboardOptions, mockGroupOptions, mockProjectOptions, projectIssuesPath, projectMRsPath, projectName, userId, widget;
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
const interval = this.smartInterval; const interval = this.smartInterval;
setTimeout(() => { setTimeout(() => {
$(document).trigger('page:before-unload'); $(document).trigger('beforeunload');
expect(interval.state.intervalId).toBeUndefined(); expect(interval.state.intervalId).toBeUndefined();
expect(interval.getCurrentInterval()).toBe(interval.cfg.startingInterval); expect(interval.getCurrentInterval()).toBe(interval.cfg.startingInterval);
done(); done();
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
// everything in application, however you may get better load performance if you // everything in application, however you may get better load performance if you
// require the specific files that are being used in the spec that tests them. // require the specific files that are being used in the spec that tests them.
/*= require jquery */ /*= require jquery */
/*= require jquery.turbolinks */
/*= require bootstrap */ /*= require bootstrap */
/*= require underscore */ /*= require underscore */
......
// Generated by CoffeeScript 1.7.1
/*
jQuery.Turbolinks ~ https://github.com/kossnocorp/jquery.turbolinks
jQuery plugin for drop-in fix binded events problem caused by Turbolinks
The MIT License
Copyright (c) 2012-2013 Sasha Koss & Rico Sta. Cruz
*/
(function() {
var $, $document;
$ = window.jQuery || (typeof require === "function" ? require('jquery') : void 0);
$document = $(document);
$.turbo = {
version: '2.1.0',
isReady: false,
use: function(load, fetch) {
return $document.off('.turbo').on("" + load + ".turbo", this.onLoad).on("" + fetch + ".turbo", this.onFetch);
},
addCallback: function(callback) {
if ($.turbo.isReady) {
callback($);
}
return $document.on('turbo:ready', function() {
return callback($);
});
},
onLoad: function() {
$.turbo.isReady = true;
return $document.trigger('turbo:ready');
},
onFetch: function() {
return $.turbo.isReady = false;
},
register: function() {
$(this.onLoad);
return $.fn.ready = this.addCallback;
}
};
$.turbo.register();
$.turbo.use('page:load', 'page:fetch');
}).call(this);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment