Skip to content

Commit

Permalink
update editor form fields
Browse files Browse the repository at this point in the history
  • Loading branch information
goldpbear committed Mar 24, 2017
1 parent 2076aba commit be9d1b3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/base/jstemplates/place-detail-field-types.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<!-- Template for all fields displayed by the place detail view. -->

{{#is type "datetime"}}
<p class="place-value place-value-{{ ../name }}">{{nlToBr content}}</p>
<p class="place-value place-value-{{ ../name }}">{{nlToBr existingContent}}</p>
{{/is}}

{{#is type "text"}}
<p class="place-value place-value-{{ ../name }}">{{nlToBr content}}</p>
<p class="place-value place-value-{{ ../name }}">{{nlToBr existingContent}}</p>
{{/is}}

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

{{#is type "richTextarea"}}
<span class="place-value place-value-{{ ../name }}">{{{content}}}</span>
<span class="place-value place-value-{{ ../name }}">{{{existingContent}}}</span>
{{/is}}

{{#is type "radio_big_buttons"}}
<ul>
{{#each content}}
{{#each existingContent}}
{{#if selected}}
<li class="multi-select-response">{{ label }} </li>
{{/if}}
Expand All @@ -28,7 +28,7 @@

{{#is type "checkbox_big_buttons"}}
<ul>
{{#each content}}
{{#each existingContent}}
{{#if selected}}
<li class="multi-select-response">{{ label }} </li>
{{/if}}
Expand All @@ -38,16 +38,16 @@

{{#is type "binary_toggle"}}
<p>
{{#if content.selected}}
{{ content.selectedLabel }}
{{#if existingContent.selected}}
{{ existingContent.selectedLabel }}
{{else}}
{{ content.unselectedLabel }}
{{ existingContent.unselectedLabel }}
{{/if}}
</p>
{{/is}}

{{#is type "dropdown"}}
{{#each content}}
{{#each existingContent}}
<p>
{{#if selected}}
{{nlToBr label}}
Expand Down
16 changes: 8 additions & 8 deletions src/base/jstemplates/place-form-field-types.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
type="text"
id="geocode-address-field"
class="geocode-address-field"
value={{nlToBr content}}>
value={{nlToBr existingContent}}>
</div>
</div>
{{/is}}
Expand All @@ -23,7 +23,7 @@
type="text"
{{#if autocomplete}}class="is-autocomplete"{{/if}}
{{^optional}}required{{/optional}}
value={{nlToBr content}}>
value={{nlToBr existingContent}}>
{{/is}}

{{#is type "text"}}
Expand All @@ -47,12 +47,12 @@
{{/is}}

{{#is type "richTextarea"}}
<textarea id="place-{{ name }}"
class="rich-text-field{{#if autocomplete}} is-autocomplete{{/if}}"
name="{{ name }}"
{{#attrs}} {{ key }}="{{ value }}"{{/attrs}}
{{#unless autcomplete}} placeholder="{{ placeholder }}"{{/unless}}
{{^optional}}required{{/optional}}>{{existingContent}}</textarea>
<div id="place-{{ name }}"
class="rich-text-field{{#if autocomplete}} is-autocomplete{{/if}}"
name="{{ name }}"
{{#attrs}} {{ key }}="{{ value }}"{{/attrs}}
{{#unless autcomplete}} placeholder="{{ placeholder }}"{{/unless}}
{{^optional}}required{{/optional}}>{{{existingContent}}}</div>
{{/is}}

{{#is type "radio_big_buttons"}}
Expand Down
7 changes: 4 additions & 3 deletions src/base/static/js/views/place-detail-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,19 @@
var newItem = {
name: item.name,
type: item.type,
content: content,
existingContent: content,
prompt: item.display_prompt
};

if (_.contains(exclusions, item.name) === false &&
item.name.indexOf('private-') !== 0 &&
newItem.content !== undefined &&
newItem.existingContent !== undefined &&
wasAnswered === true &&
item.form_only !== true) {

this.fields.push(newItem);
}

}, this);
},

Expand Down Expand Up @@ -259,7 +260,7 @@
new RichTextEditorView({
target: $(this).get(0),
placeDetailView: self,
fieldName: $(this).find(".place-value").attr("name")
fieldName: $(this).attr("name")
});
});
}
Expand Down

0 comments on commit be9d1b3

Please sign in to comment.