Pointing to correct branch for different channels (#113)
This commit is contained in:
parent
46c7eaa46b
commit
5a5395a19b
|
@ -141,7 +141,7 @@ viewSuccess channel show result =
|
||||||
, tbody
|
, tbody
|
||||||
[]
|
[]
|
||||||
(List.concatMap
|
(List.concatMap
|
||||||
(viewResultItem show)
|
(viewResultItem channel show)
|
||||||
result.hits.hits
|
result.hits.hits
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -149,14 +149,15 @@ viewSuccess channel show result =
|
||||||
|
|
||||||
|
|
||||||
viewResultItem :
|
viewResultItem :
|
||||||
Maybe String
|
String
|
||||||
|
-> Maybe String
|
||||||
-> Search.ResultItem ResultItemSource
|
-> Search.ResultItem ResultItemSource
|
||||||
-> List (Html Msg)
|
-> List (Html Msg)
|
||||||
viewResultItem show item =
|
viewResultItem channel show item =
|
||||||
let
|
let
|
||||||
packageDetails =
|
packageDetails =
|
||||||
if Just item.source.name == show then
|
if Just item.source.name == show then
|
||||||
[ td [ colspan 1 ] [ viewResultItemDetails item ]
|
[ td [ colspan 1 ] [ viewResultItemDetails channel item ]
|
||||||
]
|
]
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -189,9 +190,10 @@ viewResultItem show item =
|
||||||
|
|
||||||
|
|
||||||
viewResultItemDetails :
|
viewResultItemDetails :
|
||||||
Search.ResultItem ResultItemSource
|
String
|
||||||
|
-> Search.ResultItem ResultItemSource
|
||||||
-> Html Msg
|
-> Html Msg
|
||||||
viewResultItemDetails item =
|
viewResultItemDetails channel item =
|
||||||
let
|
let
|
||||||
default =
|
default =
|
||||||
"Not given"
|
"Not given"
|
||||||
|
@ -211,15 +213,26 @@ viewResultItemDetails item =
|
||||||
asLink value =
|
asLink value =
|
||||||
a [ href value ] [ text value ]
|
a [ href value ] [ text value ]
|
||||||
|
|
||||||
-- TODO: this should take channel into account as well
|
githubUrlPrefix branch =
|
||||||
githubUrlPrefix =
|
"https://github.com/NixOS/nixpkgs-channels/blob/" ++ branch ++ "/"
|
||||||
"https://github.com/NixOS/nixpkgs-channels/blob/nixos-unstable/"
|
|
||||||
|
cleanPosition value =
|
||||||
|
if String.startsWith "source/" value then
|
||||||
|
String.dropLeft 7 value
|
||||||
|
|
||||||
|
else
|
||||||
|
value
|
||||||
|
|
||||||
asGithubLink value =
|
asGithubLink value =
|
||||||
|
case Search.channelDetailsFromId channel of
|
||||||
|
Just channelDetails ->
|
||||||
a
|
a
|
||||||
[ href <| githubUrlPrefix ++ (value |> String.replace ":" "#L") ]
|
[ href <| githubUrlPrefix channelDetails.branch ++ (value |> String.replace ":" "#L") ]
|
||||||
[ text <| value ]
|
[ text <| value ]
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
text <| cleanPosition value
|
||||||
|
|
||||||
wrapped wrapWith value =
|
wrapped wrapWith value =
|
||||||
case value of
|
case value of
|
||||||
"" ->
|
"" ->
|
||||||
|
|
Loading…
Reference in a new issue