-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo-app.html
80 lines (79 loc) · 2.05 KB
/
todo-app.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!doctype html>
<html>
<head>
<link rel="import" href="elements.html">
</head>
<dom-module is="todo-app">
<style></style>
<template>
<paper-drawer-panel>
<paper-header-panel class="side-panel" drawer>
<paper-toolbar>
<div><span>Tarefas Completadas</span></div>
</paper-toolbar>
<paper-menu id="completed" class="list">
<template is="dom-if" if={{!done.length}}>
</template>
<template id="done" is="dom-repeat" items={{done}}>
</template>
</paper-menu>
</paper-header-panel>
<paper-header-panel main class="main-panel">
<paper-toolbar>
<paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
<div><span>Tarefas Ativas</span></div>
</paper-toolbar>
<div style="padding-left: 5px">
<!--Let's create a new task-->
<paper-material id="newTask" elevation="1">
<paper-input id="myTask" label="Tarefa">
</paper-input>
<paper-input id="myUser" label="Usuário">
</paper-input>
<paper-fab icon="icons:add" on-tap="postTask">
</paper-fab>
</paper-material>
<div id="todos">
<template is="dom-if" if={{todo.length}}>
<paper-material class="taskEmpty">
<paper-item>Sem tarefas!</paper-item>
</paper-material>
</template>
</div>
</div>
</paper-header-panel>
</paper-drawer-panel>
</template>
<script>
Polymer({
is: "todo-app",
properties: {
todo: {
type: Array,
value: [{user: "Bruno", task: "Make a Polymer app!"},
{user: "Bruno", task: "Make a AngularJS app!"}]
},
done:{
type: Array,
value: []
},
messages:{
type: Array,
value: []
}
},
postTask: function(e){
var task = this.$.myTask.value;
var user = this.$.myUser.value;
if (task == ""){
alert("Campo de tarefa vazio!");
return;
}
this.$.pub.message = {type:"todo", task:task, user:user};
this.$.pub.publish();
this.$.myTask.value = "";
},
})
</script>
</dom-module>
</html>