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 Yesod
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
import qualified Data.Text as T
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
|
||||||
|
@ -47,6 +48,9 @@ sideBarDisplay = do
|
||||||
let closable = alertClosable alert
|
let closable = alertClosable alert
|
||||||
let block = alertBlockDisplay alert
|
let block = alertBlockDisplay alert
|
||||||
let divclass = bootstrapclass $ alertClass alert
|
let divclass = bootstrapclass $ alertClass alert
|
||||||
|
let message = renderAlertMessage alert
|
||||||
|
let messagelines = T.lines message
|
||||||
|
let multiline = length messagelines > 1
|
||||||
$(widgetFile "sidebar/alert")
|
$(widgetFile "sidebar/alert")
|
||||||
|
|
||||||
{- Called by client to get a sidebar display.
|
{- Called by client to get a sidebar display.
|
||||||
|
|
|
@ -50,6 +50,9 @@ watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> WatchHooks -> IO ()
|
||||||
watchDir i dir ignored hooks
|
watchDir i dir ignored hooks
|
||||||
| ignored dir = noop
|
| ignored dir = noop
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
|
case errHook hooks of
|
||||||
|
Nothing -> noop
|
||||||
|
Just hook -> tooManyWatches hook dir
|
||||||
-- Use a lock to make sure events generated during initial
|
-- Use a lock to make sure events generated during initial
|
||||||
-- scan come before real inotify events.
|
-- scan come before real inotify events.
|
||||||
lock <- newLock
|
lock <- newLock
|
||||||
|
|
|
@ -14,7 +14,11 @@
|
||||||
$nothing
|
$nothing
|
||||||
$maybe i <- alertIcon alert
|
$maybe i <- alertIcon alert
|
||||||
^{htmlIcon i} #
|
^{htmlIcon i} #
|
||||||
#{renderAlertMessage alert}
|
$if multiline
|
||||||
|
$forall l <- messagelines
|
||||||
|
#{l}<br>
|
||||||
|
$else
|
||||||
|
#{message}
|
||||||
$maybe button <- alertButton alert
|
$maybe button <- alertButton alert
|
||||||
<br>
|
<br>
|
||||||
<a .btn .btn-primary href="@{ClickAlert aid}">
|
<a .btn .btn-primary href="@{ClickAlert aid}">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue