Skip to content

Commit

Permalink
Render place detail content with isHTML flag set as HTML
Browse files Browse the repository at this point in the history
To accommodate raw landmark HTML in shareabouts place models, render
content with the isHTML flag set as raw HTML in the place detail template.
Assume raw HTML content is stored under the 'description' field, and
that this field is of type 'textarea', as set in the dynamic form section
of the config.

Addresses: #407
  • Loading branch information
goldpbear committed Sep 28, 2016
1 parent 89414b0 commit 06a8b15
Showing 1 changed file with 52 additions and 39 deletions.
91 changes: 52 additions & 39 deletions src/sa_web/jstemplates/place-detail.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
{{> place-detail-story-bar }}

{{> place-detail-promotion-bar }}
{{#unless isHTML}}
{{> place-detail-promotion-bar }}
{{/unless}}

<header class="place-header clearfix">
<h1 class="place-header-title {{#if story}}is-visuallyhidden{{/if}}">
{{>location-string location }}
{{#if fullTitle}}
{{fullTitle}}
{{else}}
{{#if title}}
{{title}}
{{#unless isHTML}}
<h1 class="place-header-title {{#if story}}is-visuallyhidden{{/if}}">
{{>location-string location }}
{{#if fullTitle}}
{{fullTitle}}
{{else}}
{{name}}
{{/if}}
{{/if}}
</h1>
<span class="place-submission-details">
{{#_}}<strong class="point-submitter">
{{#if submitter.avatar_url }}
<img src="{{ submitter.avatar_url }}" class="avatar" />
{{^}}
<img src="{{ STATIC_URL }}css/images/user-50.png" class="avatar" />
{{#if title}}
{{title}}
{{else}}
{{name}}
{{/if}}
{{/if}}
{{#if submitter.name }}
{{ submitter.name }}
{{^}}
{{#if submitter_name }}
{{ submitter_name }}
</h1>
<span class="place-submission-details">
{{#_}}<strong class="point-submitter">
{{#if submitter.avatar_url }}
<img src="{{ submitter.avatar_url }}" class="avatar" />
{{^}}
{{ anonymous_name }}
<img src="{{ STATIC_URL }}css/images/user-50.png" class="avatar" />
{{/if}}
{{/if}}
</strong> {{ action_text }} this {{ place_type_label location_type}}
{{#if submitter.name }}
{{ submitter.name }}
{{^}}
{{#if submitter_name }}
{{ submitter_name }}
{{^}}
{{ anonymous_name }}
{{/if}}
{{/if}}
</strong> {{ action_text }} this {{ place_type_label location_type}}

{{#if region}}
in {{ region }}
{{/if}}{{/_}}
{{#if region}}
in {{ region }}
{{/if}}{{/_}}

<time datetime="{{ created_datetime }}" class="response-date"><a href="/{{ datasetSlug }}/{{ id }}">{{ fromnow created_datetime }}</a></time>
<time datetime="{{ created_datetime }}" class="response-date"><a href="/{{ datasetSlug }}/{{ id }}">{{ fromnow created_datetime }}</a></time>

<span class="survey-count">{{ survey_count }} {{ survey_label_by_count }}</span>
<span class="survey-count">{{ survey_count }} {{ survey_label_by_count }}</span>

{{^if survey_config}}
<a href="/{{ datasetSlug }}/{{ id }}" class="view-on-map-btn btn btn-small">View On Map</a>
{{/if}}
{{^if survey_config}}
<a href="/{{ datasetSlug }}/{{ id }}" class="view-on-map-btn btn btn-small">View On Map</a>
{{/if}}

</span>
</span>
{{/unless}}
</header>

<section class="place-items">
Expand All @@ -57,7 +61,9 @@ <h1 class="place-header-title {{#if story}}is-visuallyhidden{{/if}}">

{{#each_place_item "submitter_name" "name" "location_type" "fullTitle" "title" "name"}}
<div class="place-item place-item-{{ name }}">
<span class="place-label place-label-{{ name }}">{{ prompt }}</span>
{{#unless ../isHTML}}
<span class="place-label place-label-{{ name }}">{{ prompt }}</span>
{{/unless}}

{{#is type "datetime"}}
<p class="place-value place-value-{{ name }}">{{nlToBr content}}</p>
Expand All @@ -68,7 +74,13 @@ <h1 class="place-header-title {{#if story}}is-visuallyhidden{{/if}}">
{{/is}}

{{#is type "textarea"}}
<p class="place-value place-value-{{ name }}">{{nlToBr content}}</p>
<p class="place-value place-value-{{ name }}">
{{#if ../../isHTML}}
{{{content}}}
{{else}}
{{nlToBr content}}
{{/if}}
</p>
{{/is}}

{{#is type "radio_big_buttons"}}
Expand Down Expand Up @@ -121,8 +133,9 @@ <h1 class="place-header-title {{#if story}}is-visuallyhidden{{/if}}">
</section>

{{#if survey_config}}

<section class="survey" id="survey"></section>
{{#unless isHTML}}
<section class="survey" id="survey"></section>
{{/unless}}
{{/if}}

{{> place-detail-story-bar-tagline }}

0 comments on commit 06a8b15

Please sign in to comment.