Skip to content

Commit 17bd522

Browse files
committed
Merge remote-tracking branch 'origin/main' into ftr/prepare-release
2 parents 534de82 + 16e7539 commit 17bd522

File tree

12 files changed

+167
-45
lines changed

12 files changed

+167
-45
lines changed

app/views/settings/gtt/_settings.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h3><%= l(:select_default_tracker_icon) %></h3>
22

3-
<% Tracker.all.each do |t| %>
3+
<% Tracker.sorted.each do |t| %>
44
<p>
55
<%= content_tag :label, t.name %>
66
<%= select_tag "settings[tracker_#{t.id}]", "<option>#{@settings["tracker_#{t.id}"]}</option>".html_safe %>
@@ -11,7 +11,7 @@
1111
<div class="box tabular settings">
1212
<h3><%= l(:select_default_status_color) %></h3>
1313

14-
<% IssueStatus.all.sort.each do |t| %>
14+
<% IssueStatus.sorted.each do |t| %>
1515
<p>
1616
<%= content_tag :label, t.name %>
1717
<%= color_field_tag "settings[status_#{t.id}]", @settings["status_#{t.id}"] %>

config/locales/de.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# German strings go here for Rails i18n
22
de:
3-
error_unable_to_update_project_gtt_settings: Die GTT-Einstellungen des Projekts können
4-
nicht aktualisiert werden (%{value})
3+
error_unable_to_update_project_gtt_settings: Die GTT-Einstellungen des Projekts
4+
können nicht aktualisiert werden (%{value})
55
field_gtt_tile_source_ids: Tile-Resourcen
66
label_nearby: in der Nähe (lat,lng)
77
label_type: Typ
@@ -17,9 +17,10 @@ de:
1717
label_parameters: Parameter
1818
label_tab_geocoder: Geocoder
1919
geocoder_options: Geocoder Optionen
20-
gtt_tile_sources_info: Wählen Sie die Tile Resourcen aus, die in diesem Projekt verfügbar
21-
sein sollen.
22-
gtt_settings_general_maxzoom_level: Standardwert für die maximale Zoomstufe der Karte
20+
gtt_tile_sources_info: Wählen Sie die Tile Resourcen aus, die in diesem Projekt
21+
verfügbar sein sollen.
22+
gtt_settings_general_maxzoom_level: Standardwert für die maximale Zoomstufe der
23+
Karte
2324
label_default_collapsed_issues_page_map: Standardmäßig ausgeblendete Karte für Tickets
2425
field_default: Standard für neue Projekte
2526
field_geometry: Geomtrie
@@ -42,10 +43,11 @@ de:
4243
label_gtt_point: Punkt
4344
label_gtt_linestring: Linie
4445
label_gtt_polygon: Polygon
45-
error_invalid_json: muss gültiges JSON sein
46+
error_invalid_json: Muss gültiges JSON sein
4647
label_editable_geometry_types_on_issue_map: Editierbare Geometrietypen auf der Ausgabekarte
4748
select_default_tracker_icon: 'Auswahl des Standard-Tracker-Symbols:'
48-
label_enable_geojson_upload_on_issue_map: Aktivieren von GeoJSON-Upload auf der Themenkarte
49+
label_enable_geojson_upload_on_issue_map: Aktivieren von GeoJSON-Upload auf der
50+
Themenkarte
4951
label_enable_geocoding_on_map: Geokodierung auf der Karte aktivieren
5052
select_default_status_color: 'Auswahl der Standard-Statusfarbe:'
5153
select_default_map_settings: 'Standardmäßige Kartenvoreinstellungen festlegen:'
@@ -57,7 +59,7 @@ de:
5759
gtt_tile_sources_select: -- Typ auswählen --
5860
gtt_tile_sources_select_osm: OpenStreetMap
5961
gtt_tile_sources_select_tilewms: Tiled WMS
60-
gtt_tile_sources_load_example: Beispielkonfiguration laden
62+
gtt_tile_sources_load_example: Beispielkonfiguration laden.
6163
label_baselayer: Basislayer
6264
gtt_tile_sources_select_imagewms: Image WMS
6365
gtt_tile_sources_select_xyz: XYZ Tiles

config/locales/en.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# English strings go here for Rails i18n
22
en:
3-
error_invalid_json: must be valid JSON
4-
error_unable_to_update_project_gtt_settings: "Unable to update project GTT settings (%{value})"
3+
error_invalid_json: Must be valid JSON
4+
error_unable_to_update_project_gtt_settings: "Unable to update project GTT settings\
5+
\ (%{value})"
56

67
field_default: Default for new projects
78
field_geometry: "Geometry"
@@ -42,7 +43,8 @@ en:
4243

4344
geocoder_options: "Geocoder Options"
4445

