1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

ui: Fix external links

This commit is contained in:
James Hillyerd
2018-11-18 11:36:49 -08:00
parent eaf41949d4
commit 74e7fd1179
2 changed files with 11 additions and 4 deletions

View File

@@ -127,8 +127,8 @@ update msg model =
Browser.Internal url -> Browser.Internal url ->
( model, Nav.pushUrl model.session.key (Url.toString url), Session.none ) ( model, Nav.pushUrl model.session.key (Url.toString url), Session.none )
_ -> Browser.External url ->
Debug.todo "implement external links" ( model, Nav.load url, Session.none )
UrlChanged url -> UrlChanged url ->
-- Responds to new browser URL. -- Responds to new browser URL.

View File

@@ -10,7 +10,9 @@ import Html.Attributes
, href , href
, id , id
, placeholder , placeholder
, rel
, selected , selected
, target
, type_ , type_
, value , value
) )
@@ -62,15 +64,20 @@ frame controls session page content =
, content , content
, footer [] , footer []
[ div [ id "footer" ] [ div [ id "footer" ]
[ a [ href "https://www.inbucket.org" ] [ text "Inbucket" ] [ externalLink "https://www.inbucket.org" "Inbucket"
, text " is an open source projected hosted at " , text " is an open source projected hosted at "
, a [ href "https://github.com/jhillyerd/inbucket" ] [ text "GitHub" ] , externalLink "https://github.com/jhillyerd/inbucket" "GitHub"
, text "." , text "."
] ]
] ]
] ]
externalLink : String -> String -> Html a
externalLink url title =
a [ href url, target "_blank", rel "noopener" ] [ text title ]
navbarLink : Session -> ActivePage -> Route -> List (Html a) -> Html a navbarLink : Session -> ActivePage -> Route -> List (Html a) -> Html a
navbarLink session page route linkContent = navbarLink session page route linkContent =
li [ classList [ ( "navbar-active", isActive page route ) ] ] li [ classList [ ( "navbar-active", isActive page route ) ] ]