Skip to content

Commit f94db01

Browse files
authored
Merge pull request #237 from gtt-project/fix/unstable-expand-location-for-next
Fix unstable expand location in issues index view for next
2 parents f2f53f0 + 3de34bb commit f94db01

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

app/views/issues/index/_map.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<% if @project and @project.module_enabled?(:gtt) %>
22
<% collapsed = Setting.plugin_redmine_gtt['default_collapsed_issues_page_map'] == 'true' %>
33
<fieldset id="location" class="<%= "collapsible" + (collapsed ? " collapsed" : "") %>">
4-
<legend class="<%= "icon " + (collapsed ? "icon-collapsed" : "icon-expended") %>"><%= l(:field_location) %></legend>
4+
<legend onclick="toggleFieldset(this);" class="<%= "icon " + (collapsed ? "icon-collapsed" : "icon-expended") %>"><%= l(:field_location) %></legend>
55

66
<%= map_tag map: @project.map, geom: (Issue.array_to_geojson(@issues, include_properties: { only: %i(id subject tracker_id status_id) }) if @issues),
77
popup: { href: '/issues/[id]' }, collapsed: collapsed, rotation: @project.map_rotation %>

src/components/gtt-client/init/events.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ResizeObserver } from '@juggle/resize-observer';
22

33
import { updateFilter } from "../helpers";
4-
import { zoomToExtent, toggleAndLoadMap } from "../openlayers";
4+
import { zoomToExtent } from "../openlayers";
55

66
/**
77
* Initialize event listeners for the GttClient instance.
@@ -36,7 +36,7 @@ function handleCollapsed(this: any): void {
3636
return;
3737
}
3838
const mapDiv = mutation.target as HTMLDivElement;
39-
if (mapDiv && mapDiv.style.display === 'block') {
39+
if (mapDiv && (mapDiv.style.display === 'block' || mapDiv.style.display === '')) {
4040
zoomToExtent.call(this, true);
4141
collapsedObserver.disconnect();
4242
}
@@ -124,14 +124,6 @@ function handleFilters(this: any): void {
124124
if (document.querySelectorAll('tr#tr_distance').length > 0) {
125125
this.filters.distance = true;
126126
}
127-
// Set up click event listener for location filter legend
128-
const legend = document.querySelector('fieldset#location legend') as HTMLLegendElement;
129-
if (legend) {
130-
legend.addEventListener('click', (evt) => {
131-
const element = evt.currentTarget as HTMLLegendElement;
132-
toggleAndLoadMap(element);
133-
});
134-
}
135127
// Call zoomToExtent and updateFilter functions
136128
zoomToExtent.call(this);
137129
this.map.on('moveend', updateFilter.bind(this));

src/components/gtt-client/openlayers/index.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -476,22 +476,6 @@ export function setGeolocation(currentMap: Map) {
476476
this.toolbar.addControl(geolocationCtrl)
477477
}
478478

479-
export function toggleAndLoadMap(el: HTMLLegendElement) {
480-
const fieldset = el.parentElement
481-
fieldset.classList.toggle('collapsed')
482-
el.classList.toggle('icon-expended')
483-
el.classList.toggle('icon-collapsed')
484-
const div = fieldset.querySelector('div')
485-
if (div.style.display === 'none') {
486-
div.style.display = 'block'
487-
} else {
488-
div.style.display = 'none'
489-
}
490-
this.maps.forEach(function (m: any) {
491-
m.updateSize()
492-
})
493-
}
494-
495479
export function setView() {
496480
const center = fromLonLat([parseFloat(this.defaults.lon), parseFloat(this.defaults.lat)])
497481
const view = new View({

0 commit comments

Comments
 (0)