Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
38 changes: 3 additions & 35 deletions elm-todo/Todo.elm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type alias Model =
type alias Entry =
{ description : String
, completed : Bool
, editing : Bool
, id : Int
}

Expand All @@ -62,7 +61,6 @@ newEntry : String -> Int -> Entry
newEntry desc id =
{ description = desc
, completed = False
, editing = False
, id = id
}

Expand All @@ -76,8 +74,6 @@ to them.
-}
type Msg
= UpdateNewEntryField String
| EditingEntry Int Bool
| UpdateEntry Int String
| Add
| Delete Int
| DeleteAllCompleted
Expand All @@ -102,29 +98,6 @@ update msg model =
UpdateNewEntryField str ->
{ model | newEntryField = str }

EditingEntry id isEditing ->
let
updateEntry t =
if t.id == id then
{ t | editing = isEditing }
else
t

focus =
Dom.focus ("todo-" ++ toString id)
in
{ model | entries = List.map updateEntry model.entries }

UpdateEntry id task ->
let
updateEntry t =
if t.id == id then
{ t | description = task }
else
t
in
{ model | entries = List.map updateEntry model.entries }

Check id isCompleted ->
let
updateEntry t =
Expand Down Expand Up @@ -229,7 +202,7 @@ viewKeyedEntry todo =
viewEntry : Entry -> Html Msg
viewEntry todo =
li
[ classList [ ( "completed", todo.completed ), ( "editing", todo.editing ) ] ]
[ classList [ ( "completed", todo.completed ) ] ]
[ div
[ class "view" ]
[ input
Expand All @@ -239,8 +212,7 @@ viewEntry todo =
, onClick (Check todo.id (not todo.completed))
]
[]
, label
[ onDoubleClick (EditingEntry todo.id True) ]
, label []
[ text todo.description ]
, button
[ class "destroy"
Expand All @@ -253,9 +225,6 @@ viewEntry todo =
, value todo.description
, name "title"
, id ("todo-" ++ toString todo.id)
, onInput (UpdateEntry todo.id)
, onBlur (EditingEntry todo.id False)
, onEnter (EditingEntry todo.id False)
]
[]
]
Expand Down Expand Up @@ -313,8 +282,7 @@ viewControlsClear entriesCompleted =
infoFooter : Html msg
infoFooter =
footer [ class "info" ]
[ p [] [ text "Double-click to edit a todo" ]
, p []
[ p []
[ text "Written by "
, a [ href "https://github.com/evancz" ] [ text "Evan Czaplicki" ]
]
Expand Down
Binary file added ruby-todo/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions ruby-todo/.idea/.rakeTasks

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ruby-todo/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ruby-todo/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ruby-todo/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions ruby-todo/.idea/ruby-todo.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading