Skip to content

Commit 5f40797

Browse files
authored
Merge pull request #91 from gtt-project/fix/empty-map-on-issues-new
Fixed empty map on issue/new view when changing tracker/status/project
2 parents 7adeda4 + f648268 commit 5f40797

File tree

1 file changed

+1
-58
lines changed

1 file changed

+1
-58
lines changed

src/components/gtt-client.ts

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -323,63 +323,6 @@ export class GttClient {
323323
this.map.on('moveend', this.updateFilter.bind(this))
324324
})
325325

326-
// To fix an issue with empty map after changing the tracker type
327-
document.querySelectorAll('select#issue_tracker_id').forEach(element => {
328-
const self = this
329-
element.addEventListener('change', () => {
330-
// https://stackoverflow.com/questions/45340281/ajaxcomplete-in-pure-javascript
331-
(function() {
332-
const send = XMLHttpRequest.prototype.send
333-
XMLHttpRequest.prototype.send = function() {
334-
this.addEventListener('load', () => {
335-
self.zoomToExtent(true)
336-
}, {
337-
once: true
338-
})
339-
return send.apply(this, arguments)
340-
}
341-
})()
342-
})
343-
})
344-
345-
// To fix an issue with empty map after changing the status
346-
document.querySelectorAll('select#issue_status_id').forEach(element => {
347-
const self = this
348-
element.addEventListener('change', () => {
349-
// https://stackoverflow.com/questions/45340281/ajaxcomplete-in-pure-javascript
350-
(function() {
351-
const send = XMLHttpRequest.prototype.send
352-
XMLHttpRequest.prototype.send = function() {
353-
this.addEventListener('load', () => {
354-
self.zoomToExtent(true)
355-
}, {
356-
once: true
357-
})
358-
return send.apply(this, arguments)
359-
}
360-
})()
361-
})
362-
})
363-
364-
// To fix an issue with empty map after changing the project
365-
document.querySelectorAll('select#issue_project_id').forEach(element => {
366-
const self = this
367-
element.addEventListener('change', () => {
368-
// https://stackoverflow.com/questions/45340281/ajaxcomplete-in-pure-javascript
369-
(function() {
370-
const send = XMLHttpRequest.prototype.send
371-
XMLHttpRequest.prototype.send = function() {
372-
this.addEventListener('load', () => {
373-
self.zoomToExtent(true)
374-
}, {
375-
once: true
376-
})
377-
return send.apply(this, arguments)
378-
}
379-
})()
380-
})
381-
})
382-
383326
// Handle multiple maps per page
384327
this.maps.push(this.map)
385328
}
@@ -1357,7 +1300,7 @@ const buildDistanceFilterRow = (operator: any, values: any):void => {
13571300
window.replaceIssueFormWithInitMap = window.replaceIssueFormWith
13581301
window.replaceIssueFormWith = (html) => {
13591302
window.replaceIssueFormWithInitMap(html)
1360-
const ol_maps = document.querySelector('div#update div.ol-map') as HTMLDivElement
1303+
const ol_maps = document.querySelector("form[class$='_issue'] div.ol-map") as HTMLDivElement
13611304
if (ol_maps) {
13621305
new GttClient({target: ol_maps})
13631306
}

0 commit comments

Comments
 (0)