Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
app-todo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Geovanny E. Vera Pazmino
app-todo
Commits
6a1a87a4
Commit
6a1a87a4
authored
Apr 07, 2020
by
Milan Iliev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored addButton into controller
parent
413e57b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
15 deletions
+6
-15
main.js
web/main.js
+1
-15
controller.js
web/tasks/controller.js
+5
-0
No files found.
web/main.js
View file @
6a1a87a4
import
Task
from
"./tasks/task.js"
import
TaskController
from
"./tasks/controller.js"
let
task_controller
=
new
TaskController
()
let
addButton
=
document
.
querySelector
(
'#add_button'
)
let
main
=
async
()
=>
{
addButton
.
addEventListener
(
"click"
,
()
=>
{
task_controller
.
addTask
(
new
Task
({
done
:
false
,
description
:
"New Task"
}))
})
task_controller
.
refresh
()
}
main
()
task_controller
.
refresh
()
\ No newline at end of file
web/tasks/controller.js
View file @
6a1a87a4
...
...
@@ -9,6 +9,11 @@ class TaskController {
this
.
list_element
=
document
.
querySelector
(
"task-list"
)
this
.
detail_view
=
new
DetailTaskView
(
document
.
querySelector
(
"task-detail"
))
this
.
addButton
=
document
.
querySelector
(
'#add_button'
)
this
.
addButton
.
addEventListener
(
"click"
,
()
=>
{
this
.
addTask
(
new
Task
({
done
:
false
,
description
:
"New Task"
}))
})
}
addTask
(
task
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment