Commit 37febcb1 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

tree: some reactix fixes (_type -> type) + some create form restyling

parent 733a974d
...@@ -271,7 +271,7 @@ nodePopupView d nodeState@(s@(NTree (LNode {id, name, popOver: true, createOpen} ...@@ -271,7 +271,7 @@ nodePopupView d nodeState@(s@(NTree (LNode {id, name, popOver: true, createOpen}
[ renameBox d nodeState renameBoxOpen ] [ renameBox d nodeState renameBoxOpen ]
] <> [ editIcon renameBoxOpen ] <> [ ] <> [ editIcon renameBoxOpen ] <> [
H.div {className: "col-md-2"} H.div {className: "col-md-2"}
[ H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove" [ H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove-circle"
, onClick: mkEffectFn1 $ \_ -> setNodeState $ setPopOver false s , onClick: mkEffectFn1 $ \_ -> setNodeState $ setPopOver false s
, title: "Close"} [] , title: "Close"} []
] ]
...@@ -350,7 +350,7 @@ renameBox d (s@(NTree (LNode {id, name}) _) /\ setNodeState) (true /\ setRenameB ...@@ -350,7 +350,7 @@ renameBox d (s@(NTree (LNode {id, name}) _) /\ setNodeState) (true /\ setRenameB
where where
renameInput (_ /\ setRenameNodeName) = renameInput (_ /\ setRenameNodeName) =
H.div {className: "col-md-8"} H.div {className: "col-md-8"}
[ H.input { _type: "text" [ H.input { type: "text"
, placeholder: "Rename Node" , placeholder: "Rename Node"
, defaultValue: name , defaultValue: name
, className: "form-control" , className: "form-control"
...@@ -359,7 +359,7 @@ renameBox d (s@(NTree (LNode {id, name}) _) /\ setNodeState) (true /\ setRenameB ...@@ -359,7 +359,7 @@ renameBox d (s@(NTree (LNode {id, name}) _) /\ setNodeState) (true /\ setRenameB
] ]
renameBtn (newName /\ _) = renameBtn (newName /\ _) =
H.a {className: "btn glyphitem glyphicon glyphicon-ok col-md-2 pull-left" H.a {className: "btn glyphitem glyphicon glyphicon-ok col-md-2 pull-left"
, _type: "button" , type: "button"
, onClick: mkEffectFn1 $ \_ -> do , onClick: mkEffectFn1 $ \_ -> do
setNodeState $ setPopOver false $ setName newName s setNodeState $ setPopOver false $ setName newName s
d $ (Submit id newName) d $ (Submit id newName)
...@@ -367,7 +367,7 @@ renameBox d (s@(NTree (LNode {id, name}) _) /\ setNodeState) (true /\ setRenameB ...@@ -367,7 +367,7 @@ renameBox d (s@(NTree (LNode {id, name}) _) /\ setNodeState) (true /\ setRenameB
} [] } []
cancelBtn = cancelBtn =
H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove col-md-2 pull-left" H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove col-md-2 pull-left"
, _type: "button" , type: "button"
, onClick: mkEffectFn1 $ \_ -> setRenameBoxOpen false , onClick: mkEffectFn1 $ \_ -> setRenameBoxOpen false
, title: "Cancel" , title: "Cancel"
} [] } []
...@@ -401,7 +401,7 @@ createNodeView d (s@(NTree (LNode {id, nodeValue, createOpen: true}) _) /\ setNo ...@@ -401,7 +401,7 @@ createNodeView d (s@(NTree (LNode {id, nodeValue, createOpen: true}) _) /\ setNo
[ H.div {className: "col-md-10"} [ H.div {className: "col-md-10"}
[ H.h5 {} [H.text "Create Node"] ] [ H.h5 {} [H.text "Create Node"] ]
, H.div {className: "col-md-2"} , H.div {className: "col-md-2"}
[ H.a { className: "btn text-danger glyphitem glyphicon glyphicon-remove" [ H.a { className: "btn text-danger glyphitem glyphicon glyphicon-remove-circle"
, onClick: mkEffectFn1 $ \_ -> setNodeState $ setCreateOpen false s , onClick: mkEffectFn1 $ \_ -> setNodeState $ setCreateOpen false s
, title: "Close"} [] , title: "Close"} []
] ]
...@@ -409,18 +409,19 @@ createNodeView d (s@(NTree (LNode {id, nodeValue, createOpen: true}) _) /\ setNo ...@@ -409,18 +409,19 @@ createNodeView d (s@(NTree (LNode {id, nodeValue, createOpen: true}) _) /\ setNo
] ]
panelBody (_ /\ setNodeName) (nt /\ setNodeType) = panelBody (_ /\ setNodeName) (nt /\ setNodeType) =
H.div {className: "panel-body"} H.div {className: "panel-body"}
[ H.div {className: "row form-group"}
[ H.div {className: "col-md-12"}
[ H.div {className: "row"} [ H.div {className: "row"}
[ H.input { _type: "text" [ H.div {className: "col-md-12"}
, placeholder: "Create Node" [ H.form {className: "form-horizontal"}
[ H.div {className: "form-group"}
[ H.input { type: "text"
, placeholder: "Node name"
, defaultValue: getCreateNodeValue s , defaultValue: getCreateNodeValue s
, className: "col-md-12 form-control" , className: "form-control"
, onInput: mkEffectFn1 $ \e -> setNodeName $ e .. "target" .. "value" , onInput: mkEffectFn1 $ \e -> setNodeName $ e .. "target" .. "value"
} }
] ]
, H.div {className: "row"} , H.div {className: "form-group"}
[ R2.select { className: "col-md-12 form-control" [ R2.select { className: "form-control"
, onChange: mkEffectFn1 $ \e -> setNodeType $ readNodeType $ e .. "target" .. "value" , onChange: mkEffectFn1 $ \e -> setNodeType $ readNodeType $ e .. "target" .. "value"
} }
(map renderOption [Corpus, Folder]) (map renderOption [Corpus, Folder])
...@@ -428,11 +429,12 @@ createNodeView d (s@(NTree (LNode {id, nodeValue, createOpen: true}) _) /\ setNo ...@@ -428,11 +429,12 @@ createNodeView d (s@(NTree (LNode {id, nodeValue, createOpen: true}) _) /\ setNo
] ]
] ]
] ]
]
renderOption (opt :: NodeType) = H.option {} [ H.text $ show opt ] renderOption (opt :: NodeType) = H.option {} [ H.text $ show opt ]
panelFooter (name /\ _) (nt /\ _) = panelFooter (name /\ _) (nt /\ _) =
H.div {className: "panel-footer"} H.div {className: "panel-footer"}
[ H.button {className: "btn btn-success" [ H.button {className: "btn btn-success"
, _type: "button" , type: "button"
, onClick: mkEffectFn1 $ \_ -> d $ (CreateSubmit id name nt) , onClick: mkEffectFn1 $ \_ -> d $ (CreateSubmit id name nt)
} [H.text "Create"] } [H.text "Create"]
] ]
...@@ -465,7 +467,7 @@ fileTypeView d (s@(NTree (LNode {id}) _) /\ _) (Just (DroppedFile {contents, fil ...@@ -465,7 +467,7 @@ fileTypeView d (s@(NTree (LNode {id}) _) /\ _) (Just (DroppedFile {contents, fil
[ H.div {className: "col-md-10"} [ H.div {className: "col-md-10"}
[ H.h5 {} [H.text "Choose file type"] ] [ H.h5 {} [H.text "Choose file type"] ]
, H.div {className: "col-md-2"} , H.div {className: "col-md-2"}
[ H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove" [ H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove-circle"
, onClick: mkEffectFn1 $ \_ -> setDroppedFile $ Nothing , onClick: mkEffectFn1 $ \_ -> setDroppedFile $ Nothing
, title: "Close"} [] , title: "Close"} []
] ]
...@@ -487,14 +489,14 @@ fileTypeView d (s@(NTree (LNode {id}) _) /\ _) (Just (DroppedFile {contents, fil ...@@ -487,14 +489,14 @@ fileTypeView d (s@(NTree (LNode {id}) _) /\ _) (Just (DroppedFile {contents, fil
case fileType of case fileType of
Just ft -> Just ft ->
H.button {className: "btn btn-success" H.button {className: "btn btn-success"
, _type: "button" , type: "button"
, onClick: mkEffectFn1 $ \_ -> do , onClick: mkEffectFn1 $ \_ -> do
setDroppedFile $ Nothing setDroppedFile $ Nothing
d $ (UploadFile id ft contents) d $ (UploadFile id ft contents)
} [H.text "Upload"] } [H.text "Upload"]
Nothing -> Nothing ->
H.button {className: "btn btn-success disabled" H.button {className: "btn btn-success disabled"
, _type: "button" , type: "button"
} [H.text "Upload"] } [H.text "Upload"]
] ]
fileTypeView _ _ (Nothing /\ _) = R.createElement el {} [] fileTypeView _ _ (Nothing /\ _) = R.createElement el {} []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment