Skip to content

Commit c096b1f

Browse files
author
Mattia Roccoberton
committed
Fix component loading with Turbolinks
1 parent d7c4fe6 commit c096b1f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/assets/javascripts/activeadmin/dynamic_fields.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@
190190
}
191191
}
192192

193-
// Init
194-
$(document).ready(function () {
193+
function dfInit() {
195194
// Setup dynamic fields
196195
const selectors = '.active_admin .input [data-if], .active_admin .input [data-eq], .active_admin .input [data-not], .active_admin .input [data-match], .active_admin .input [data-mismatch], .active_admin .input [data-function]'
197196
$(selectors).each(function () {
@@ -249,5 +248,8 @@
249248
$('[data-field][data-field-type="select"][data-save-url]').each(function () {
250249
$(this).on('change', $.proxy(dfUpdateField, $(this)))
251250
})
252-
})
251+
}
252+
253+
$(document).ready(dfInit)
254+
$(document).on('turbolinks:load', dfInit)
253255
})()

0 commit comments

Comments
 (0)