git.iko.soy/typeable/octopod
on master help sign in
Double click to go to staging page (#81)

* double click to go to staging page * drop redundant dynamics * delete extra space

commit255af148a9a4a500c1c663d0d5ac492d60eeb166 authorNikita <anisimoff.nikita@gmail.com> dateMon 13 Jul 2020, 17:44 (6 years ago) parente37c936
4 files changed+24−27
dm-frontend/src/Page/ClassicPopup.hs+2−2 dm-frontend/src/Page/Deployment.hs+1−1 dm-frontend/src/Page/Deployments.hs+11−11 dm-frontend/src/Page/Utils.hs+10−13
dm-frontend/src/Page/ClassicPopup.hs+2−2
@@ -27,8 +27,8 @@ popupWidget
2727 -> m (Event t (), Event t ())
2828popupWidget m =
2929 fmap snd $
30− elDynAttrWithStopPropagationEvent' Click "div"
31− (constDyn $ "class" =: "classic-popup" <> "style" =: "display: block;") $
30+ elAttr' "div"
31+ ("class" =: "classic-popup" <> "style" =: "display: block;") $
3232 divClass "classic-popup__container" $
3333 divClass "classic-popup__viewport" $
3434 divClass "classic-popup__slot" $ do
dm-frontend/src/Page/Deployment.hs+1−1
@@ -88,7 +88,7 @@ deploymentHead dfiDyn =
8888 "Move to archive"
8989 btnEnabledDyn
9090 delEv <- confirmDeletePopup archEv $ do
91− text "Are you sure you want to delete"
91+ text "Are you sure you want to delete"
9292 el "br" blank
9393 dynText dname
9494 text " staging?"
dm-frontend/src/Page/Deployments.hs+11−11
@@ -187,15 +187,15 @@ activeDeploymentWidget clickedEv dDyn' = do
187187 dDyn <- holdUniqDyn dDyn'
188188 dyn_ $ ffor dDyn $ \DeploymentFullInfo{..} -> do
189189 let dname = deployment ^. field @"name"
190− (linkEl, _) <- el' "tr" $ do
190+ (linkEl, btnEv) <- el' "tr" $ do
191191 el "td" $ do
192192 text $ coerce dname
193193 statusWidget $ constDyn status
194194 el "td" $ do
195195 divClass "listing" $
196196 forM_ urls $ \(_, url) ->
197− void $ elDynAttrWithStopPropagationEvent' Click "a"
198− ( constDyn $ "class" =: "listing__item external bar"
197+ void $ elAttr' "a"
198+ ( "class" =: "listing__item external bar"
199199 <> "href" =: ("https://" <> url)
200200 <> "target" =: "_blank") $ text url
201201 el "td" $
@@ -221,14 +221,14 @@ activeDeploymentWidget clickedEv dDyn' = do
221221 _ <- buttonClass "action action--edit" "Edit"
222222 btnArcEv <- buttonClass "action action--delete" "Move to archive"
223223 pure btnArcEv
224− btnEv <- dropdownWidget' clickedEv btn body
225− delEv <- confirmDeletePopup btnEv $ do
226− text "Are you sure you want to delete"
227− el "br" blank
228− text $ coerce dname <> " staging?"
229− void $ deleteEndpoint (constDyn $ Right $ dname) delEv
224+ dropdownWidget' clickedEv btn body
225+ delEv <- confirmDeletePopup btnEv $ do
226+ text "Are you sure you want to delete"
227+ el "br" blank
228+ text $ coerce dname <> " staging?"
229+ void $ deleteEndpoint (constDyn $ Right $ dname) delEv
230230 let route = DashboardRoute :/ Just dname
231− setRoute $ route <$ domEvent Click linkEl
231+ setRoute $ route <$ domEvent Dblclick linkEl
232232
233233archivedDeploymentsWidget
234234 ::
@@ -349,7 +349,7 @@ archivedDeploymentWidget clickedEv dDyn' = do
349349 btnEv <- dropdownWidget' clickedEv btn body
350350 void $ restoreEndpoint (constDyn $ Right $ dname) btnEv
351351 let route = DashboardRoute :/ Just dname
352− setRoute $ route <$ domEvent Click linkEl
352+ setRoute $ route <$ domEvent Dblclick linkEl
353353
354354tableWrapper :: MonadWidget t m => (Dynamic t SortDir -> m a) -> m a
355355tableWrapper ma =
dm-frontend/src/Page/Utils.hs+10−13
@@ -43,19 +43,16 @@ dropdownWidget'
4343dropdownWidget' clickedEl btn body = mdo
4444 clickInsideEv <- performEvent $ ffor clickedEl $ \(ClickedElement clicked) ->
4545 DOM.contains (_element_raw btnEl) clicked
46− openedDyn <- foldDyn switchState False $ leftmost
47− [ clickInsideEv
48− , False <$ domEvent Click bodyEl
49− , True <$ domEvent Click btnEl ]
46+ openedDyn <- foldDyn switchState False $ clickInsideEv
5047 let
5148 switchState ev cur = ev && not cur
5249 wrapperClassDyn = ffor openedDyn $ \case
5350 True -> "class" =: "drop drop--actions drop--expanded"
5451 False -> "class" =: "drop drop--actions"
55− (btnEl, (bodyEl, wEv)) <- elDynAttrWithStopPropagationEvent' Click
52+ (btnEl, (_, wEv)) <- elDynAttr'
5653 "div" wrapperClassDyn $ do
5754 btn
58− elDynAttrWithStopPropagationEvent' Click "div"
55+ elDynAttr' "div"
5956 (constDyn $ "class" =: "drop__dropdown") body
6057 pure wEv
6158
@@ -97,7 +94,7 @@ eventWriterWrapper m = mdo
9794
9895buttonClass :: (DomBuilder t m, PostBuild t m) => Text -> Text -> m (Event t ())
9996buttonClass cl lbl = do
100− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "button"
97+ (bEl, _) <- elDynAttr' "button"
10198 (constDyn $ "class" =: cl <> "type" =: "button") $ text lbl
10299 return $ domEvent Click bEl
103100
@@ -108,7 +105,7 @@ buttonDynClass
108105 -> m (Event t ())
109106buttonDynClass clDyn lblDyn = do
110107 let attrDyn = ffor clDyn $ \cl -> "class" =: cl <> "type" =: "button"
111− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "button" attrDyn $
108+ (bEl, _) <- elDynAttr' "button" attrDyn $
112109 dynText lblDyn
113110 return $ domEvent Click bEl
114111
@@ -121,7 +118,7 @@ buttonClassEnabled cl lbl dDyn = do
121118 True -> "class" =: cl <> "type" =: "button"
122119 False -> "class" =: (cl <> " button--disabled")
123120 <> "type" =: "button" <> "disabled" =: ""
124− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "button" attrDyn $
121+ (bEl, _) <- elDynAttr' "button" attrDyn $
125122 text lbl
126123 return $ domEvent Click bEl
127124
@@ -134,13 +131,13 @@ buttonClassEnabled' cl lbl dDyn disClass = do
134131 True -> "class" =: cl <> "type" =: "button"
135132 False -> "class" =: (cl <> " " <> disClass)
136133 <> "type" =: "button" <> "disabled" =: ""
137− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "button" attrDyn $
134+ (bEl, _) <- elDynAttr' "button" attrDyn $
138135 text lbl
139136 return $ domEvent Click bEl
140137
141138aButtonClass :: (DomBuilder t m, PostBuild t m) => Text -> Text -> m (Event t ())
142139aButtonClass cl lbl = do
143− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "a"
140+ (bEl, _) <- elDynAttr' "a"
144141 (constDyn $ "class" =: cl <> "type" =: "button") $ text lbl
145142 return $ domEvent Click bEl
146143
@@ -151,7 +148,7 @@ aButtonDynClass
151148 -> m (Event t ())
152149aButtonDynClass clDyn lblDyn = do
153150 let attrDyn = ffor clDyn $ \cl -> "class" =: cl <> "type" =: "button"
154− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "a" attrDyn $
151+ (bEl, _) <- elDynAttr' "a" attrDyn $
155152 dynText lblDyn
156153 return $ domEvent Click bEl
157154
@@ -164,7 +161,7 @@ aButtonClassEnabled cl lbl dDyn = do
164161 True -> "class" =: cl <> "type" =: "button"
165162 False -> "class" =: (cl <> " button--disabled")
166163 <> "type" =: "button" <> "disabled" =: ""
167− (bEl, _) <- elDynAttrWithStopPropagationEvent' Click "a" attrDyn $
164+ (bEl, _) <- elDynAttr' "a" attrDyn $
168165 text lbl
169166 return $ domEvent Click bEl
170167