Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from turbolinks to turbo #1198

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[v#.#.#] ([month] [YYYY])
- Upgrade to Rails 7.0.8
- Add importmap-rails to handle js libraries
- Remove turbolinks and add turbo-rails
- Upgraded gems:
- [gem]
- Bugs fixes:
Expand Down
9 changes: 4 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ gem 'coffee-rails', '~> 5.0'
# Cache-friendly, client-side local time
gem 'local_time', '>= 2.0.0'

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
gem 'turbo-rails', '~> 1.4'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
Expand Down Expand Up @@ -236,15 +235,15 @@ end

# ----------------------------------------------------------------- Calculators

gem 'dradis-calculator_cvss', '~> 4.10.0'
gem 'dradis-calculator_dread', '~> 4.10.0'
gem 'dradis-calculator_cvss', github: 'dradis/dradis-calculator_cvss', branch: 'turbo'
gem 'dradis-calculator_dread', github: 'dradis/dradis-calculator_dread', branch: 'turbo'

# ---------------------------------------------------------------------- Export
gem 'dradis-csv_export', '~> 4.10.0'
gem 'dradis-html_export', github: 'dradis/dradis-html_export', branch: 'rails-7-upgrade'

# ---------------------------------------------------------------------- Import
gem 'dradis-csv', '~> 4.10.0'
gem 'dradis-csv', github: 'dradis/dradis-csv', branch: 'turbo'

# ---------------------------------------------------------------------- Upload
gem 'dradis-acunetix', '~> 4.10.0'
Expand Down
45 changes: 32 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
GIT
remote: https://github.com/dradis/dradis-calculator_cvss.git
revision: 489eb724381a26daf5420e572f4a7e94510faa5b
branch: turbo
specs:
dradis-calculator_cvss (4.10.0)
dradis-plugins (~> 4.0)

GIT
remote: https://github.com/dradis/dradis-calculator_dread.git
revision: f8367f6144c260bee1b1f11aca9afe1380f11bdf
branch: turbo
specs:
dradis-calculator_dread (4.10.0)
dradis-plugins (~> 4.0)

GIT
remote: https://github.com/dradis/dradis-csv.git
revision: 8cc5e6d771d236fdce4f3e8ed99dc2ca3686b9b3
branch: turbo
specs:
dradis-csv (4.10.0)
dradis-plugins (~> 4.0)

GIT
remote: https://github.com/dradis/dradis-html_export.git
revision: 70ccfe4e99d8cf077afe5aa5a97c73b2dd07049b
Expand Down Expand Up @@ -141,14 +165,8 @@ GEM
dradis-burp (4.10.0)
dradis-plugins (~> 4.0)
nokogiri (~> 1.3)
dradis-calculator_cvss (4.10.0)
dradis-plugins (~> 4.0)
dradis-calculator_dread (4.10.0)
dradis-plugins (~> 4.0)
dradis-coreimpact (4.10.0)
dradis-plugins (~> 4.0)
dradis-csv (4.10.0)
dradis-plugins (~> 4.0)
dradis-csv_export (4.10.0)
dradis-plugins (>= 4.8.0)
dradis-metasploit (4.10.0)
Expand Down Expand Up @@ -486,9 +504,10 @@ GEM
date
timecop (0.9.5)
timeout (0.4.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
turbo-rails (1.5.0)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.3.0)
Expand Down Expand Up @@ -539,10 +558,10 @@ DEPENDENCIES
dradis-api!
dradis-brakeman (~> 4.10.0)
dradis-burp (~> 4.10.0)
dradis-calculator_cvss (~> 4.10.0)
dradis-calculator_dread (~> 4.10.0)
dradis-calculator_cvss!
dradis-calculator_dread!
dradis-coreimpact (~> 4.10.0)
dradis-csv (~> 4.10.0)
dradis-csv!
dradis-csv_export (~> 4.10.0)
dradis-html_export!
dradis-metasploit (~> 4.10.0)
Expand Down Expand Up @@ -614,7 +633,7 @@ DEPENDENCIES
thor (~> 1.2.1)
time (>= 0.2.2)
timecop
turbolinks (~> 5)
turbo-rails (~> 1.4)
unicorn (= 6.1.0)
warden (~> 1.2.3)
web-console (>= 4.1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ App.cable.subscriptions.create 'NotificationsChannel',
connected: ->
console.log('Subscribed to NotificationsChannel.')
@perform('check_unread', {})
$(document).on 'turbolinks:load.notifications', =>
$(document).on 'turbo:load.notifications', =>
@perform('check_unread', {})

rejected: ->
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/legacy.application.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//= require turbolinks
//= require jquery3
//= require popper
//= require rails-ujs
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/shared/behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
});
}

