s/Hide/Delete/g
This commit is contained in:
@@ -90,7 +90,7 @@ viewSearchResult address result =
|
|||||||
]
|
]
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, 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" ]
|
[ class "hide-result" ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
@@ -103,6 +103,6 @@ type alias Action =
|
|||||||
|
|
||||||
update : Action -> Model -> Model
|
update : Action -> Model -> Model
|
||||||
update action 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.
|
-- build a new model without the given ID present anymore.
|
||||||
model
|
model
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ viewSearchResult address result =
|
|||||||
]
|
]
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, button
|
||||||
-- TODO add an onClick handler that sends a HideById action
|
-- TODO add an onClick handler that sends a DeleteById action
|
||||||
[ class "hide-result" ]
|
[ class "hide-result" ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
@@ -119,19 +119,11 @@ viewSearchResult address result =
|
|||||||
|
|
||||||
type Action
|
type Action
|
||||||
= SetQuery String
|
= SetQuery String
|
||||||
| HideById ResultId
|
| DeleteById ResultId
|
||||||
|
|
||||||
|
|
||||||
update : Action -> Model -> ( Model, Effects Action )
|
update : Action -> Model -> ( Model, Effects Action )
|
||||||
update action model =
|
update action model =
|
||||||
case action of
|
-- TODO write a case-expression that makes SetQuery set the query
|
||||||
SetQuery query ->
|
-- and DeleteById delete the appropriate result
|
||||||
( { model | query = query }, Effects.none )
|
( model, Effects.none )
|
||||||
|
|
||||||
HideById idToHide ->
|
|
||||||
let
|
|
||||||
-- TODO build a new model without the given ID present anymore.
|
|
||||||
newModel =
|
|
||||||
model
|
|
||||||
in
|
|
||||||
( newModel, Effects.none )
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ viewSearchResult address result =
|
|||||||
]
|
]
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, button
|
||||||
[ class "hide-result", onClick address (HideById result.id) ]
|
[ class "hide-result", onClick address (DeleteById result.id) ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ viewSearchResult address result =
|
|||||||
type Action
|
type Action
|
||||||
= Search
|
= Search
|
||||||
| SetQuery String
|
| SetQuery String
|
||||||
| HideById ResultId
|
| DeleteById ResultId
|
||||||
| SetResults (List SearchResult)
|
| SetResults (List SearchResult)
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ update action model =
|
|||||||
in
|
in
|
||||||
( newModel, Effects.none )
|
( newModel, Effects.none )
|
||||||
|
|
||||||
HideById idToHide ->
|
DeleteById idToHide ->
|
||||||
let
|
let
|
||||||
newResults =
|
newResults =
|
||||||
List.filter (\{ id } -> id /= idToHide) model.results
|
List.filter (\{ id } -> id /= idToHide) model.results
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ viewSearchResult address result =
|
|||||||
]
|
]
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, button
|
||||||
[ class "hide-result", onClick address (HideById result.id) ]
|
[ class "hide-result", onClick address (DeleteById result.id) ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ viewSearchResult address result =
|
|||||||
type Action
|
type Action
|
||||||
= Search
|
= Search
|
||||||
| SetQuery String
|
| SetQuery String
|
||||||
| HideById ResultId
|
| DeleteById ResultId
|
||||||
| SetResults (List SearchResult)
|
| SetResults (List SearchResult)
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ update action model =
|
|||||||
in
|
in
|
||||||
( newModel, Effects.none )
|
( newModel, Effects.none )
|
||||||
|
|
||||||
HideById idToHide ->
|
DeleteById idToHide ->
|
||||||
let
|
let
|
||||||
newResults =
|
newResults =
|
||||||
model.results
|
model.results
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ viewSearchResult address result =
|
|||||||
]
|
]
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, button
|
||||||
[ class "hide-result", onClick address (HideById result.id) ]
|
[ class "hide-result", onClick address (DeleteById result.id) ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ viewSearchResult address result =
|
|||||||
type Action
|
type Action
|
||||||
= Search
|
= Search
|
||||||
| SetQuery String
|
| SetQuery String
|
||||||
| HideById ResultId
|
| DeleteById ResultId
|
||||||
| SetResults (List SearchResult)
|
| SetResults (List SearchResult)
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ update action model =
|
|||||||
in
|
in
|
||||||
( newModel, Effects.none )
|
( newModel, Effects.none )
|
||||||
|
|
||||||
HideById idToHide ->
|
DeleteById idToHide ->
|
||||||
let
|
let
|
||||||
newResults =
|
newResults =
|
||||||
model.results
|
model.results
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ viewSearchResult address result =
|
|||||||
]
|
]
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, button
|
||||||
[ class "hide-result", onClick address (HideById result.id) ]
|
[ class "hide-result", onClick address (DeleteById result.id) ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ viewSearchResult address result =
|
|||||||
type Action
|
type Action
|
||||||
= Search
|
= Search
|
||||||
| SetQuery String
|
| SetQuery String
|
||||||
| HideById ResultId
|
| DeleteById ResultId
|
||||||
| SetResults (List SearchResult)
|
| SetResults (List SearchResult)
|
||||||
| DoNothing
|
| DoNothing
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ update searchAddress action model =
|
|||||||
in
|
in
|
||||||
( newModel, Effects.none )
|
( newModel, Effects.none )
|
||||||
|
|
||||||
HideById idToHide ->
|
DeleteById idToHide ->
|
||||||
let
|
let
|
||||||
newResults =
|
newResults =
|
||||||
model.results
|
model.results
|
||||||
|
|||||||
Reference in New Issue
Block a user