loading script only when needed
This commit is contained in:
parent
db8e561704
commit
3a53ab0f24
3 changed files with 9 additions and 5 deletions
|
@ -130,7 +130,7 @@ instance Yesod App where
|
||||||
]
|
]
|
||||||
mapM_ addScript $ map StaticR
|
mapM_ addScript $ map StaticR
|
||||||
[ js_crementing_js
|
[ js_crementing_js
|
||||||
, js_barcode_js
|
-- , js_barcode_js
|
||||||
]
|
]
|
||||||
$(widgetFile "default-layout")
|
$(widgetFile "default-layout")
|
||||||
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
|
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
|
||||||
|
|
|
@ -31,14 +31,16 @@ getHomeR = do
|
||||||
beverages <- runDB $ selectList [BeverageAmount !=. 0] [Desc BeverageIdent]
|
beverages <- runDB $ selectList [BeverageAmount !=. 0] [Desc BeverageIdent]
|
||||||
today <- liftIO $ utctDay <$> getCurrentTime
|
today <- liftIO $ utctDay <$> getCurrentTime
|
||||||
users <- runDB $ selectList [UserTimestamp >=. addDays (-30) today] [Asc UserIdent]
|
users <- runDB $ selectList [UserTimestamp >=. addDays (-30) today] [Asc UserIdent]
|
||||||
defaultLayout $
|
defaultLayout $ do
|
||||||
|
addScript $ StaticR js_barcode_js
|
||||||
$(widgetFile "home")
|
$(widgetFile "home")
|
||||||
|
|
||||||
getReactivateR :: Handler Html
|
getReactivateR :: Handler Html
|
||||||
getReactivateR = do
|
getReactivateR = do
|
||||||
today <- liftIO $ return . utctDay =<< getCurrentTime
|
today <- liftIO $ return . utctDay =<< getCurrentTime
|
||||||
users <- runDB $ selectList [UserTimestamp <. addDays (-30) today] [Asc UserIdent]
|
users <- runDB $ selectList [UserTimestamp <. addDays (-30) today] [Asc UserIdent]
|
||||||
defaultLayout $
|
defaultLayout $ do
|
||||||
|
addScript $ StaticR js_barcode_js
|
||||||
$(widgetFile "reactivate")
|
$(widgetFile "reactivate")
|
||||||
|
|
||||||
getUserReactivateR :: UserId -> Handler Html
|
getUserReactivateR :: UserId -> Handler Html
|
||||||
|
|
|
@ -25,14 +25,16 @@ getSelectR uId =
|
||||||
isUser uId HomeR >>= (\user -> do
|
isUser uId HomeR >>= (\user -> do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
beverages <- runDB $ selectList [BeverageAmount >. 0] [Asc BeverageIdent]
|
beverages <- runDB $ selectList [BeverageAmount >. 0] [Asc BeverageIdent]
|
||||||
defaultLayout $
|
defaultLayout $ do
|
||||||
|
addScript $ StaticR js_barcode_js
|
||||||
$(widgetFile "select")
|
$(widgetFile "select")
|
||||||
)
|
)
|
||||||
|
|
||||||
getSelectCashR :: Handler Html
|
getSelectCashR :: Handler Html
|
||||||
getSelectCashR = do
|
getSelectCashR = do
|
||||||
beverages <- runDB $ selectList [BeverageAmount >. 0] [Asc BeverageIdent]
|
beverages <- runDB $ selectList [BeverageAmount >. 0] [Asc BeverageIdent]
|
||||||
defaultLayout $
|
defaultLayout $ do
|
||||||
|
addScript $ StaticR js_barcode_js
|
||||||
$(widgetFile "selectCash")
|
$(widgetFile "selectCash")
|
||||||
|
|
||||||
getRechargeR :: UserId -> Handler Html
|
getRechargeR :: UserId -> Handler Html
|
||||||
|
|
Loading…
Reference in a new issue