document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
initBehaviors(document.querySelector('body'));
});

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/shared/datatable/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class DradisDatatable {
unbindDataTable() {
var that = this;

document.addEventListener('turbolinks:before-cache', function () {
document.addEventListener('turbo:before-cache', function () {
that.dataTable.destroy();
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/shared/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function initNotificationsDropdown() {
}
}

document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
initNotificationsDropdown();
});

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/shared/revisions.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->

if $('.js-diff-body').length
delRegex = /\[31m([\s\S]*?)\[0m/g
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/shared/sessions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function() {
document.addEventListener('turbo:load', function() {
if ($('body.unauthenticated').length) {
var charCount = 0,
strings = setStrings(),
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/tylium.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//= require jquery3
//= require jquery-ui
//= require rails-ujs
//= require turbolinks
// require activestorage
//= require jquery.form
//= require jquery.textchange.min
Expand Down
8 changes: 4 additions & 4 deletions app/assets/javascripts/tylium/behaviors.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The current list of plugins:
# * jQuery.Textile - handles the note editor (/vendor/)

document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->

# --------------------------------------------------- Standard jQuery plugins

Expand Down Expand Up @@ -174,11 +174,11 @@ document.addEventListener "turbolinks:load", ->
else
$(this).find($('[data-behavior~=scroll-wrapper]')).removeClass('hidden');

# Disable turbolinks for on-page anchor links (prevents page from jumping to top and allows smooth-scrolling)
# Disable turbo for on-page anchor links (prevents page from jumping to top and allows smooth-scrolling)
if $('a[href^="#"]').length
$('a[href^="#"]').each ->
if !$(this).data('turbolinks')
$(this).attr 'data-turbolinks', 'false'
if !$(this).data('turbo')
$(this).attr 'data-turbo', 'false'
return

# Smooth Scrolling - scroll to element on page load if hash present in current browser url
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/engines.js.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function(){
document.addEventListener('turbo:load', function(){
<%
Dradis::Plugins::with_feature(:addon).sort_by(&:plugin_description).each do |plugin|
begin
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/keyboard_shortcuts.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->

# Nodes#show shortcuts
if $('body.nodes').length
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if $('body.configurations').length

$('tbody tr.gemified td.value').on('blur', 'input', ->
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/modules/export.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if $('body.export').length

# Detect Export click
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/tylium/modules/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ function fileUploadInit() {
});
}

document.addEventListener("turbolinks:load", function() {
document.addEventListener("turbo:load", function() {
// Bind fileUpload on page load.
fileUploadInit();
});

// Un-bind fileUpload on page unload.
document.addEventListener('turbolinks:before-cache', function() {
document.addEventListener('turbo:before-cache', function() {
$('[data-behavior~=jquery-upload]').each(function() {
$(this).fileupload('destroy');
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if $('body.evidence.new').length
$('#evidence-host-list a[data-bs-toggle~=pill]').on 'click', (ev)->
path = $(this).data('path')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
}

document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if $('#issues').length
# Detect if we're displaying results of a query and toggle the widget
if $('.results').length
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if ($("body.merge.new").length)

# when clicking on the "expand/collapse" arrow icon, turn it upside down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class @SelectTagDropdown
$span.css("color", @$target.css("color"))
$span.html(@$target.html())

document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
$('#issues_editor .js-taglink').click (e) ->
$target = $(e.target)
new SelectTagDropdown($target)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/modules/nodes.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
$(".add_node_radio").click ->
$this = $(this)
$modal = $this.closest(".modal")
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/modules/search.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SearchWordHighlight
element.html src_str


document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if $('body.search.index').length
highlighter = new SearchWordHighlight
query = $(".form-search #q").val()
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/modules/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
changeState: function (key, state) {
localStorage.setItem(key, state);
Turbolinks.clearCache();
Turbo.cache.clear();
},
close: function () {
this.$sidebar
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/modules/state_button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
if ($('[data-behavior~=state-radio]').length) {
function updateBtn($selectedRadio) {
var selectedState = $selectedRadio
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/modules/uploads.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->
if $('body.upload').length
# Enable Ajax file uploads via 3rd party plugin
$bar = $('.progress-bar');
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/activities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function() {
document.addEventListener('turbo:load', function() {
var $infiniteScrollContainer = $('[data-behavior="infinite-scroll-container"]');
var loading = false;

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/boards/index.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->

if $('body.boards.index').length

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/boards/show.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SortableBoards
return


document.addEventListener "turbolinks:load", ->
document.addEventListener "turbo:load", ->

if $('body.boards.show').length
# ------------------------------------------------------------- List modals
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/issues.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
if ($('body.issues.index').length) {
$('[data-behavior~=issues-dropdown-toggle]').on('click', function (e) {
e.stopPropagation();
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/nodes/new_form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function() {
document.addEventListener('turbolinks:load', function() {
document.addEventListener('turbo:load', function() {
var copyOver = function($to, fromVal, $typeTo, typeFromVal) {
if ($to.val() === '' && fromVal !== '') {
$to.val(fromVal.trim().split('\n')[0] + '\n');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function(){
document.addEventListener('turbo:load', function(){
if ($('[data-behavior~=boards-summary]').length) {
var $boardsSummary = $('[data-behavior~=boards-summary]');
var url = $boardsSummary.data('url');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function(){
document.addEventListener('turbo:load', function(){
var $dataElement = $('#issues-summary-data'),
$chartElement = $('#issue-chart');

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/projects/summary.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
if ($('body.projects.show').length) {
$('a[data-bs-toggle="collapse"]').click(function () {
if ($(this).hasClass('collapsed')) {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/qa.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
if ($('[data-behavior~=qa-viewer]').length) {
$('[data-qa-visible]').each(function () {
$(this).toggleClass('d-none', $(this).data('qa-visible') === false);
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/upload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function () {
document.addEventListener('turbo:load', function () {
if ($('body.upload.index').length) {
$('[data-behavior~=tool-select]').on('change', function () {
let toolsWithInheritedState = [
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/pages/uploads/validation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('turbolinks:load', function() {
document.addEventListener('turbo:load', function() {
var $rtpValidation = $('[data-behavior~=rtp-validation]');

if ($rtpValidation.length) {
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class ApplicationController < ActionController::Base
include Authentication
include Turbo::Redirection

protect_from_forgery with: :exception
end
Loading