From 7dfb02e85bb484f030a974442303efa7282d05d7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 25 Mar 2016 22:49:12 -0700 Subject: [PATCH] s/Hide/Delete/g --- stages/2/Main.elm | 4 ++-- stages/3/Main.elm | 18 +++++------------- stages/4/Main.elm | 6 +++--- stages/5/ElmHub.elm | 6 +++--- stages/6/ElmHub.elm | 6 +++--- stages/7/ElmHub.elm | 6 +++--- 6 files changed, 19 insertions(+), 27 deletions(-) diff --git a/stages/2/Main.elm b/stages/2/Main.elm index cca13aa..1f50adf 100644 --- a/stages/2/Main.elm +++ b/stages/2/Main.elm @@ -90,7 +90,7 @@ viewSearchResult address result = ] [ text result.name ] , button - -- TODO add an onClick handler that sends a HIDE_BY_ID action + -- TODO add an onClick handler that sends a DELETE_BY_ID action [ class "hide-result" ] [ text "X" ] ] @@ -103,6 +103,6 @@ type alias Action = update : Action -> Model -> Model update action model = - -- TODO if we receive a HIDE_BY_ID action, + -- TODO if we receive a DELETE_BY_ID action, -- build a new model without the given ID present anymore. model diff --git a/stages/3/Main.elm b/stages/3/Main.elm index 505f2d8..a70be41 100644 --- a/stages/3/Main.elm +++ b/stages/3/Main.elm @@ -111,7 +111,7 @@ viewSearchResult address result = ] [ text result.name ] , button - -- TODO add an onClick handler that sends a HideById action + -- TODO add an onClick handler that sends a DeleteById action [ class "hide-result" ] [ text "X" ] ] @@ -119,19 +119,11 @@ viewSearchResult address result = type Action = SetQuery String - | HideById ResultId + | DeleteById ResultId update : Action -> Model -> ( Model, Effects Action ) update action model = - case action of - SetQuery query -> - ( { model | query = query }, Effects.none ) - - HideById idToHide -> - let - -- TODO build a new model without the given ID present anymore. - newModel = - model - in - ( newModel, Effects.none ) + -- TODO write a case-expression that makes SetQuery set the query + -- and DeleteById delete the appropriate result + ( model, Effects.none ) diff --git a/stages/4/Main.elm b/stages/4/Main.elm index f369b56..f7355a6 100644 --- a/stages/4/Main.elm +++ b/stages/4/Main.elm @@ -123,7 +123,7 @@ viewSearchResult address result = ] [ text result.name ] , button - [ class "hide-result", onClick address (HideById result.id) ] + [ class "hide-result", onClick address (DeleteById result.id) ] [ text "X" ] ] @@ -131,7 +131,7 @@ viewSearchResult address result = type Action = Search | SetQuery String - | HideById ResultId + | DeleteById ResultId | SetResults (List SearchResult) @@ -151,7 +151,7 @@ update action model = in ( newModel, Effects.none ) - HideById idToHide -> + DeleteById idToHide -> let newResults = List.filter (\{ id } -> id /= idToHide) model.results diff --git a/stages/5/ElmHub.elm b/stages/5/ElmHub.elm index 62a1d3f..d94fbca 100644 --- a/stages/5/ElmHub.elm +++ b/stages/5/ElmHub.elm @@ -101,7 +101,7 @@ viewSearchResult address result = ] [ text result.name ] , button - [ class "hide-result", onClick address (HideById result.id) ] + [ class "hide-result", onClick address (DeleteById result.id) ] [ text "X" ] ] @@ -109,7 +109,7 @@ viewSearchResult address result = type Action = Search | SetQuery String - | HideById ResultId + | DeleteById ResultId | SetResults (List SearchResult) @@ -129,7 +129,7 @@ update action model = in ( newModel, Effects.none ) - HideById idToHide -> + DeleteById idToHide -> let newResults = model.results diff --git a/stages/6/ElmHub.elm b/stages/6/ElmHub.elm index 62a1d3f..d94fbca 100644 --- a/stages/6/ElmHub.elm +++ b/stages/6/ElmHub.elm @@ -101,7 +101,7 @@ viewSearchResult address result = ] [ text result.name ] , button - [ class "hide-result", onClick address (HideById result.id) ] + [ class "hide-result", onClick address (DeleteById result.id) ] [ text "X" ] ] @@ -109,7 +109,7 @@ viewSearchResult address result = type Action = Search | SetQuery String - | HideById ResultId + | DeleteById ResultId | SetResults (List SearchResult) @@ -129,7 +129,7 @@ update action model = in ( newModel, Effects.none ) - HideById idToHide -> + DeleteById idToHide -> let newResults = model.results diff --git a/stages/7/ElmHub.elm b/stages/7/ElmHub.elm index 297d1f7..0fac7cd 100644 --- a/stages/7/ElmHub.elm +++ b/stages/7/ElmHub.elm @@ -103,7 +103,7 @@ viewSearchResult address result = ] [ text result.name ] , button - [ class "hide-result", onClick address (HideById result.id) ] + [ class "hide-result", onClick address (DeleteById result.id) ] [ text "X" ] ] @@ -111,7 +111,7 @@ viewSearchResult address result = type Action = Search | SetQuery String - | HideById ResultId + | DeleteById ResultId | SetResults (List SearchResult) | DoNothing @@ -132,7 +132,7 @@ update searchAddress action model = in ( newModel, Effects.none ) - HideById idToHide -> + DeleteById idToHide -> let newResults = model.results