TerriaJS / neii-viewer

Data viewer for National Environmental Information Infrastructure
http://neii.gov.au/viewer/
Apache License 2.0
8 stars 4 forks source link

Site URL formatting error #90

Open ChantelleDoan opened 7 years ago

ChantelleDoan commented 7 years ago

Hi Data61,

Our client IMOS noticed an error with formatting of the Site URL field on the Feature Information (under the Site Detail section) popup. Interestingly, this error occurs only when viewing in curated data view and not when viewing in raw data view. Refer to screen shots below.

National Mooring Network (IMOS) http://neii.gov.au/viewer/#share=s-zfFSCj0daPHpYQxt3X2JoRhfISn

imos site url in raw data imos site url error

RacingTadpole commented 7 years ago

Thanks, I've raised an issue in TerriaJS for this and we'll get onto it.

ChantelleDoan commented 7 years ago

Thanks Arthur.

Regards, Chantelle Doan | NEII Programme Manager [Description: Description: cid:389443803@21082013-35A7] Environmental Information Services Bureau of Meteorology GPO Box 1289 Melbourne VIC 3001 Level 9, 700 Collins Street, Docklands VIC 3008 Tel: +61 3 9669 4475 | chantelle.doan@bom.gov.aumailto:chantelle.doan@bom.gov.au | www.bom.gov.auhttp://www.bom.gov.au/ [app email badge.jpg]http://www.bom.gov.au/app

