This commit is contained in:
Joey Hess 2013-10-02 01:06:59 -04:00
parent 028b0d8961
commit dfdaa649d0
13 changed files with 38 additions and 34 deletions

View file

@ -52,7 +52,7 @@ simplifyTransfers [] = []
simplifyTransfers (x:[]) = [x]
simplifyTransfers (v@(t1, _):r@((t2, _):l))
| equivilantTransfer t1 t2 = simplifyTransfers (v:l)
| otherwise = v : (simplifyTransfers r)
| otherwise = v : simplifyTransfers r
{- Called by client to get a display of currently in process transfers.
-
@ -78,7 +78,7 @@ dashboard warnNoScript = do
$(widgetFile "dashboard/main")
getDashboardR :: Handler Html
getDashboardR = ifM (inFirstRun)
getDashboardR = ifM inFirstRun
( redirect ConfigurationR
, page "" (Just DashBoard) $ dashboard True
)
@ -107,7 +107,7 @@ postFileBrowserR = void openFileBrowser
{- Used by non-javascript browsers, where clicking on the link actually
- opens this page, so we redirect back to the referrer. -}
getFileBrowserR :: Handler ()
getFileBrowserR = whenM openFileBrowser $ redirectBack
getFileBrowserR = whenM openFileBrowser redirectBack
{- Opens the system file browser on the repo, or, as a fallback,
- goes to a file:// url. Returns True if it's ok to redirect away
@ -137,14 +137,17 @@ openFileBrowser = do
{- Transfer controls. The GET is done in noscript mode and redirects back
- to the referring page. The POST is called by javascript. -}
getPauseTransferR :: Transfer -> Handler ()
getPauseTransferR t = pauseTransfer t >> redirectBack
getPauseTransferR = noscript postPauseTransferR
postPauseTransferR :: Transfer -> Handler ()
postPauseTransferR t = pauseTransfer t
postPauseTransferR = pauseTransfer
getStartTransferR :: Transfer -> Handler ()
getStartTransferR t = startTransfer t >> redirectBack
getStartTransferR = noscript postStartTransferR
postStartTransferR :: Transfer -> Handler ()
postStartTransferR t = startTransfer t
postStartTransferR = startTransfer
getCancelTransferR :: Transfer -> Handler ()
getCancelTransferR t = cancelTransfer False t >> redirectBack
getCancelTransferR = noscript postCancelTransferR
postCancelTransferR :: Transfer -> Handler ()
postCancelTransferR t = cancelTransfer False t
postCancelTransferR = cancelTransfer False
noscript :: (Transfer -> Handler ()) -> Transfer -> Handler ()
noscript a t = a t >> redirectBack