From f18ceff2caebffb1952af8a534fd5e82cbeba1f1 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 5 Mar 2016 07:05:16 -0800 Subject: [PATCH] Get full_name and link to it --- stages/3/src/ElmHub.elm | 9 +++++++-- stages/3/test/Tests.elm | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/stages/3/src/ElmHub.elm b/stages/3/src/ElmHub.elm index 3976f04..3e98377 100644 --- a/stages/3/src/ElmHub.elm +++ b/stages/3/src/ElmHub.elm @@ -58,7 +58,7 @@ searchResultDecoder = Json.Decode.object3 SearchResult ("id" := Json.Decode.int) - ("name" := Json.Decode.string) + ("full_name" := Json.Decode.string) ("stargazers_count" := Json.Decode.int) @@ -116,7 +116,12 @@ viewSearchResult result = li [] [ span [ class "star-count" ] [ text (toString result.stars) ] - , a [ href "", class "result-name" ] [ text result.name ] + , a + [ href ("https://github.com/" ++ result.name) + , class "result-name" + , target "_blank" + ] + [ text result.name ] ] diff --git a/stages/3/test/Tests.elm b/stages/3/test/Tests.elm index 0e0d93d..7c06fe2 100644 --- a/stages/3/test/Tests.elm +++ b/stages/3/test/Tests.elm @@ -21,8 +21,8 @@ all = <| let response = """{ "items": [ - { "id": 5, "name": "foo", "stargazers_count": 42 }, - { "id": 3, "name": "bar", "stargazers_count": 77 } + { "id": 5, "full_name": "foo", "stargazers_count": 42 }, + { "id": 3, "full_name": "bar", "stargazers_count": 77 } ] }""" in assertEqual