Added trade unions

This commit is contained in:
a-ill
2023-08-17 12:01:26 +03:00
parent 8e88a5a895
commit 73ece83c60
63 changed files with 1402 additions and 55 deletions

View File

@@ -13,9 +13,9 @@ export function debounce(func, timeout){
}
export function svgFromObject(object) {
var objectDoc = object.contentDocument;
var svgItem = objectDoc.querySelector("path");
return svgItem
var objectDoc = object.contentDocument
var svgItems = objectDoc.querySelectorAll("path")
return svgItems
}
export function rem2px(rem) {

View File

@@ -6,7 +6,15 @@ export function addGroupPinContent(g,content,locale) {
for (let field of ["location","members","contact"]) {
let fieldText = content[field] + ": "
if (field=="contact") {
text += fieldText + "<a href='" + g.contact + "' target='_blank' rel=noreferrer>" + g.contact + "</a>"
if (g.contact.includes("@") && g.contact.trim().split(" ").length==1) {
text += fieldText + "<a href='mailto:" + g.contact + "' target='_blank' rel=noreferrer>" + g.contact + "</a>"
}
else if (g.contact.includes("http")) {
text += fieldText + "<a href='" + g.contact + "' target='_blank' rel=noreferrer>" + g.contact + "</a>"
}
else {
text += fieldText + g.contact + "<br>"
}
}
else if (field=="location") {
let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined)
@@ -175,4 +183,31 @@ export function addPartnersPinContent(g,content,locale) {
}
}
return {text,coordinates}
}
export function addTradeUnionPinContent(g,content,locale) {
let coordinates
let text = "<b>"+content["TradeUnion"]+"</b><br>"
for (let field of ["name","location","members","contact"]) {
let fieldText = content[field] + ": "
if (field=="contact") {
text += fieldText + "<a href='" + g.contact + "' target='_blank' rel=noreferrer>" + g.contact + "</a>"
}
else if (field=="location") {
let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined)
let locationString
if (locale=="en") {
locationString = location.map(x => x).join(", ")
}
else {
locationString = location.map(x => translate(content, x)).join(", ")
}
text += fieldText + locationString + "<br>"
coordinates = [g.latitude,g.longitude]
}
else {
text += fieldText + g[field] + "<br>"
}
}
return {text,coordinates}
}