...
 
Commits (2)
......@@ -71,7 +71,8 @@ import { DatenexportSeiteComponent } from './datenexport-seite/datenexport-seite
import { QuellenAngabeComponent } from './widgets/entry/quellen-angabe/quellen-angabe.component';
import { FormcontrolBlockComponent } from './home/contact/formcontrol-block/formcontrol-block.component';
import { MenubarItemComponent } from './menubar/menubar-item/menubar-item.component';
import { BliIconComponent } from './portal/bli/bli-icon/bli-icon.component';
import { BliIconComponent } from './portal/bli/bli-icon/bli-icon.component';
import { TagComponent } from './widgets/search/tag/tag.component';
enableProdMode();
......@@ -133,6 +134,7 @@ enableProdMode();
FormcontrolBlockComponent,
MenubarItemComponent,
BliIconComponent,
TagComponent,
//MatAutocompleteModule,
],
imports: [
......
......@@ -81,7 +81,9 @@ export class OsmNode {
}
if(data['tags'] && Array.isArray(data['tags'])){
for(let tagData of data['tags']){
if(!this.hasTag(tagData.key)){
this.tags.push(new KeyValuePair(tagData));
}
}
}
......
......@@ -312,3 +312,6 @@ div.list-group.search-results div div div.list-group-item.list-group-item-action
.detailbox {
padding-top: 5px;
}
displaytag{
width:100%;
}
\ No newline at end of file
......@@ -711,16 +711,8 @@
<div class="card container">
<div *ngIf="showElementApps()" class="card-body detailbox">
<div *ngFor="let tag of getAppTags(nodeService.detailView)" class="form-group row item-detail">
<label for="elementKey" class="col-sm-4 col-form-label">
<strong>{{translateTagKey(tag.key)}}</strong>
</label>
<div class="col">
<span class="form-control-plaintext"
id="elementKey">{{tag.value}}</span>
</div>
<displaytag [tag]="tag"></displaytag>
</div>
</div>
<div *ngIf="!showElementApps()" class="card-body detailbox">
<label class="col-sm ">
......
......@@ -20,6 +20,7 @@ import { BliComponent } from '../portal/bli/bli.component';
import { NominatimService } from '../services/nominatim.service'
import { AuthService } from '../services/auth.service';
import { registerLocaleData } from '@angular/common';
import { TagComponent } from '../widgets/search/tag/tag.component';
import localeDe from '@angular/common/locales/de';
import OlMap from 'ol/Map';
......
displaytag{
width:100%;
}
displaytag > div.item-detail{
width:100%;
}
.inline-icon{
width:20px;
height:20px;
margin-right:15px;
display:inline-block;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
}
.label{
width: 17em;
}
.tag_value{
max-width: 18em;
}
.form-control-plaintext{
max-width: 18em;
white-space:pre;
overflow:hidden;
text-overflow:fade;
text-overflow:"...";
}
div.tag_value > a{
overflow:hidden;
}
<div class="form-group row item-detail">
<ng-container *ngIf="!isAppTag()">
<label for="elementKey" class="col-sm-4 col-form-label">
<strong>{{translateTagKey(tag.key)}}</strong>
</label>
<div class="col">
<span class="form-control-plaintext" id="">{{tag.value}}</span>
</div>
</ng-container>
<ng-container *ngIf="isAppTag()">
<label for="elementKey" class="col-sm-4 col-form-label">
<a *ngIf="isLink()" href="{{tag.value}}" target="_blank">
<div class="inline-icon" *ngIf="getIcon() != ''" [ngStyle]="{'background-image': 'url(/'+getIcon()+')'}"></div>
<strong>{{getAppName()}}</strong>
</a>
<div *ngIf="!isLink() && getIcon() != ''" class="inline-icon" [ngStyle]="{'background-image': 'url(/'+getIcon()+')'}"></div>
<strong *ngIf="!isLink()">{{getAppName()}}</strong>
</label>
<div class="col tag_value">
<a *ngIf="isLink()" href="{{tag.value}}" target="_blank">
<span class="form-control-plaintext" id="">{{tag.value}}</span>
</a>
<span *ngIf="!isLink()" class="form-control-plaintext" id="">{{tag.value}}</span>
</div>
</ng-container>
</div>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TagComponent } from './tag.component';
describe('TagComponent', () => {
let component: TagComponent;
let fixture: ComponentFixture<TagComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TagComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TagComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, Input } from '@angular/core';
import { KeyValuePair } from '../../../models/KeyValuePair';
@Component({
selector: 'displaytag',
templateUrl: './tag.component.html',
styleUrls: ['./tag.component.css']
})
export class TagComponent implements OnInit {
@Input('tag')
tag:KeyValuePair = null;
constructor() { }
ngOnInit() {
}
isAppTag():boolean{
if(this.tag){
return this.tag.key.startsWith('_gpd:app:');
}
return false;
}
getAppName(){
if(this.isAppTag()){
return this.tag.key.split(':')[2];
}
return "";
}
isLink():boolean{
if(this.tag){
return this.isAppTag() && this.tag.key.split(':')[3]=='url';
}
return false
}
getIcon(){
if(this.getAppName() == 'culture'){
return 'assets/img/app-link-icons/culture-logo.gif';
}
return '';
}
translateTagValue(value:string){
switch(value){
default:{
return value;
}
}
}
translateAppDataTagKey(key:string):string{
let rawKey = key.replace('_gpd:app:','');
let parts = rawKey.split(':');
let appName = parts.shift();
return appName+": "+this.translateTagKey(parts.join(':'));
}
translateTagKey(key:string){
if(key.startsWith('_gpd:app:')){
return this.translateAppDataTagKey(key);
}
switch(key){
case 'contact:website':{
return 'Homepage';
}
case 'addr:street':{
return 'Straße';
}
case 'addr:housename':{
return 'Gebäudename';
}
case 'addr:housenumber':{
return 'Hausnr.';
}
case 'addr:country':{
return 'Land';
}
case 'addr:postcode':{
return 'PLZ';
}
case 'addr:city':{
return 'Stadt';
}
case 'start_date':{
return 'Gründung';
}
case '_gpd:organisationsForm':{
return 'Organisations-form';
}
case '_gpd:ehrenamtliche':{
return 'Ehrenamtliche Mitarbeiter';
}
case '_gpd:hauptamtliche':{
return 'Hauptamtliche Mitarbeiter';
}
case 'url':{
return 'Website';
}
case 'source':{
return 'Website';
}
case 'operator:type':{
return 'Rechtsform';
}
case 'description':{
return 'Beschreibung';
}
case 'name':{
return 'Name';
}
case 'office':{
return 'Organisation';
}
case 'opening_hours':{
return 'Öffnungszeiten';
}
case '_gpd:aktionsradius':{
return 'Aktionsradius';
}
case '_gpd:welfare':{
return 'Gemeinnützigkeit';
}
case '_gpd:sharing_offers':{
return 'Angebote des Teilen und Schenkens';
}
case '_gpd:sharing_organisator':{
return 'Organisator*in';
}
case '_gpd:sharing_free_offers':{
return 'Kostenfreie Angebote';
}
case '_gpd:sharing_nonfree_offers':{
return 'Kostenpflichtige Angebote';
}
case '_gpd:sustainable_nutrition':{
return 'Angebote zum Thema nachhaltiges Ernährung';
}
case '_gpd:sustainable_nutrition_assortment':{
return 'Sortiment';
}
default:{
return key;
}
}
}
}