Shift all the parts up a number.
This commit is contained in:
@@ -3,6 +3,7 @@ module ElmHub (..) where
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (..)
|
||||
import Html.Lazy exposing (..)
|
||||
import Http
|
||||
import Auth
|
||||
import Task exposing (Task)
|
||||
@@ -34,7 +35,8 @@ searchFeed query =
|
||||
|
||||
responseDecoder : Decoder (List SearchResult.Model)
|
||||
responseDecoder =
|
||||
"items" := Json.Decode.list SearchResult.decoder
|
||||
-- TODO make use of SearchResult's decoder
|
||||
Json.Decode.succeed []
|
||||
|
||||
|
||||
type alias Model =
|
||||
@@ -72,15 +74,7 @@ viewSearchResults address results =
|
||||
results
|
||||
|> Dict.values
|
||||
|> List.sortBy (.stars >> negate)
|
||||
|> filterResults
|
||||
|> List.map (SearchResult.view address DeleteById)
|
||||
|
||||
|
||||
filterResults : List SearchResult.Model -> List SearchResult.Model
|
||||
filterResults results =
|
||||
-- TODO filter out repos with 0 stars
|
||||
-- using a case-expression rather than List.filter
|
||||
results
|
||||
|> List.map (\_ -> div [] [ text "TODO replace this line with view logic from SearchResult" ])
|
||||
|
||||
|
||||
onInput address wrap =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Part 10
|
||||
=======
|
||||
Part 9
|
||||
======
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -28,23 +28,18 @@ decoder =
|
||||
("stargazers_count" := Json.Decode.int)
|
||||
|
||||
|
||||
view : Address a -> (Int -> a) -> Model -> Html
|
||||
view address delete result =
|
||||
view : Address a -> Model -> Html
|
||||
view address result =
|
||||
li
|
||||
[]
|
||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
||||
, a
|
||||
[ href
|
||||
("https://github.com/"
|
||||
++ (Debug.log
|
||||
"TODO we should not see this when typing in the search box!"
|
||||
result.name
|
||||
)
|
||||
)
|
||||
[ href ("https://github.com/" ++ result.name)
|
||||
, target "_blank"
|
||||
]
|
||||
[ text result.name ]
|
||||
, button
|
||||
[ class "hide-result", onClick address (delete result.id) ]
|
||||
-- TODO onClick, send a delete action to the address
|
||||
[ class "hide-result" ]
|
||||
[ text "X" ]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user