diff options
| -rw-r--r-- | webgui/data/index.html | 13 | ||||
| -rw-r--r-- | webgui/data/style.css | 10 | ||||
| -rw-r--r-- | webgui/src/Main.hs | 14 |
3 files changed, 30 insertions, 7 deletions
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 @@ | |||
| 29 | <textarea id="editorText"></textarea> | 29 | <textarea id="editorText"></textarea> |
| 30 | <span id="bbcodeStatus"></span> | 30 | <span id="bbcodeStatus"></span> |
| 31 | <span id="editorStatus">Not connected to server</span> | 31 | <span id="editorStatus">Not connected to server</span> |
| 32 | <div class="table"> | 32 | <div class="table" style="width:100%"> |
| 33 | <div class="tr"> | 33 | <div class="tr"> |
| 34 | <div class="editorButtonContainer tc"> | 34 | <div class="editorButtonContainer tc"> |
| 35 | <button class="editorButton" id="saveButton">Save</button> | 35 | <button class="editorButton" id="saveButton">Save</button> |
| @@ -38,7 +38,7 @@ | |||
| 38 | <button class="editorButton" id="printButton">Print</button> | 38 | <button class="editorButton" id="printButton">Print</button> |
| 39 | </div> | 39 | </div> |
| 40 | <div class="editorButtonContainer tc"> | 40 | <div class="editorButtonContainer tc"> |
| 41 | <button class="editorButton" id="discardButton">Discard</button> | 41 | <button class="editorButton" id="discardButton">Save & Clear</button> |
| 42 | </div> | 42 | </div> |
| 43 | </div> | 43 | </div> |
| 44 | </div> | 44 | </div> |
| @@ -53,8 +53,15 @@ | |||
| 53 | </tr> | 53 | </tr> |
| 54 | </thead> | 54 | </thead> |
| 55 | <tbody id="draftListBody"></tbody> | 55 | <tbody id="draftListBody"></tbody> |
| 56 | <tfoot> | ||
| 57 | <tr> | ||
| 58 | <td></td><td></td> | ||
| 59 | <td> | ||
| 60 | <input id="allowDeletion" type="checkbox" /><label for="allowDeletion">Allow Deletion</label> | ||
| 61 | </td> | ||
| 62 | </tr> | ||
| 63 | </tfoot> | ||
| 56 | </table> | 64 | </table> |
| 57 | <input id="allowDeletion" type="checkbox" /><label for="allowDeletion">Allow Deletion</label> | ||
| 58 | </div> | 65 | </div> |
| 59 | 66 | ||
| 60 | <div class="tab" id="queue"> | 67 | <div class="tab" id="queue"> |
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 { | |||
| 36 | border-bottom:1px solid #ddd; | 36 | border-bottom:1px solid #ddd; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | tfoot tr:first-child td { | ||
| 40 | margin:0.125em 0 0 0; | ||
| 41 | padding-top:0.125em; | ||
| 42 | border-top:1px solid #ddd; | ||
| 43 | } | ||
| 44 | |||
| 39 | .editorButtonContainer { | 45 | .editorButtonContainer { |
| 40 | text-align:center; | 46 | text-align:center; |
| 41 | } | 47 | } |
| @@ -83,6 +89,10 @@ thead tr:last-child td { | |||
| 83 | width:6em; | 89 | width:6em; |
| 84 | } | 90 | } |
| 85 | 91 | ||
| 92 | #draftListBody tbody { | ||
| 93 | min-height:10em; | ||
| 94 | } | ||
| 95 | |||
| 86 | /*----- Tabs -----*/ | 96 | /*----- Tabs -----*/ |
| 87 | .tabs { | 97 | .tabs { |
| 88 | display:block; | 98 | 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 | |||
| 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 _) = "" |
