add icons
This commit is contained in:
parent
f0a88e1203
commit
e9d9d9d5ea
6 changed files with 14 additions and 16 deletions
|
@ -34,6 +34,7 @@ data Alert = Alert
|
||||||
, alertBlockDisplay :: Bool
|
, alertBlockDisplay :: Bool
|
||||||
, alertClosable :: Bool
|
, alertClosable :: Bool
|
||||||
, alertPriority :: AlertPriority
|
, alertPriority :: AlertPriority
|
||||||
|
, alertIcon :: Maybe String
|
||||||
}
|
}
|
||||||
|
|
||||||
type AlertPair = (AlertId, Alert)
|
type AlertPair = (AlertId, Alert)
|
||||||
|
@ -108,26 +109,15 @@ makeAlertFiller success alert
|
||||||
| otherwise = alert
|
| otherwise = alert
|
||||||
{ alertClass = if c == Activity then c' else c
|
{ alertClass = if c == Activity then c' else c
|
||||||
, alertPriority = Filler
|
, alertPriority = Filler
|
||||||
, alertHeader = finished <$> h
|
|
||||||
, alertMessage = massage m
|
|
||||||
, alertClosable = True
|
, alertClosable = True
|
||||||
|
, alertIcon = Just $ if success then "ok" else "exclamation-sign"
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
h = alertHeader alert
|
|
||||||
m = alertMessage alert
|
|
||||||
c = alertClass alert
|
c = alertClass alert
|
||||||
c'
|
c'
|
||||||
| success = Success
|
| success = Success
|
||||||
| otherwise = Error
|
| otherwise = Error
|
||||||
|
|
||||||
massage (WidgetAlert w) = WidgetAlert w -- renders old on its own
|
|
||||||
massage (StringAlert s) = StringAlert $
|
|
||||||
maybe (finished s) (const s) h
|
|
||||||
|
|
||||||
finished s
|
|
||||||
| success = s ++ ": Ok"
|
|
||||||
| otherwise = s ++ ": Failed"
|
|
||||||
|
|
||||||
isFiller :: Alert -> Bool
|
isFiller :: Alert -> Bool
|
||||||
isFiller alert = alertPriority alert == Filler
|
isFiller alert = alertPriority alert == Filler
|
||||||
|
|
||||||
|
@ -163,6 +153,7 @@ baseActivityAlert = Alert
|
||||||
, alertBlockDisplay = False
|
, alertBlockDisplay = False
|
||||||
, alertClosable = False
|
, alertClosable = False
|
||||||
, alertPriority = Medium
|
, alertPriority = Medium
|
||||||
|
, alertIcon = Just "refresh"
|
||||||
}
|
}
|
||||||
|
|
||||||
activityAlert :: Maybe String -> String -> Alert
|
activityAlert :: Maybe String -> String -> Alert
|
||||||
|
@ -220,4 +211,5 @@ sanityCheckFixAlert msg = Alert
|
||||||
, alertBlockDisplay = True
|
, alertBlockDisplay = True
|
||||||
, alertPriority = High
|
, alertPriority = High
|
||||||
, alertClosable = True
|
, alertClosable = True
|
||||||
|
, alertIcon = Just "exclamation-sign"
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,15 +49,16 @@ sideBarDisplay = do
|
||||||
(alertBlockDisplay alert)
|
(alertBlockDisplay alert)
|
||||||
(bootstrapclass $ alertClass alert)
|
(bootstrapclass $ alertClass alert)
|
||||||
(alertHeader alert)
|
(alertHeader alert)
|
||||||
|
(alertIcon alert)
|
||||||
$ case alertMessage alert of
|
$ case alertMessage alert of
|
||||||
StringAlert s -> [whamlet|#{s}|]
|
StringAlert s -> [whamlet|#{s}|]
|
||||||
WidgetAlert w -> w alert
|
WidgetAlert w -> w alert
|
||||||
|
|
||||||
rendermessage msg = addalert firstAlertId True False
|
rendermessage msg = addalert firstAlertId True False
|
||||||
"alert-info" Nothing [whamlet|#{msg}|]
|
"alert-info" Nothing (Just "exclamation-sign") [whamlet|#{msg}|]
|
||||||
|
|
||||||
addalert :: AlertId -> Bool -> Bool -> Text -> Maybe String -> Widget -> Widget
|
addalert :: AlertId -> Bool -> Bool -> Text -> Maybe String -> Maybe String -> Widget -> Widget
|
||||||
addalert i closable block divclass heading widget = do
|
addalert i closable block divclass heading icon widget = do
|
||||||
let alertid = show i
|
let alertid = show i
|
||||||
let closealert = CloseAlert i
|
let closealert = CloseAlert i
|
||||||
$(widgetFile "sidebar/alert")
|
$(widgetFile "sidebar/alert")
|
||||||
|
|
BIN
static/img/glyphicons-halflings-white.png
Normal file
BIN
static/img/glyphicons-halflings-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
static/img/glyphicons-halflings.png
Normal file
BIN
static/img/glyphicons-halflings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -10,7 +10,8 @@
|
||||||
<hr>
|
<hr>
|
||||||
git-annex is © 2010-2012 Joey Hess. It is free software, licensed #
|
git-annex is © 2010-2012 Joey Hess. It is free software, licensed #
|
||||||
under the terms of the GNU General Public License, version 3 or above. #
|
under the terms of the GNU General Public License, version 3 or above. #
|
||||||
Its development was made possible by #
|
<br>
|
||||||
|
<i class="icon-heart"></i> Its development was made possible by #
|
||||||
<a href="http://git-annex.branchable.com/design/assistant/thanks/">
|
<a href="http://git-annex.branchable.com/design/assistant/thanks/">
|
||||||
many excellent people
|
many excellent people
|
||||||
.
|
.
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<div .alert .fade .in .#{divclass} :block:.alert-block ##{alertid} :closable:onclick="(function( $ ) { $.get('@{closealert}') })( jQuery );">
|
<div .alert .fade .in .#{divclass} :block:.alert-block ##{alertid} :closable:onclick="(function( $ ) { $.get('@{closealert}') })( jQuery );">
|
||||||
$if closable
|
$if closable
|
||||||
<a .close data-dismiss="alert">×</a>
|
<a .close data-dismiss="alert">×</a>
|
||||||
|
$case icon
|
||||||
|
$of Nothing
|
||||||
|
$of Just name
|
||||||
|
<i class="icon-#{name}"></i> #
|
||||||
$maybe h <- heading
|
$maybe h <- heading
|
||||||
$if block
|
$if block
|
||||||
<h4 class="alert-heading">#{h}</h4>
|
<h4 class="alert-heading">#{h}</h4>
|
||||||
|
|
Loading…
Reference in a new issue