diff --git a/ui/src/Main.elm b/ui/src/Main.elm index bba9c70..c45cd79 100644 --- a/ui/src/Main.elm +++ b/ui/src/Main.elm @@ -127,8 +127,8 @@ update msg model = Browser.Internal url -> ( model, Nav.pushUrl model.session.key (Url.toString url), Session.none ) - _ -> - Debug.todo "implement external links" + Browser.External url -> + ( model, Nav.load url, Session.none ) UrlChanged url -> -- Responds to new browser URL. diff --git a/ui/src/Views/Page.elm b/ui/src/Views/Page.elm index aaa3853..8ebc33d 100644 --- a/ui/src/Views/Page.elm +++ b/ui/src/Views/Page.elm @@ -10,7 +10,9 @@ import Html.Attributes , href , id , placeholder + , rel , selected + , target , type_ , value ) @@ -62,15 +64,20 @@ frame controls session page content = , content , 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 " - , a [ href "https://github.com/jhillyerd/inbucket" ] [ text "GitHub" ] + , externalLink "https://github.com/jhillyerd/inbucket" "GitHub" , 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 page route linkContent = li [ classList [ ( "navbar-active", isActive page route ) ] ]