From ee0e38eba89bdc1a6b7b22b79b4693d35fa5f0a8 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 24 Feb 2016 17:18:33 +0000 Subject: Style tweaks & discard -> save & clear --- webgui/data/index.html | 13 ++++++++++--- webgui/data/style.css | 10 ++++++++++ webgui/src/Main.hs | 14 ++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) (limited to 'webgui') diff --git a/webgui/data/index.html b/webgui/data/index.html index 79e7bc2..0c877ac 100644 --- a/webgui/data/index.html +++ b/webgui/data/index.html @@ -29,7 +29,7 @@ Not connected to server -
+
@@ -38,7 +38,7 @@
- +
@@ -53,8 +53,15 @@ + + + + + + + + -
diff --git a/webgui/data/style.css b/webgui/data/style.css index 7520e42..001a874 100644 --- a/webgui/data/style.css +++ b/webgui/data/style.css @@ -36,6 +36,12 @@ thead tr:last-child td { border-bottom:1px solid #ddd; } +tfoot tr:first-child td { + margin:0.125em 0 0 0; + padding-top:0.125em; + border-top:1px solid #ddd; +} + .editorButtonContainer { text-align:center; } @@ -83,6 +89,10 @@ thead tr:last-child td { width:6em; } +#draftListBody tbody { + min-height:10em; +} + /*----- Tabs -----*/ .tabs { display:block; 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 ] | otherwise = True discardAction = do - maybe (return ()) draftDelete . associatedDraft =<< currentValue editorStatus + -- maybe (return ()) draftDelete . associatedDraft =<< currentValue editorStatus + saveAction False modifyStatus $ const def printAction = do emitError "Printing not implemented" @@ -235,8 +236,12 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do table <- fatal' "Could not find draft table" =<< getElementById window "draftListBody" initialContent <- toTable =<< drafts return table # set children initialContent + + recheckTimer <- timer + return recheckTimer # set interval 5000 + start recheckTimer - onEvent (filterE concernsDrafts dataUpdate) . const $ drafts >>= toTable >>= (\c -> return table # set children c) + onEvent (unionWith const (() <$ filterE concernsDrafts dataUpdate) (tick recheckTimer)) . const $ drafts >>= toTable >>= (\c -> return table # set children c) where concernsDrafts :: URI -> Bool concernsDrafts (uriPath -> p) @@ -267,8 +272,9 @@ toStatusString :: EditorState -> String toStatusString EditorState{..} | null eTitle , null eText = "Draft is empty" - | Just (t, _) <- lastSaved = "Last saved: " ++ formatTime defaultTimeLocale "%F %X" t - | otherwise = "Draft was never saved" + | Just (DraftId (show -> id)) <- associatedDraft + , Just (t, _) <- lastSaved = "Last saved: " ++ formatTime defaultTimeLocale "%F %X" t ++ " as #" ++ id + | otherwise = "Draft was never saved successfully" toStatusString' :: Either BBCodeError a -> String toStatusString' (Right _) = "" -- cgit v1.2.3