45-
gtt_tile_sources_info: "Select the tile sources that should be available in this project."
46+
gtt_tile_sources_info: "Select the tile sources that should be available in this\
47+
\ project."
4648
gtt_tile_sources_select: "-- Select type --"
4749
gtt_tile_sources_select_imagewms: "Image WMS"
4850
gtt_tile_sources_select_osm: "OpenStreetMap"

config/locales/ja.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ja:
4848
gtt_tile_sources_select_osm: "OpenStreetMap"
4949
gtt_tile_sources_select_tilewms: "Tiled WMS"
5050
gtt_tile_sources_select_xyz: "XYZ Tiles"
51-
gtt_tile_sources_load_example: "サンプル設定をロード"
51+
gtt_tile_sources_load_example: "サンプル設定をロード"
5252

5353
gtt_settings_general_center_lon: "既定の地図中心経度"
5454
gtt_settings_general_center_lat: "既定の地図中心緯度"

src/components/gtt-client.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'ol/ol.css'
22
import 'ol-ext/dist/ol-ext.min.css'
3-
import { Map, Feature, View, Geolocation } from 'ol'
3+
import { Map, Feature, View, Geolocation, Collection } from 'ol'
44
import 'ol-ext/filter/Base'
5-
import { Geometry, Point } from 'ol/geom'
5+
import { Geometry, GeometryCollection, Point } from 'ol/geom'
66
import { GeoJSON, WKT } from 'ol/format'
77
import { Layer, Tile, Image } from 'ol/layer'
88
import VectorLayer from 'ol/layer/Vector'
@@ -41,6 +41,9 @@ import { FeatureLike } from 'ol/Feature'
4141
import TileSource from 'ol/source/Tile'
4242
import ImageSource from 'ol/source/Image'
4343
import { Options as ImageWMSOptions } from 'ol/source/ImageWMS'
44+
import JSONFeature from 'ol/format/JSONFeature'
45+
import BaseEvent from 'ol/events/Event'
46+
import { CollectionEvent } from 'ol/Collection'
4447

