Skip to content

Commit

Permalink
Added max length to single line questions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nivedita committed Sep 5, 2012
1 parent 1e1b41e commit fe5d0a7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class SurveyBuilder.Models.SingleLineQuestionModel extends Backbone.RelationalMo
content: 'Untitled question'
mandatory: false
image: null
max_length: null
}

has_errors: ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
4 changes: 4 additions & 0 deletions app/views/templates/questions/_single_line_question.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<label><%= t("activerecord.attributes.question.mandatory") %> </label>
<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/*" />
Expand Down
1 change: 0 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ en:
sign_in: "Sign In"
logout: "Log Out"


flash:
survey_created: "Survey created successfully"
survey_deleted: "Survey deleted"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit fe5d0a7

Please sign in to comment.