bcgov / smk-legacy-ui

Legacy Admin UI for the SMK has been de-supported. Please see the CLI under https://github.com/bcgov/smk for an alternative.
Apache License 2.0
8 stars 3 forks source link

Rich pop-up configuration #51

Open NicoledeGreef opened 6 years ago

NicoledeGreef commented 6 years ago

Allow authors to specify HTML to give output structure to feature pop-ups e.g. tables and font formatting tags Support attribute value(s) along with static text labels, e.g. Well ID: {well id value} Dynamic hyperlink generation, e.g. http://www.url.com/page?item={some id} Embed videos, etc. sky's the limit in terms of html support

See DMF KML pop-up support configuration as an example. Example site: BC Parks

qqnluaq commented 6 years ago

add code to detect hyperlink in attribute values, and convert to link: easy SMK already supports using a description attribute as the content of the identify popup. add configuration to layers to support a custom identify popup on a per-layer basis, with a template mechanism for substitution of attribute values.

cpspicer commented 6 years ago

Just need to honor KML styles - see pop-up configuration in the BC Parks KML file. That's the target.

cpspicer commented 6 years ago

Could be considered a duplicate with support for KML uploaded layers. The primary goal would be to honor the KML style instead of over riding it. Example in the 2018 Parks KML file added to item #23

qqnluaq commented 6 years ago

Feature Popup Template

Configuration

{
    "layers": [
        {
            "id": <layer-id>,
            "popupTemplate": <template>
        }
    ]
}

The <template> can be a chunk of HTML that is treated as a Vue template.

If the <template> starts with a @, it names an existing template. There are 3 templates built into SMK:

Template context

If the <template> is a Vue template, the props passed to the component will be:

NicoledeGreef commented 6 years ago

I have been able to customize pop-up content but the UI aspect of doing so is perhaps not rock solid in terms of usability. It's hard to tell whether you're in code mode or preview mode and I have lost changes once or twice when I was sure I saved. Not sure it was user error when this happened but it's possible. I will move this ticket to verified based on my very basic implementation':

<div>
<div><h1>{{ feature.title }}</h1></div>
<hr>
<div><b>Street Address:</b> {{ feature.properties['addressString'] }}&nbsp;&nbsp;{{ feature.properties['POSTAL_CODE'] }}</div>
<div><b>Operator:</b> {{ feature.properties['OPERATOR_NAME'] }}</div>
<div><b>Health Authority:</b> {{ feature.properties['HEALTH_AUTHORITY'] }}</div>
<div><b>Type:</b> {{ feature.properties['TYPE'] }}</div>
<br>
</div>