| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library survey.web.question; | 5 library survey.web.question; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 10 import 'package:survey/models.dart'; | 10 import 'package:survey/models.dart'; |
| 11 | 11 |
| 12 /* | 12 /* |
| 13 * The QuestionElement view. Use this to set the question text, optionally | 13 * The QuestionElement view. Use this to set the question text, optionally |
| 14 * provide answer options to the user, and pick the widget that the user sees. | 14 * provide answer options to the user, and pick the widget that the user sees. |
| 15 */ | 15 */ |
| 16 @CustomTag('question-element') | 16 @CustomTag('question-element') |
| 17 class QuestionElement extends PolymerElement with ObservableMixin { | 17 class QuestionElement extends PolymerElement with Observable { |
| 18 static const String TEXTFIELD_OPT = 'Use a text field'; | 18 static const String TEXTFIELD_OPT = 'Use a text field'; |
| 19 static const String ONE_FROM_MANY_OPT = 'Select one from many options'; | 19 static const String ONE_FROM_MANY_OPT = 'Select one from many options'; |
| 20 static const String MANY_FROM_MANY_OPT = 'Select many from many options'; | 20 static const String MANY_FROM_MANY_OPT = 'Select many from many options'; |
| 21 | 21 |
| 22 static const OPTIONS_MISSING_MESSAGE = "You didn't add any options"; | 22 static const OPTIONS_MISSING_MESSAGE = "You didn't add any options"; |
| 23 static const QUESTION_MISSING_MESSAGE = 'You forgot to add the question text'; | 23 static const QUESTION_MISSING_MESSAGE = 'You forgot to add the question text'; |
| 24 static const DELETE_CONFIRM_MESSAGE = 'Are you sure you want to delete ' | 24 static const DELETE_CONFIRM_MESSAGE = 'Are you sure you want to delete ' |
| 25 'this question?'; | 25 'this question?'; |
| 26 | 26 |
| 27 // The getters are needed because static consts cannot be used in templates. | 27 // The getters are needed because static consts cannot be used in templates. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 setSelectionAnswers(Event e, var detail, Element sender) { | 113 setSelectionAnswers(Event e, var detail, Element sender) { |
| 114 e.preventDefault(); | 114 e.preventDefault(); |
| 115 question.answers = detail; | 115 question.answers = detail; |
| 116 } | 116 } |
| 117 | 117 |
| 118 setTextAnswer(Event e, var detail, var sender) { | 118 setTextAnswer(Event e, var detail, var sender) { |
| 119 e.preventDefault(); | 119 e.preventDefault(); |
| 120 question.answers = [sender.value.trim()]; | 120 question.answers = [sender.value.trim()]; |
| 121 } | 121 } |
| 122 } | 122 } |
| OLD | NEW |