diff options
Diffstat (limited to 'webgui/src')
| -rw-r--r-- | webgui/src/Main.hs | 14 | 
1 files changed, 10 insertions, 4 deletions
| diff --git a/webgui/src/Main.hs b/webgui/src/Main.hs index 537dcf1..be2a0a1 100644 --- a/webgui/src/Main.hs +++ b/webgui/src/Main.hs | |||
| @@ -179,7 +179,8 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do | |||
| 179 | ] | 179 | ] | 
| 180 | | otherwise = True | 180 | | otherwise = True | 
| 181 | discardAction = do | 181 | discardAction = do | 
| 182 | maybe (return ()) draftDelete . associatedDraft =<< currentValue editorStatus | 182 | -- maybe (return ()) draftDelete . associatedDraft =<< currentValue editorStatus | 
| 183 | saveAction False | ||
| 183 | modifyStatus $ const def | 184 | modifyStatus $ const def | 
| 184 | printAction = do | 185 | printAction = do | 
| 185 | emitError "Printing not implemented" | 186 | emitError "Printing not implemented" | 
| @@ -235,8 +236,12 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do | |||
| 235 | table <- fatal' "Could not find draft table" =<< getElementById window "draftListBody" | 236 | table <- fatal' "Could not find draft table" =<< getElementById window "draftListBody" | 
| 236 | initialContent <- toTable =<< drafts | 237 | initialContent <- toTable =<< drafts | 
| 237 | return table # set children initialContent | 238 | return table # set children initialContent | 
| 239 | |||
| 240 | recheckTimer <- timer | ||
| 241 | return recheckTimer # set interval 5000 | ||
| 242 | start recheckTimer | ||
| 238 | 243 | ||
| 239 | onEvent (filterE concernsDrafts dataUpdate) . const $ drafts >>= toTable >>= (\c -> return table # set children c) | 244 | onEvent (unionWith const (() <$ filterE concernsDrafts dataUpdate) (tick recheckTimer)) . const $ drafts >>= toTable >>= (\c -> return table # set children c) | 
| 240 | where | 245 | where | 
| 241 | concernsDrafts :: URI -> Bool | 246 | concernsDrafts :: URI -> Bool | 
| 242 | concernsDrafts (uriPath -> p) | 247 | concernsDrafts (uriPath -> p) | 
| @@ -267,8 +272,9 @@ toStatusString :: EditorState -> String | |||
| 267 | toStatusString EditorState{..} | 272 | toStatusString EditorState{..} | 
| 268 | | null eTitle | 273 | | null eTitle | 
| 269 | , null eText = "Draft is empty" | 274 | , null eText = "Draft is empty" | 
| 270 | | Just (t, _) <- lastSaved = "Last saved: " ++ formatTime defaultTimeLocale "%F %X" t | 275 | | Just (DraftId (show -> id)) <- associatedDraft | 
| 271 | | otherwise = "Draft was never saved" | 276 | , Just (t, _) <- lastSaved = "Last saved: " ++ formatTime defaultTimeLocale "%F %X" t ++ " as #" ++ id | 
| 277 | | otherwise = "Draft was never saved successfully" | ||
| 272 | 278 | ||
| 273 | toStatusString' :: Either BBCodeError a -> String | 279 | toStatusString' :: Either BBCodeError a -> String | 
| 274 | toStatusString' (Right _) = "" | 280 | toStatusString' (Right _) = "" | 
