improve display of multiline messages in alerts
This better handles error messages formatted for console display, by adding a <br> after each line. Hmm, I wonder if it'd be worth pulling in a markdown formatter, and running the messages through it?
This commit is contained in:
parent
e72f0b2898
commit
01bedb54c6
3 changed files with 12 additions and 1 deletions
|
@ -20,6 +20,7 @@ import Utility.Yesod
|
|||
|
||||
import Yesod
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Map as M
|
||||
import Control.Concurrent
|
||||
|
||||
|
@ -47,6 +48,9 @@ sideBarDisplay = do
|
|||
let closable = alertClosable alert
|
||||
let block = alertBlockDisplay alert
|
||||
let divclass = bootstrapclass $ alertClass alert
|
||||
let message = renderAlertMessage alert
|
||||
let messagelines = T.lines message
|
||||
let multiline = length messagelines > 1
|
||||
$(widgetFile "sidebar/alert")
|
||||
|
||||
{- Called by client to get a sidebar display.
|
||||
|
|
|
@ -50,6 +50,9 @@ watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> WatchHooks -> IO ()
|
|||
watchDir i dir ignored hooks
|
||||
| ignored dir = noop
|
||||
| otherwise = do
|
||||
case errHook hooks of
|
||||
Nothing -> noop
|
||||
Just hook -> tooManyWatches hook dir
|
||||
-- Use a lock to make sure events generated during initial
|
||||
-- scan come before real inotify events.
|
||||
lock <- newLock
|
||||
|
|
|
@ -14,7 +14,11 @@
|
|||
$nothing
|
||||
$maybe i <- alertIcon alert
|
||||
^{htmlIcon i} #
|
||||
#{renderAlertMessage alert}
|
||||
$if multiline
|
||||
$forall l <- messagelines
|
||||
#{l}<br>
|
||||
$else
|
||||
#{message}
|
||||
$maybe button <- alertButton alert
|
||||
<br>
|
||||
<a .btn .btn-primary href="@{ClickAlert aid}">
|
||||
|
|
Loading…
Reference in a new issue