4548
interface GttClientOption {
4649
target: HTMLDivElement | null
@@ -308,10 +311,11 @@ export class GttClient {
308311
this.setView()
309312
this.setGeocoding(this.map)
310313
this.setGeolocation(this.map)
311-
this.toolbar.addControl (new FullScreen())
312-
this.toolbar.addControl (new Rotate())
313314
this.parseHistory()
314315

316+
this.map.addControl (new FullScreen())
317+
this.map.addControl (new Rotate())
318+
315319
// Control button
316320
const maximizeCtrl = new Button({
317321
html: '<i class="material-icons" >zoom_out_map</i>',
@@ -521,13 +525,14 @@ export class GttClient {
521525
// Control Select
522526
const select = new Select({
523527
layers: [this.vector],
528+
style: null,
524529
multi: false
525530
})
526531
this.map.addInteraction(select)
527532

528533
// On selected => show/hide popup
529-
select.getFeatures().on(['add'], evt => {
530-
const feature = evt.target
534+
select.getFeatures().on(['add'], (evt: any) => {
535+
const feature = evt.element
531536

532537
const content: Array<string> = []
533538
content.push(`<b>${feature.get('subject')}</b><br/>`)

src/components/gtt-setting.ts

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,24 @@ export const gtt_setting = ():void => {
1111
const wrapper = $('<div>', {
1212
text: ''
1313
})
14-
$('<i>', {
15-
class: "ui-icons material-icons",
16-
title: item.label,
17-
text: item.value
18-
}).prependTo(wrapper)
14+
const style = item.optgroup.toLowerCase().split(' ').join('-')
15+
switch (style) {
16+
case 'material-icons':
17+
$('<i>', {
18+
class: 'ui-icons ' + style,
19+
title: item.label,
20+
text: item.value
21+
}).prependTo(wrapper)
22+
break;
23+
24+
default:
25+
$('<i>', {
26+
class: 'ui-icons ' + style + ' icon-' + item.value,
27+
title: item.label,
28+
text: ''
29+
}).prependTo(wrapper)
30+
break;
31+
}
1932
return li.append(wrapper).appendTo(ul)
2033
}
2134
});
@@ -25,44 +38,58 @@ export const gtt_setting = ():void => {
2538
const selectedValue = element.value
2639
if (element.length === 1 && selectedValue !== "") {
2740
element.remove(0)
28-
element.append(new Option("", "", false, false))
41+
// element.append(new Option("", "", false, false))
2942
}
3043
for (let font in FontSymbol.prototype.defs.fonts) {
44+
const optgroup = document.createElement('optgroup')
45+
optgroup.label = FontSymbol.prototype.defs.fonts[font].name
3146
for (let i in glyph) {
3247
if (glyph[i].font == font) {
3348
const selected = selectedValue === i
3449
const words = i.split('_')
3550
const text = words.map((word) => {
3651
return word[0].toUpperCase() + word.substring(1)
37-
}).join(" ")
38-
element.append(new Option(text, i, selected, selected))
52+
}).join(' ')
53+
optgroup.appendChild(new Option(text, i, selected, selected))
3954
if (selected) {
40-
element.nextElementSibling.className = "material-icons"
41-
element.nextElementSibling.textContent = i
55+
const style = font.toLowerCase().split(' ').join('-')
56+
switch (style) {
57+
case 'material-icons':
58+
element.nextElementSibling.className = style
59+
element.nextElementSibling.textContent = i
60+
break;
61+
62+
default:
63+
element.nextElementSibling.className = style + ' icon-' + i
64+
element.nextElementSibling.textContent = ''
65+
break;
66+
}
4267
}
4368
}
4469
}
70+
element.append(optgroup)
4571
}
4672

4773
// Apply better Selector styling with jQuery UI (available in Redmine)
4874
$(element)
4975
.selectmenu({
5076
change: function(event: any, data: any) {
51-
console.log(data.item.value)
52-
document.querySelector(`#icon_${element.id}`).textContent = data.item.value
77+
const style = data.item.optgroup.toLowerCase().split(' ').join('-')
78+
switch (style) {
79+
case 'material-icons':
80+
document.querySelector(`#icon_${element.id}`).className = style
81+
document.querySelector(`#icon_${element.id}`).textContent = data.item.value
82+
break;
83+
84+
default:
85+
document.querySelector(`#icon_${element.id}`).className = style + ' icon-' + data.item.value
86+
document.querySelector(`#icon_${element.id}`).textContent = ''
87+
break;
88+
}
5389
}
5490
})
5591
.selectmenu('menuWidget')
5692
.addClass('select-overflow')
5793
.addClass('ui-menu-icons customicons')
5894
})
59-
60-
// document.querySelectorAll("[id^='settings_tracker_']").forEach((element: HTMLSelectElement) => {
61-
// element.addEventListener('change', (ev) => {
62-
// const currentTarget = ev.currentTarget as HTMLSelectElement
63-
// const trackerId = currentTarget.id
64-
// document.querySelector(`#icon_${trackerId}`).className = "material-icons"
65-
// document.querySelector(`#icon_${trackerId}`).textContent = currentTarget.value
66-
// })
67-
// })
6895
}

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import 'ol/ol.css'
22
import 'ol-ext/dist/ol-ext.min.css'
33
import './stylesheets/app.scss'
44

5+
// Custom Icons
6+
import './stylesheets/custom-icons.css'
7+
import './stylesheets/CustomIconsDef.js'
8+
59
// Material Design Icons
610
// https://github.com/marella/material-design-icons/tree/main/font#readme
711
import '@material-design-icons/font/filled.css'
8-
import './fonts/MaterialDesignDef.js'
12+
import './stylesheets/MaterialDesignDef.js'
913

1014
import { GttClient } from './components/gtt-client'
1115
import { gtt_setting } from './components/gtt-setting'

src/stylesheets/CustomIconsDef.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import ol_style_FontSymbol from 'ol-ext/style/FontSymbol'
2+
3+
ol_style_FontSymbol.addDefs(
4+
{ "font":"custom-icons",
5+
"name":"Custom Icons",
6+
"copyright":"Apache-2.0",
7+
"prefix": "gtt"
8+
},
9+
{ "lobsta": "\uf101",
10+
"park_bench": "\uf102",
11+
"road": "\uf103",
12+
"waste": "\uf104"
13+
});
14+
15+
export default ol_style_FontSymbol
File renamed without changes.

src/stylesheets/app.scss

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
*/
44
.ol-map {
55
width: 100%;
6-
height: 420px;
6+
height: 400px;
77
border: 1px solid #E4E4E4;
88
}
99
#issue-form .ol-map {
1010
width: 100%;
1111
margin-bottom: 1em;
1212
}
1313

14+
$breakpoint-tablet: 899px;
15+
@media (max-width: $breakpoint-tablet) {
16+
.ol-map {
17+
height: 340px;
18+
}
19+
}
20+
1421
.ol-control button {
1522
background-color: rgba(52, 73, 94, 0.8);
23+
height: 32px;
24+
width: 32px;
1625
}
1726
.ol-control button:hover {
1827
background-color: rgba(52, 73, 94, 1);
@@ -24,11 +33,21 @@
2433
.ol-full-screen button.ol-full-screen-false,
2534
.ol-rotate button.ol-rotate-reset,
2635
.ol-bar .ol-button button {
27-
height: 32px;
28-
width: 32px;
2936
font-size: 1.6em;
3037
}
3138

39+
div.ol-full-screen {
40+
right: 3.0em;
41+
}
42+
43+
div.ol-rotate {
44+
right: 5.5em;
45+
}
46+
47+
div.ol-full-screen {
48+
right: 3.0em;
49+
}
50+
3251
.ol-control.ol-bar.ol-top.ol-left, .ol-control.ol-bar.ol-top.ol-right {
3352
top: 5.2em;
3453
}

0 commit comments

Comments
 (0)