Permalink
Browse files

Added max length to single line questions

  • Loading branch information...
1 parent 1e1b41e commit fe5d0a78a789fbf41d584314b9d9faafb1d96efc Nivedita committed Sep 5, 2012
@@ -7,6 +7,7 @@ class SurveyBuilder.Models.SingleLineQuestionModel extends Backbone.RelationalMo
content: 'Untitled question'
mandatory: false
image: null
+ max_length: null
}
has_errors: ->
@@ -5,6 +5,7 @@ class SurveyBuilder.Views.Questions.SingleLineQuestionView extends Backbone.View
events:
'keyup input[type=text]': 'handle_textbox_keyup'
+ 'change input[type=number]': 'handle_textbox_keyup'
'change input[type=checkbox]': 'handle_checkbox_change'
initialize: (model) ->
@@ -5,6 +5,10 @@
<input type="checkbox" name="mandatory" value="{{mandatory}}"></input>
</div>
<div>
+ <label><%= t("activerecord.attributes.question.max_length") %> </label>
+ <input type="number" name="max_length" value="{{max_length}}"></input>
+</div>
+<div>
<label><%= t("activerecord.attributes.question.image") %> </label>
<input type="file" name="image" accept="image/*" />
</div>
@@ -7,7 +7,6 @@ en:
sign_in: "Sign In"
logout: "Log Out"
-
flash:
survey_created: "Survey created successfully"
survey_deleted: "Survey deleted"
@@ -20,6 +20,10 @@ describe "SurveyBuilder.Models.SingleLineQuestionModel", ->
model = new SurveyBuilder.Models.SingleLineQuestionModel
expect(model.get('image')).toBeNull
+ it "sets max_length to Untitled question", ->
+ model = new SurveyBuilder.Models.SingleLineQuestionModel
+ expect(model.get('max_length')).toBeNull
+
it "should make the correct server request", ->
model = new SurveyBuilder.Models.SingleLineQuestionModel
spy = sinon.spy(jQuery, "ajax")

0 comments on commit fe5d0a7

Please sign in to comment.