Commit 2764ade4 authored by Lukas Eipert's avatar Lukas Eipert

Replace jquery.get with Rails.ajax

In the code below jQuery.get is used in order to download javascript
that is then executed. In order to move away from jQuery ajax, we can
utilize Rails.ajax which does the same thing.
parent 46527a69
import $ from 'jquery'; import $ from 'jquery';
import { Rails } from '~/lib/utils/rails_ujs';
import projectNew from '~/projects/project_new'; import projectNew from '~/projects/project_new';
const bindEvents = () => { const bindEvents = () => {
...@@ -125,13 +126,11 @@ export default () => { ...@@ -125,13 +126,11 @@ export default () => {
$groupTabContent.on('ajax:success', bindEvents); $groupTabContent.on('ajax:success', bindEvents);
$navElement.one('click', () => { $navElement.one('click', () => {
// eslint-disable-next-line no-jquery/no-ajax Rails.ajax({ url: $tabContent.data('initialTemplates'), type: 'GET' });
$.get($tabContent.data('initialTemplates'));
}); });
$groupNavElement.one('click', () => { $groupNavElement.one('click', () => {
// eslint-disable-next-line no-jquery/no-ajax Rails.ajax({ url: $groupTabContent.data('initialTemplates'), type: 'GET' });
$.get($groupTabContent.data('initialTemplates'));
}); });
bindEvents(); bindEvents();
......
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