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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
abcb71f3
Commit
abcb71f3
authored
Aug 10, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tree] input with enter for child add
parent
c48c056e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+17
-6
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+1
-1
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
abcb71f3
...
@@ -4,17 +4,20 @@ import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
...
@@ -4,17 +4,20 @@ import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Array (head, length)
import Data.Array (head, length)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff, launchAff_)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, form
Edit, form
ChoiceSafe, panel)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, formChoiceSafe, panel)
import Gargantext.
Prelude (Unit, bind, pure, show, ($), (<>), (>)
)
import Gargantext.
Components.InputWithEnter (inputWithEnter
)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
import Reactix as R
import Reactix.DOM.HTML as H
----------------------------------------------------------------------
----------------------------------------------------------------------
addNode :: Session -> GT.ID -> AddNodeValue -> Aff (Array GT.ID)
addNode :: Session -> GT.ID -> AddNodeValue -> Aff (Array GT.ID)
...
@@ -76,7 +79,15 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
...
@@ -76,7 +79,15 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
where
where
defaultNt = (fromMaybe Error $ head nodeTypes)
defaultNt = (fromMaybe Error $ head nodeTypes)
maybeEdit = [ if edit
maybeEdit = [ if edit
then formEdit name' setNodeName
then inputWithEnter {
onEnter: \_ -> launchAff_ $ dispatch (AddNode name' nt')
, onValueChanged: \val -> setNodeName $ const val
, autoFocus: true
, className: "form-control"
, defaultValue: name'
, placeholder: name'
, type: "text"
}
else H.div {} []
else H.div {} []
]
]
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
abcb71f3
...
@@ -128,7 +128,7 @@ formEdit defaultValue setter =
...
@@ -128,7 +128,7 @@ formEdit defaultValue setter =
H.div {className: "form-group"}
H.div {className: "form-group"}
[ H.input { type : "text"
[ H.input { type : "text"
, placeholder : defaultValue
, placeholder : defaultValue
, defaultValue:
"Write" <>
defaultValue
, defaultValue: defaultValue
, className : "form-control"
, className : "form-control"
, on: { input: setter
, on: { input: setter
<<< const
<<< const
...
...
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