Skip to content

Commit 2488a84

Browse files
committed
Fix AJAX error caused by old version of JQuery being loaded
Fix JS eval error when loading calendar
1 parent 5688a78 commit 2488a84

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

app/assets/javascripts/application.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
1111
// about supported directives.
1212
//
13-
//= require jquery
13+
//= require jquery3
1414
//= require jquery.turbolinks
1515
//= require jquery_ujs
1616
//= require bootstrap-sprockets
@@ -79,8 +79,7 @@ const Index = {
7979

8080
// Perform an ajax request to load the calendar and replace the contents
8181
window.loadCalendar = function(url) {
82-
req = $.ajax(url);
83-
req.done((res) => eval(res));
82+
$.ajax(url, { dataType: 'script', cache: true }); // Is loaded automatically.
8483
return true;
8584
}
8685

app/views/events/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<ul class="nav nav-xs nav-pills index-display-options">
2727
<%# We should consider setting the active status based on the query fragment so we can deeplink %>
2828
<%= tab('List', 'fa fa-list', 'home', active: true) %>
29-
<%= tab('Calendar', 'fa fa-calendar', 'calendar', options: { 'data-calendar': calendar_events_path(search_and_facet_params.merge(format: :js, per_page: 200))}) %>
29+
<%= tab('Calendar', 'fa fa-calendar', 'calendar', options: { 'data-calendar': calendar_events_path(search_and_facet_params.merge(per_page: 200))}) %>
3030
<% if TeSS::Config.map_enabled %>
3131
<%= tab('Map', 'fa fa-globe', 'map',
3232
disabled: { check: (search_and_facet_params[:online] == 'true'),

0 commit comments

Comments
 (0)