Skip to content

Commit aa74c8a

Browse files
committed
Merge branch 'master' of https://github.com/KleeGroup/focus
2 parents 5e63b5f + 675db56 commit aa74c8a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

lib/core/cors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ module.exports = function createCORSRequest(method, url, options) {
3636
}
3737
xhr.setRequestHeader("Content-Type", "application/json");
3838
return xhr;
39-
}
39+
}

lib/helpers/view_helper.coffee

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ module.exports =(Handlebars) ->
209209
return "value='" + propValue + "'"
210210
if dataType is "number"
211211
return "value='" + numeral(propValue).value() + "'"
212+
if dataType is "textarea"
213+
return _.escape(propValue)
212214
else return "value='#{_.escape(propValue)}'"
213215
""
214216
#Get the value of the translated label.
@@ -256,24 +258,29 @@ module.exports =(Handlebars) ->
256258
#Deal with error
257259
errors = ()=>
258260
if error == "has-error" then "<span class='#{error} #{errorSize()} help-inline pull-left' style='color:#b94a48'> #{errorValue } </span>" else ""
261+
262+
openTag = ->
263+
if opt.rows? then "<textarea rows='#{opt.rows}' " else "<input"
264+
closeTag = ->
265+
if opt.rows? then ">#{propertyValue()}</textarea>" else "#{propertyValue()} />"
259266
#Build the html tag.
260267
# <div class="form-group">
261268
# <label for="exampleInputEmail">Email address</label>
262269
# <input type="text" class="form-control" id="exampleInputEmail" placeholder="Enter email">
263270
# </div>
264271
if minimalHtml
265-
html = " <input id='#{property}' #{dataFields(@)} #{decorator()} #{binder()} class=''"
266-
html += "data-name='#{property}' type='#{dataType}' #{inputAttributes} #{cidAttr} #{placeholder} #{propertyValue()} #{readonly} #{disabled}/>"
272+
html = "#{openTag()} id='#{property}' #{dataFields(@)} #{decorator()} #{binder()} class=''"
273+
html += "data-name='#{property}' type='#{dataType}' #{inputAttributes} #{cidAttr} #{placeholder} #{readonly} #{disabled} #{closeTag()}"
267274
else
268275
html = "
269276
<div class='form-group #{error} #{col}'>
270277
#{label()}
271278
<div class='#{inputSize()} #{containerCss}' #{containerAttribs}>
272279
<div class='#{if isAddOnInput then 'input-group' else ""}'>
273280
#{icon()}
274-
<input id='#{property}' #{decorator()} #{binder()} #{dataFields(@)} class='"
281+
#{openTag()} id='#{property}' #{decorator()} #{binder()} #{dataFields(@)} class='"
275282
if(dataType != "checkbox") then html +="form-control "
276-
html += "input-sm' data-name='#{property}' type='#{dataType}' #{inputAttributes} #{placeholder} #{propertyValue()} #{readonly} #{disabled}/>
283+
html += "input-sm' data-name='#{property}' type='#{dataType}' #{inputAttributes} #{placeholder} #{readonly} #{disabled} #{closeTag()}
277284
#{symbol()}"
278285
if(dataType !="checkbox") then html +=" #{isRequired()}" else html+=" "
279286

0 commit comments

Comments
 (0)