add tooltips

This commit is contained in:
Joey Hess 2012-09-27 12:55:00 -04:00
parent fe3009d83b
commit 8bc70a85c6
4 changed files with 9 additions and 9 deletions

View file

@ -114,13 +114,13 @@ webAppFormAuthToken = do
webapp <- lift getYesod
[whamlet|<input type="hidden" name="auth" value="#{secretToken webapp}">|]
{- A button with an icon, and maybe label, that can be clicked to perform
- some action.
{- A button with an icon, and maybe label or tooltip, that can be
- clicked to perform some action.
- With javascript, clicking it POSTs the Route, and remains on the same
- page.
- With noscript, clicking it GETs the Route. -}
actionButton :: Route WebApp -> (Maybe String) -> String -> String -> Widget
actionButton route label buttonclass iconclass = $(widgetFile "actionbutton")
actionButton :: Route WebApp -> (Maybe String) -> (Maybe String) -> String -> String -> Widget
actionButton route label tooltip buttonclass iconclass = $(widgetFile "actionbutton")
type UrlRenderFunc = Route WebApp -> [(Text, Text)] -> Text
type UrlRenderer = MVar (UrlRenderFunc)

View file

@ -1,2 +1,2 @@
<a class="#{buttonclass}" href="@{route}" onclick="(function( $ ) { $.post('@{route}'); })( jQuery ); return false;">
<a title="#{fromMaybe "" tooltip}" class="#{buttonclass}" href="@{route}" onclick="(function( $ ) { $.post('@{route}'); })( jQuery ); return false;">
<i class="#{iconclass}"></i> #{fromMaybe "" label}

View file

@ -31,7 +31,7 @@
<div .bar style="width: #{percent};">
<div .btn-group .span2>
$if isrunning info
^{actionButton (PauseTransferR transfer) Nothing "btn" "icon-pause"}
^{actionButton (PauseTransferR transfer) Nothing (Just "pause") "btn" "icon-pause"}
$else
^{actionButton (StartTransferR transfer) Nothing "btn" "icon-play"}
^{actionButton (CancelTransferR transfer) Nothing "btn" "icon-remove"}
^{actionButton (StartTransferR transfer) Nothing (Just "continue") "btn" "icon-play"}
^{actionButton (CancelTransferR transfer) Nothing (Just "cancel") "btn" "icon-remove"}

View file

@ -11,7 +11,7 @@
$maybe reldir <- relDir webapp
<ul .nav .pull-right>
<li>
^{actionButton FileBrowserR (Just "Files") "" "icon-folder-open icon-white"}
^{actionButton FileBrowserR (Just "Files") (Just "Click to open a file browser") "" "icon-folder-open icon-white"}
<li .dropdown #menu1>
<a .dropdown-toggle data-toggle="dropdown" href="#menu1">
Current Repository: #{reldir}