Skip to content

Commit

Permalink
Merge branch '0.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
process-bot committed Nov 19, 2015
2 parents 618c042 + 8d29ec0 commit 0d0a136
Show file tree
Hide file tree
Showing 3 changed files with 11,970 additions and 46 deletions.
37 changes: 20 additions & 17 deletions Todo.elm
Original file line number Diff line number Diff line change
Expand Up @@ -89,45 +89,45 @@ update action model =

Add ->
{ model |
uid <- model.uid + 1,
field <- "",
tasks <-
uid = model.uid + 1,
field = "",
tasks =
if String.isEmpty model.field
then model.tasks
else model.tasks ++ [newTask model.field model.uid]
}

UpdateField str ->
{ model | field <- str }
{ model | field = str }

EditingTask id isEditing ->
let updateTask t = if t.id == id then { t | editing <- isEditing } else t
let updateTask t = if t.id == id then { t | editing = isEditing } else t
in
{ model | tasks <- List.map updateTask model.tasks }
{ model | tasks = List.map updateTask model.tasks }

UpdateTask id task ->
let updateTask t = if t.id == id then { t | description <- task } else t
let updateTask t = if t.id == id then { t | description = task } else t
in
{ model | tasks <- List.map updateTask model.tasks }
{ model | tasks = List.map updateTask model.tasks }

Delete id ->
{ model | tasks <- List.filter (\t -> t.id /= id) model.tasks }
{ model | tasks = List.filter (\t -> t.id /= id) model.tasks }

DeleteComplete ->
{ model | tasks <- List.filter (not << .completed) model.tasks }
{ model | tasks = List.filter (not << .completed) model.tasks }

Check id isCompleted ->
let updateTask t = if t.id == id then { t | completed <- isCompleted } else t
let updateTask t = if t.id == id then { t | completed = isCompleted } else t
in
{ model | tasks <- List.map updateTask model.tasks }
{ model | tasks = List.map updateTask model.tasks }

CheckAll isCompleted ->
let updateTask t = { t | completed <- isCompleted }
let updateTask t = { t | completed = isCompleted }
in
{ model | tasks <- List.map updateTask model.tasks }
{ model | tasks = List.map updateTask model.tasks }

ChangeVisibility visibility ->
{ model | visibility <- visibility }
{ model | visibility = visibility }


---- VIEW ----
Expand Down Expand Up @@ -184,7 +184,7 @@ taskList address visibility tasks =
case visibility of
"Completed" -> todo.completed
"Active" -> not todo.completed
"All" -> True
_ -> True

allCompleted = List.all .completed tasks

Expand Down Expand Up @@ -333,7 +333,10 @@ port focus =
EditingTask id bool -> bool
_ -> False

toSelector (EditingTask id _) = ("#todo-" ++ toString id)
toSelector act =
case act of
EditingTask id _ -> "#todo-" ++ toString id
_ -> ""
in
actions.signal
|> Signal.filter needsFocus (EditingTask 0 True)
Expand Down
8 changes: 4 additions & 4 deletions elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "2.0.0 <= v < 3.0.0",
"evancz/elm-html": "3.0.0 <= v < 4.0.0"
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-html": "4.0.2 <= v < 5.0.0"
},
"elm-version": "0.15.0 <= v < 0.16.0"
}
"elm-version": "0.16.0 <= v < 0.17.0"
}
Loading

1 comment on commit 0d0a136

@fredcy
Copy link
Contributor

@fredcy fredcy commented on 0d0a136 Nov 25, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evancz This commit overwrote the custom index.html with the one generated by elm-make. Is that OK? I think it loses the code that handled the JS side of the ports for focus control and loading/saving values.

Please sign in to comment.