Created
July 5, 2019 06:06
-
-
Save rizary/4ce71ce84fbc34038e74fd35ad363bb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tagsMapDyn <- elClass "p" "tagging" $ mdo | |
let evMapTags = Map.fromList . (fmap (\t -> (t,t))) . (fmap tagNToText) . V.toList <$> evPkgTags | |
result <- foldDyn Map.union Map.empty $ fold | |
[ evMapTags | |
, addTag0 | |
, deleteTag0 | |
] | |
deleteTag0 :: Event t (Map.Map T.Text T.Text) <- listViewWithKey result $ \tId tag' -> do | |
-- tagDyn <- holdUniqDyn tag' | |
el "li" $ do | |
el "span" $ text tId | |
rmTagButton_ tId pn | |
pure $ updated tag' | |
addTag0 <- elClass "form" "form" $ do | |
el "p" $ text "Tag : " | |
tagName <- textInput iCfg | |
tagButton <- button_ "Add Tag" | |
let evAdd = (tagPromptlyDyn (_textInput_value tagName) tagButton) | |
addTagN <- holdDyn "" evAdd | |
_ <- putV2PackageTags ((Right . TagN) <$> addTagN) (constDyn $ Right pn) (() <$ evAdd) | |
pure $ (\t -> Map.singleton t t) <$> evAdd | |
pure () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment