Commit b30b4614 authored by ∞'s avatar 💻

Fix navigation arrows on list view / autosubmit controller

Use Turbolinks instead of reinventing it ... This is one of the first
controllers iirc perhaps added before turbolinks (stimulus came first).

Otherwise, well bad code is gone anyway ^^
parent 48c8c503
......@@ -7,33 +7,6 @@ export default class extends Controller {
var data = serialize(this.element)
var url = window.location.pathname + '?' + data
if (this.url !== undefined) {
if (this.url === url) {
// console.log('aborted for same url', url);
return
}
if (this.xhr !== undefined && this.xhr.readyState < 4) {
this.xhr.abort()
}
}
this.url = url
this.xhr = new XMLHttpRequest()
this.xhr.open('GET', this.url)
this.xhr.onload = this.onload.bind(this)
this.xhr.send()
}
onload(e) {
var parser = new DOMParser()
var doc = parser.parseFromString(e.target.responseText, 'text/html')
var target = document.getElementById(this.targetId)
target.innerHTML = doc.getElementById(this.targetId).innerHTML
init(target)
window.history.pushState({}, doc.querySelector('title').innerHTML, this.url)
}
get targetId() {
return this.element.getAttribute('data-target')
Turbolinks.visit(url)
}
}
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
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