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
1628b0c7
Commit
1628b0c7
authored
Nov 22, 2018
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Plain Diff
working tree
parents
9d7f84ab
d4d6fb3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
Tree.purs
src/Gargantext/Components/Tree.purs
+14
-5
No files found.
src/Gargantext/Components/Tree.purs
View file @
1628b0c7
...
...
@@ -24,6 +24,7 @@ import React (ReactElement)
import React.DOM (a, button, div, h5, i, input, li, span, text, ul)
import React.DOM.Props (Props, _id, _type, className, href, title, onClick, onInput, placeholder, style, value, _data)
import Thermite (PerformAction, Render, Spec, cotransform, defaultPerformAction, defaultRender, modifyState, simpleSpec)
import Gargantext.Config (toUrl, End(Front), NodeType(..))
type Name = String
type Open = Boolean
type URL = String
...
...
@@ -49,7 +50,7 @@ data Action = ShowPopOver ID
type State = FTree
initialState :: State
initialState = NTree (LNode {id : 3, name : "hello", nodeType :
""
, open : true, popOver : false, renameNodeValue : "", createNode : false, nodeValue : "InitialNode", showRenameBox : false}) []
initialState = NTree (LNode {id : 3, name : "hello", nodeType :
Node
, open : true, popOver : false, renameNodeValue : "", createNode : false, nodeValue : "InitialNode", showRenameBox : false}) []
...
...
@@ -173,7 +174,7 @@ toggleNode sid (NTree (LNode {id, name, nodeType, open, popOver, renameNodeValue
-- Realistic Tree for the UI
exampleTree :: NTree LNode
exampleTree = NTree (LNode {id : 1, name : "", nodeType :
""
, open : false, popOver : false, renameNodeValue : "", createNode : false, nodeValue : "", showRenameBox : false}) []
exampleTree = NTree (LNode {id : 1, name : "", nodeType :
Node
, open : false, popOver : false, renameNodeValue : "", createNode : false, nodeValue : "", showRenameBox : false}) []
-- exampleTree :: NTree LNode
-- exampleTree =
...
...
@@ -351,7 +352,8 @@ toHtml d s@(NTree (LNode {id, name, nodeType, open, popOver, renameNodeValue, cr
li []
[
a [ href (toUrl Front Folder id )]
a [ href (toUrl Front nodeType id)]
( [ text (name <> " ")
]
)
...
...
@@ -368,7 +370,7 @@ toHtml d s@(NTree (LNode {id, name, nodeType, open, popOver, renameNodeValue,cre
ul []
[ li [] $
( [ a [onClick $ (\e-> d $ ToggleFolder id)] [i [fldr open] []]
, a [ href (toUrl Front
Folder id
)]
, a [ href (toUrl Front
nodeType id
)]
[ text $ " " <> name <> " " ]
...
...
@@ -385,7 +387,7 @@ fldr :: Boolean -> Props
fldr open = if open then className "fas fa-folder-open" else className "fas fa-folder"
newtype LNode = LNode {id :: Int, name :: String, nodeType ::
String
, open :: Boolean, popOver :: Boolean, renameNodeValue :: String, nodeValue :: String, createNode :: Boolean, showRenameBox :: Boolean}
newtype LNode = LNode {id :: Int, name :: String, nodeType ::
NodeType
, open :: Boolean, popOver :: Boolean, renameNodeValue :: String, nodeValue :: String, createNode :: Boolean, showRenameBox :: Boolean}
derive instance newtypeLNode :: Newtype LNode _
...
...
@@ -531,3 +533,10 @@ fnTransform n = NTree n []
unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value
-- <<<<<<< HEAD
-- a [ href (toUrl Front Folder id )]
-- =======
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