Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: samples/survey/web/elements/question/question_element.dart

Issue 27618002: package:observe fix various api issues (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 setSelectionAnswers(Event e, var detail, Element sender) { 117 setSelectionAnswers(Event e, var detail, Element sender) {
118 e.preventDefault(); 118 e.preventDefault();
119 question.answers = detail; 119 question.answers = detail;
120 } 120 }
121 121
122 setTextAnswer(Event e, var detail, var sender) { 122 setTextAnswer(Event e, var detail, var sender) {
123 e.preventDefault(); 123 e.preventDefault();
124 question.answers = [sender.value.trim()]; 124 question.answers = [sender.value.trim()];
125 } 125 }
126 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698