Skip to content

Commit

Permalink
add option for html formatted search results
Browse files Browse the repository at this point in the history
  • Loading branch information
sheggi committed Aug 30, 2022
1 parent 7b1e95e commit a730231
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/map/search/Control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
@mousedown.prevent.stop="clearAll(props.search)"
/>
</template>
<template v-if="isHtmlFormatted" slot="singleLabel" slot-scope="props">
<span class="option__title" v-html="props.option.label" />
</template>
<template v-if="isHtmlFormatted" slot="option" slot-scope="props">
<span class="option__title" v-html="props.option.label" />
</template>
<span slot="noResult">{{ $t('no_search_result') }}</span>
<span slot="noOptions">{{ $t('search_list_empty') }}</span>
</Multiselect>
Expand All @@ -46,11 +52,14 @@ import Multiselect from 'vue-multiselect'
import { mapActions } from 'vuex'
import { debounce } from 'lodash'
import 'vue-multiselect/dist/vue-multiselect.min.css'
import { searchService } from '~/config/setup'
export default {
components: { Multiselect },
data() {
return {}
return {
isHtmlFormatted: searchService.isHtmlFormatted,
}
},
mounted() {
Expand Down
3 changes: 3 additions & 0 deletions config/defaults/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export const searchService = {
x: item.x,
y: item.y,
})),

// search labels are formatted with html
isHtmlFormatted: false,
}

export const projectionDefinitions = {
Expand Down
3 changes: 3 additions & 0 deletions config/graubuenden/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export const searchService = {
y: item.attrs.y,
})),
],

// search labels are formatted with html
isHtmlFormatted: true,
}

/**
Expand Down

0 comments on commit a730231

Please sign in to comment.