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'; |
(...skipping 27 matching lines...) Expand all Loading... |
38 MANY_FROM_MANY_OPT]; | 38 MANY_FROM_MANY_OPT]; |
39 @observable int widgetSelectedIndex = 0; | 39 @observable int widgetSelectedIndex = 0; |
40 @observable List<String> optionInputs = toObservable(['']); | 40 @observable List<String> optionInputs = toObservable(['']); |
41 | 41 |
42 @observable String get widgetSelection => widgetOptions[widgetSelectedIndex]; | 42 @observable String get widgetSelection => widgetOptions[widgetSelectedIndex]; |
43 | 43 |
44 @observable bool get usingTextWidget => widgetSelectedIndex == 0; | 44 @observable bool get usingTextWidget => widgetSelectedIndex == 0; |
45 | 45 |
46 QuestionElement() { | 46 QuestionElement() { |
47 new PathObserver(this, 'widgetSelectedIndex').changes.listen((_) { | 47 new PathObserver(this, 'widgetSelectedIndex').changes.listen((_) { |
48 notifyProperty(this, #widgetSelection); | 48 this.notifyPropertyChange(#widgetSelection, null, null); |
49 }); | 49 }); |
50 } | 50 } |
51 | 51 |
52 edit() { | 52 edit() { |
53 editing = true; | 53 editing = true; |
54 errorMessage = ''; | 54 errorMessage = ''; |
55 optionInputs.add(''); | 55 optionInputs.add(''); |
56 } | 56 } |
57 | 57 |
58 addEmptyInput(Event e, var detail, Element sender) { | 58 addEmptyInput(Event e, var detail, Element sender) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
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 |