From: Arthur Street [mailto:notifications@github.com] Sent: Friday, 24 February 2017 12:12 PM To: TerriaJS/neii-viewer Cc: Chantelle Doan; Author Subject: Re: [TerriaJS/neii-viewer] Site URL formatting error (#90)

Thanks, I've raised an issue in TerriaJS for this and we'll get onto it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/TerriaJS/neii-viewer/issues/90#issuecomment-282173657, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARD-l-tBkyyiANAclmxdDYgOuYAcZIAGks5rfi5RgaJpZM4MKmtv.

RacingTadpole commented 7 years ago

Ah, I found the problem here. It is in the feature info template of http://neii.bom.gov.au/cgi-bin/nemsr/get_viewer_config.json. If you search through that file for National Mooring Network (IMOS), and look at its featureInfoTemplate, you will see this code:

<td><a target='_blank' href='{{siteURL}}'>{{siteURL}}</a></td>

which means it is formatting the siteURL as a single link, even if it contains two.

I've submitted a change to TerriaJS to give us a way to get the desired behaviour, https://github.com/TerriaJS/terriajs/pull/2411 - will let you know how it goes.

ChantelleDoan commented 7 years ago

Thanks Arthur!

Chantelle

From: Arthur Street [mailto:notifications@github.com] Sent: Monday, 13 March 2017 5:02 PM To: TerriaJS/neii-viewer Cc: Chantelle Doan; Author Subject: Re: [TerriaJS/neii-viewer] Site URL formatting error (#90)

Ah, I found the problem here. It is in the feature info template of http://neii.bom.gov.au/cgi-bin/nemsr/get_viewer_config.json. If you search through that file for National Mooring Network (IMOS), and look at its featureInfoTemplate, you will see this code:

{{siteURL}}

which means it is formatting the siteURL as a single link, even if it contains two.

I've submitted a change to TerriaJS to give us a way to get the desired behaviour, TerriaJS/terriajs#2411https://github.com/TerriaJS/terriajs/pull/2411 - will let you know how it goes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/TerriaJS/neii-viewer/issues/90#issuecomment-286022111, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARD-l36s83SmCAYMaBoU33ItkRekEngXks5rlNu_gaJpZM4MKmtv.

RacingTadpole commented 7 years ago

OK, we have a solution that doesn't require any change in Terria.

The issue is that once you start using html tags in a feature info template, it assumes you are in control of all links - but in this case, we still want terria to do the "linkifying" for us.

It turns out that a markdown-formatted template doesn't make that same assumption. So, the solution is to use markdown - not html - in the feature info template. You can define a table in markdown using the format:

|Column Heading 1|Column Heading 2|
|--------|--------|
|Site name|Sydney|
|Site urls|example.com/1 and example.com/2|

etc. Also <h1>x</h1> is just # x in markdown.

So here is a working replacement for your feature info template for the Mooring item. I've left the observingCapabilities table as html since it didn't have the same problem. (You can mix html and markdown side-by-side, but once you're inside an html tag, you can't use markdown.)

"# Site Details\n\n|||\n|-------|-------|\n|Description|{{siteDescription}}|\n|Site URL|{{siteURL}}|\n|Operating Authority|{{operatingAuthority.name}}|\n|Operating Authority URL|{{operatingAuthority.url}}|\n|Site Data Licence Type|<a target='_blank' href='{{siteLicence.url}}'>{{siteLicence.prefLabel}}</a>|\n|Site Status|<a target='_blank' href='{{siteStatus.url}}'>{{siteStatus.prefLabel}}</a>|\n|Spatial Reference System|<a target='_blank' href='{{srsName.url}}'>{{srsName}}</a>|\n|Latitude|{{latitude}}|\n|Longitude|{{longitude}}|\n|Elevation|{{ahd}}|\n\n# Site Observation Capabilities\n\n{{#observingCapabilities}}<table class='cesium-infoBox-defaultTable'><tbody><tr><th>Observation Method</th><td> <a target='_blank' href='{{observationMethod.url}}'>{{observationMethod.prefLabel}}</a></td></tr><tr><th>Observed Property</th><td><a target='_blank' href='{{observedProperty.url}}'>{{observedProperty.prefLabel}}</a></td></tr><tr><th>Procedure</th><td>{{procedure}}</td></tr><tr><th>Data Availability</th><td><a target='_blank' href='{{dataAvailabilityStatus.url}}'>{{dataAvailabilityStatus.prefLabel}}</a></td></tr><tr><th>Sampling Regime</th><td><a target='_blank' href='{{samplingRegime.url}}'>{{samplingRegime.prefLabel}}</a></td></tr><tr><th>First Observation Date</th><td>{{firstObservationDate}}</td></tr><tr><th>Final Observation Date</th><td>{{finalObservationDate}}</td></tr></tbody></table><br />{{/observingCapabilities}}"

Does that make sense?

ChantelleDoan commented 7 years ago

Thanks for the feedback Author. Our developer is now looking into making the change.

Regards, Chantelle Doan | NEII Programme Manager [Description: Description: cid:389443803@21082013-35A7] Environmental Information Services Bureau of Meteorology GPO Box 1289 Melbourne VIC 3001 Level 9, 700 Collins Street, Docklands VIC 3008 Tel: +61 3 9669 4475 | chantelle.doan@bom.gov.aumailto:chantelle.doan@bom.gov.au | www.bom.gov.auhttp://www.bom.gov.au/ [app email badge.jpg]http://www.bom.gov.au/app

From: Arthur Street [mailto:notifications@github.com] Sent: Tuesday, 14 March 2017 10:47 AM To: TerriaJS/neii-viewer Cc: Chantelle Doan; Author Subject: Re: [TerriaJS/neii-viewer] Site URL formatting error (#90)

OK, we have a solution that doesn't require any change in Terria.

The issue is that once you start using html tags in a feature info template, it assumes you are in control of all links - but in this case, we still want terria to do the "linkifying" for us.

It turns out that a markdownhttps://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet-formatted template doesn't make that same assumption. So, the solution is to use markdown - not html - in the feature info template. You can define a table in markdown using the format:

|Column Heading 1|Column Heading 2|

|--------|--------|

|Site name|Sydney|

|Site urls|example.com/1 and example.com/2|

etc. Also

x

is just # x in markdown.

So here is a working replacement for your feature info template for the Mooring item. I've left the observingCapabilities table as html since it didn't have the same problem. (You can mix html and markdown side-by-side, but once you're inside an html tag, you can't use markdown.)

"# Site Details\n\n|||\n|-------|-------|\n|Description|{{siteDescription}}|\n|Site URL|{{siteURL}}|\n|Operating Authority|{{operatingAuthority.name}}|\n|Operating Authority URL|{{operatingAuthority.url}}|\n|Site Data Licence Type|{{siteLicence.prefLabel}}|\n|Site Status|{{siteStatus.prefLabel}}|\n|Spatial Reference System|{{srsName}}|\n|Latitude|{{latitude}}|\n|Longitude|{{longitude}}|\n|Elevation|{{ahd}}|\n\n# Site Observation Capabilities\n\n{{#observingCapabilities}}

Observation Method {{observationMethod.prefLabel}}
Observed Property{{observedProperty.prefLabel}}
Procedure{{procedure}}
Data Availability{{dataAvailabilityStatus.prefLabel}}
Sampling Regime{{samplingRegime.prefLabel}}
First Observation Date{{firstObservationDate}}
Final Observation Date{{finalObservationDate}}

{{/observingCapabilities}}"

Does that make sense?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/TerriaJS/neii-viewer/issues/90#issuecomment-286278737, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARD-l_i4CwBTC6v56Tn5Sf8EZjhN2bxrks5rldVxgaJpZM4MKmtv.