feat: optional ribbon

This commit is contained in:
Gregor Kleen 2019-08-27 09:34:04 +02:00
parent d3fdc40978
commit c2e13cf4df
6 changed files with 35 additions and 0 deletions

View File

@ -122,3 +122,4 @@ user-defaults:
warning-days: 1209600 warning-days: 1209600
instance-id: "_env:INSTANCE_ID:instance" instance-id: "_env:INSTANCE_ID:instance"
ribbon: "_env:RIBBON:"

View File

@ -1664,6 +1664,8 @@ siteLayout' headingOverride widget = do
hasPageActions = hasPrimaryPageActions || hasSecondaryPageActions hasPageActions = hasPrimaryPageActions || hasSecondaryPageActions
hasSecondaryPageActions = any (is _PageActionSecondary) $ toListOf (traverse . _1 . _menuItemType) menuTypes hasSecondaryPageActions = any (is _PageActionSecondary) $ toListOf (traverse . _1 . _menuItemType) menuTypes
hasPrimaryPageActions = any (is _PageActionPrime) $ toListOf (traverse . _1 . _menuItemType) menuTypes hasPrimaryPageActions = any (is _PageActionPrime) $ toListOf (traverse . _1 . _menuItemType) menuTypes
contentRibbon :: Maybe Widget
contentRibbon = fmap toWidget appRibbon
MsgRenderer mr <- getMsgRenderer MsgRenderer mr <- getMsgRenderer
let let

View File

@ -138,6 +138,7 @@ data AppSettings = AppSettings
, appAuthPWHash :: PWHashConf , appAuthPWHash :: PWHashConf
, appInitialInstanceID :: Maybe (Either FilePath UUID) , appInitialInstanceID :: Maybe (Either FilePath UUID)
, appRibbon :: Maybe Text
} deriving (Show) } deriving (Show)
data LogSettings = LogSettings data LogSettings = LogSettings
@ -419,6 +420,8 @@ instance FromJSON AppSettings where
_ -> return () _ -> return ()
return val' return val'
appRibbon <- assertM (not . Text.null) . fmap Text.strip <$> o.:? "ribbon"
return AppSettings {..} return AppSettings {..}
makeClassy_ ''AppSettings makeClassy_ ''AppSettings

View File

@ -10,6 +10,7 @@ export LOG_ALL=${LOG_ALL:-false}
export LOGLEVEL=${LOGLEVEL:-info} export LOGLEVEL=${LOGLEVEL:-info}
export DUMMY_LOGIN=${DUMMY_LOGIN:-true} export DUMMY_LOGIN=${DUMMY_LOGIN:-true}
export ALLOW_DEPRECATED=${ALLOW_DEPRECATED:-true} export ALLOW_DEPRECATED=${ALLOW_DEPRECATED:-true}
export RIBBON=${RIBBON:-Localhost}
move-back() { move-back() {
mv -v .stack-work .stack-work-run mv -v .stack-work .stack-work-run

View File

@ -5,6 +5,10 @@ $if not isModal
<!-- navigation --> <!-- navigation -->
^{navbar} ^{navbar}
$maybe ribbon <- contentRibbon
<div .ribbon>
^{ribbon}
<div .main> <div .main>
<div .main__content uw-poc> <div .main__content uw-poc>

View File

@ -694,3 +694,27 @@ section {
.form--inline { .form--inline {
display: inline-block; display: inline-block;
} }
.ribbon {
position: fixed;
top: calc(40px + var(--header-height));
right: -63px;
transform: rotate(45deg);
width: 250px;
background: var(--color-error);
text-align: center;
color: var(--color-lightwhite);
font-weight: 600;
font-size: 1.25rem;
line-height: 2em;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
z-index: 19;
pointer-events: none;
}
@media (max-height: 500px) {
.ribbon {
top: calc(25px + var(--header-height-collapsed));
}
}