Fix title of the app before it loads (#97)

and improve window title per page

fixes #93
This commit is contained in:
Rok Garbas 2020-06-12 12:20:28 +02:00 committed by GitHub
parent 9f3de349e8
commit 2daa4b0d8b
Failed to generate hash of commit
2 changed files with 47 additions and 30 deletions

View file

@ -252,39 +252,60 @@ update msg model =
-- VIEW -- VIEW
view : Model -> Html Msg view :
Model
->
{ title : String
, body : List (Html Msg)
}
view model = view model =
div [] let
[ header [] title =
[ div [ class "navbar navbar-static-top" ] case model.page of
[ div [ class "navbar-inner" ] Packages _ ->
[ div [ class "container" ] "NixOS Search - Packages"
[ a [ class "brand", href "https://nixos.org" ]
[ img [ src "https://nixos.org/logo/nix-wiki.png", class "logo" ] [] Options _ ->
] "NixOS Search - Options"
, div [ class "nav-collapse collapse" ]
[ ul [ class "nav pull-left" ] _ ->
(viewNavigation model.page model.url) "NixOS Search"
in
{ title = title
, body =
[ div []
[ header []
[ div [ class "navbar navbar-static-top" ]
[ div [ class "navbar-inner" ]
[ div [ class "container" ]
[ a [ class "brand", href "https://nixos.org" ]
[ img [ src "https://nixos.org/logo/nix-wiki.png", class "logo" ] []
]
, div [ class "nav-collapse collapse" ]
[ ul [ class "nav pull-left" ]
(viewNavigation model.page model.url)
]
] ]
] ]
] ]
] ]
] , div [ class "container main" ]
, div [ class "container main" ] [ div [ id "content" ] [ viewPage model ]
[ div [ id "content" ] [ viewPage model ] , footer
, footer [ class "container text-center" ]
[ class "container text-center" ] [ div []
[ div [] [ span [] [ text "Elasticsearch instance graciously provided by " ]
[ span [] [ text "Elasticsearch instance graciously provided by " ] , a [ href "https://bonsai.io" ] [ text "Bonsai" ]
, a [ href "https://bonsai.io" ] [ text "Bonsai" ] , span [] [ text "." ]
, span [] [ text "." ] ]
] , div []
, div [] [ span [] [ text " Thank you " ]
[ span [] [ text " Thank you " ] ]
] ]
] ]
] ]
] ]
}
viewNavigation : Page -> Url.Url -> List (Html Msg) viewNavigation : Page -> Url.Url -> List (Html Msg)
@ -367,9 +388,5 @@ main =
, onUrlChange = ChangedUrl , onUrlChange = ChangedUrl
, subscriptions = subscriptions , subscriptions = subscriptions
, update = update , update = update
, view = , view = view
\m ->
{ title = "NixOS Search"
, body = [ view m ]
}
} }

View file

@ -4,7 +4,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Elm hotloading dev environment</title> <title>NixOS Search - Loading...</title>
<script type="text/javascript" src="https://nixos.org/js/jquery.min.js"></script> <script type="text/javascript" src="https://nixos.org/js/jquery.min.js"></script>