diff options
Diffstat (limited to 'webgui/src')
-rw-r--r-- | webgui/src/Main.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/webgui/src/Main.hs b/webgui/src/Main.hs index 252e933..e4b25e6 100644 --- a/webgui/src/Main.hs +++ b/webgui/src/Main.hs | |||
@@ -123,9 +123,9 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do | |||
123 | 123 | ||
124 | selectedPrinter <- handleJobTable fJobs | 124 | selectedPrinter <- handleJobTable fJobs |
125 | 125 | ||
126 | changeEditorStatus <- handleEditor selectedPrinter fJobs | 126 | (editorStatus, changeEditorStatus) <- handleEditor selectedPrinter fJobs |
127 | 127 | ||
128 | handleDraftTable changeEditorStatus | 128 | handleDraftTable (editorStatus, changeEditorStatus) |
129 | 129 | ||
130 | where | 130 | where |
131 | handleSocketErr InvalidMessage = emitError "Received unparseable message from server-side websocket" | 131 | handleSocketErr InvalidMessage = emitError "Received unparseable message from server-side websocket" |
@@ -242,13 +242,13 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do | |||
242 | on (whenE (not <$> saveDraft) . UI.click) discardButton $ const discardAction | 242 | on (whenE (not <$> saveDraft) . UI.click) discardButton $ const discardAction |
243 | on (whenE saveDraft . UI.click) discardButton $ const clearAction | 243 | on (whenE saveDraft . UI.click) discardButton $ const clearAction |
244 | 244 | ||
245 | return modifyStatus | 245 | return (editorStatus, modifyStatus) |
246 | 246 | ||
247 | saveable s@EditorState{..} = isRight ePrintout && discardable s | 247 | saveable s@EditorState{..} = isRight ePrintout && discardable s |
248 | printable EditorState{..} = isRight ePrintout && not (null eText) | 248 | printable EditorState{..} = isRight ePrintout && not (null eText) |
249 | discardable EditorState{..} = not (maybe True null eTitle && null eText) | 249 | discardable EditorState{..} = not (maybe True null eTitle && null eText) |
250 | 250 | ||
251 | handleDraftTable changeEditorState = do | 251 | handleDraftTable (editorState, changeEditorState) = do |
252 | -- allowDeletion <- fatal' "Could not find deletion switch" =<< getElementById window "allowDeletion" | 252 | -- allowDeletion <- fatal' "Could not find deletion switch" =<< getElementById window "allowDeletion" |
253 | -- deletion' <- allowDeletion # get UI.checked | 253 | -- deletion' <- allowDeletion # get UI.checked |
254 | 254 | ||
@@ -257,7 +257,12 @@ setup Config{..} window (split -> (socketErr, dataUpdate)) = void $ do | |||
257 | 257 | ||
258 | 258 | ||
259 | enactDeletion <- fatal' "Could not find deletion button" =<< getElementById window "enactDeletion" | 259 | enactDeletion <- fatal' "Could not find deletion button" =<< getElementById window "enactDeletion" |
260 | on UI.click enactDeletion . const $ currentValue marking >>= mapM_ (runExceptT . draftDelete) >> updateMarking Set.empty | 260 | on UI.click enactDeletion . const $ do |
261 | cMarking <- currentValue marking | ||
262 | mapM_ (runExceptT . draftDelete) cMarking | ||
263 | cDraft <- associatedDraft <$> currentValue editorState | ||
264 | when (Set.member cDraft $ Set.map Just cMarking) $ changeEditorState (\s -> s { associatedDraft = Nothing } ) | ||
265 | updateMarking Set.empty | ||
261 | -- deletion' <- allowDeletion # get UI.checked | 266 | -- deletion' <- allowDeletion # get UI.checked |
262 | let | 267 | let |
263 | updateMarking' = callFunction (mangle <$> ffi getChecked) >>= updateMarking | 268 | updateMarking' = callFunction (mangle <$> ffi getChecked) >>= updateMarking |