Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
b6b19010
Commit
b6b19010
authored
Jun 14, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] Tool: form edit
parent
406521d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
16 deletions
+38
-16
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+5
-16
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+33
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
b6b19010
...
...
@@ -8,7 +8,7 @@ import Effect.Aff (Aff)
import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton
, formEdit
)
import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (>), (<<<), read)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
...
...
@@ -81,21 +81,10 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
]
where
SettingsBox {edit} = settingsBox nt
maybeEdit = [ if edit then
H.div {className: "form-group"}
[ H.input { type : "text"
, placeholder : "Node name"
, defaultValue: "Write Name here"
, className : "form-control"
, onInput : mkEffectFn1
$ setNodeName
<<< const
<<< R2.unsafeEventValue
}
]
else
H.div {} []
]
maybeEdit = [ if edit
then formEdit "Node Name" setNodeName
else H.div {} []
]
maybeChoose = [ if length nodeTypes > 1 then
R.fragment [
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
b6b19010
...
...
@@ -2,6 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Tools where
import Data.String as S
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node.Action
...
...
@@ -88,3 +89,35 @@ fragmentPT :: String -> R.Element
fragmentPT text = H.div {style: {margin: "10px"}} [H.text text]
-- | Edit input
-- form ::
-- formEdit :: forall a. String -> R.State a -> R.Element
type DefaultText = String
formEdit :: forall previous next
. DefaultText
-> ((previous -> String)
-> Effect next)
-> R.Element
formEdit defaultValue setter =
H.div {className: "form-group"}
[ H.input { type : "text"
, placeholder : defaultValue
, defaultValue: "Write" <> defaultValue
, className : "form-control"
, onInput : mkEffectFn1
$ setter
<<< const
<<< R2.unsafeEventValue
}
]
-- | Form
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment