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 tracker.web.task_form_element; | 5 library tracker.web.task_form_element; |
6 | 6 |
7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
8 import 'package:tracker/models.dart'; | 8 import 'package:tracker/models.dart'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:math'; | 10 import 'dart:math'; |
11 | 11 |
12 @CustomTag('task-form-element') | 12 @CustomTag('task-form-element') |
13 class TaskFormElement extends PolymerElement with ObservableMixin { | 13 class TaskFormElement extends PolymerElement with Observable { |
14 bool get applyAuthorStyles => true; | 14 bool get applyAuthorStyles => true; |
15 @observable Task task; | 15 @observable Task task; |
16 @observable String titleErrorMessage = ''; | 16 @observable String titleErrorMessage = ''; |
17 @observable int maxTitleLength = Task.MAX_TITLE_LENGTH; | 17 @observable int maxTitleLength = Task.MAX_TITLE_LENGTH; |
18 @observable String descriptionErrorMessage = ''; | 18 @observable String descriptionErrorMessage = ''; |
19 @observable int maxDescriptionLength = Task.MAX_DESCRIPTION_LENGTH; | 19 @observable int maxDescriptionLength = Task.MAX_DESCRIPTION_LENGTH; |
20 @observable final List<String> taskStatusOptions = toObservable([ | 20 @observable final List<String> taskStatusOptions = toObservable([ |
21 Task.CURRENT, Task.PENDING, Task.COMPLETED]); | 21 Task.CURRENT, Task.PENDING, Task.COMPLETED]); |
22 @observable int statusSelectedIndex = 1; | 22 @observable int statusSelectedIndex = 1; |
23 @observable String previousStatus = ''; | 23 @observable String previousStatus = ''; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 appModel.tasks.add(task); | 100 appModel.tasks.add(task); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 deleteTask() { | 104 deleteTask() { |
105 if (window.confirm('Are you sure you want to delete this?')) { | 105 if (window.confirm('Are you sure you want to delete this?')) { |
106 appModel.tasks.remove(task); | 106 appModel.tasks.remove(task); |
107 } | 107 } |
108 } | 108 } |
109 } | 109 } |
OLD | NEW |