-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (78 loc) · 3.12 KB
/
index.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
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Todo List</title>
<link rel="stylesheet" href="node_modules/todomvc-common/base.css" />
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css" />
<link rel="stylesheet" href="css/app.css" />
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
</head>
<body x-data="todos()">
<section class="todoapp">
<header class="header">
<h1>Todo List</h1>
<input x-model="newTodo" @keyup.enter="addTodo()" class="new-todo" placeholder="What needs to be done?"
autofocus />
</header>
<section class="main" x-show="todos.length">
<input x-model="allCompleted" @click="toggleAllCompletion()" id="toggle-all" class="toggle-all"
type="checkbox" />
<label for="toggle-all" style="cursor: pointer"
:title="allCompleted ? 'Uncomplete All Tasks' : 'Complete All Tasks'">Mark all as complete</label>
<ul class="todo-list">
<template x-for="todo in filteredTodos" :key="todo.id">
<li :class="{
editing: todo === editedTodo,
completed : todo.completed
}">
<div class="view">
<input x-model="todo.completed" @click="toggleCompletion(todo)" class="toggle"
type="checkbox" style="cursor: pointer" />
<label x-text="todo.title" @dblclick="editTodo(todo)"></label>
<button @click="deleteTodo(todo)" class="destroy" style="cursor: pointer"></button>
</div>
<input x-model="todo.title" @keyup.enter="editComplete(todo)" @click.away="editComplete(todo)"
@keyup.escape="cancelEdit(todo)" class="edit" />
</li>
</template>
</ul>
</section>
<!-- This footer should hidden by default and shown when there are todos -->
<footer class="footer" x-show="todos.length">
<!-- This should be `0 items left` by default -->
<span class="todo-count"><strong x-text="activeTodos.length"></strong>
<span x-text="activeTodos.length === 1 ? 'item' : 'items' "></span>
left</span>
<!-- Remove this if you don't implement routing -->
<ul class="filters">
<li>
<a @click.prevent="filter = 'all'" :class="{ selected : filter === 'all' }" href="#/">All</a>
</li>
<li>
<a @click.prevent="filter = 'active'" :class="{ selected : filter === 'active' }"
href="#/active">Active</a>
</li>
<li>
<a @click.prevent="filter = 'completed'" :class="{ selected : filter === 'completed' }"
href="#/completed">Completed</a>
</li>
</ul>
<!-- Hidden if no completed items are left ↓ -->
<button class="clear-completed" x-show="completedTodos.length" @click="clearCompletedTodos()">
Clear completed
</button>
</footer>
</section>
<footer class="info">
<p>Double-click to edit a todo</p>
<p>Created by <a href="http://todomvc.com">Abdallah Abu Amra</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<!-- Scripts here. Don't remove ↓ -->
<script src="node_modules/todomvc-common/base.js"></script>
<script src="js/app.js"></script>
<script src="js/todos.js"></script>
</body>
</html>