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
b01a7fe6
Commit
b01a7fe6
authored
Nov 04, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FOREST][REFACT] buttonClick.
parent
6104d122
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
85 deletions
+54
-85
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+33
-7
Rename.purs
...Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
+2
-0
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+15
-74
Types.purs
src/Gargantext/Types.purs
+0
-2
Utils.purs
src/Gargantext/Utils.purs
+2
-0
index.html
src/index.html
+2
-2
No files found.
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
b01a7fe6
module Gargantext.Components.Forest.Tree.Node where
import Prelude
import Data.Array (foldl)
import Gargantext.Types
import Effect.Uncurried (mkEffectFn1)
-- import Data.Set
...
...
@@ -39,6 +40,31 @@ instance eqNodeAction :: Eq NodeAction where
eq (Add x) (Add y) = true && (x == y)
eq _ _ = false
instance showNodeAction :: Show NodeAction where
show (Documentation x) = "Documentation of " <> show x
show SearchBox = "SearchBox"
show Download = "Download"
show Upload = "Upload"
show Refresh = "Refresh"
show Move = "Move"
show Clone = "Clone"
show Delete = "Delete"
show Share = "Share"
show (Link x) = "Link to " <> show x
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction (Documentation _) = "question-sign"
glyphiconNodeAction Delete = "trash"
glyphiconNodeAction (Add _) = "plus"
glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "transfer"
glyphiconNodeAction Download = "download"
glyphiconNodeAction _ = ""
------------------------------------------------------------------------
------------------------------------------------------------------------
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
View file @
b01a7fe6
...
...
@@ -58,3 +58,5 @@ renameBox _ p (false /\ _) = R.createElement el p []
-- END Rename Box
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
b01a7fe6
...
...
@@ -263,90 +263,29 @@ nodePopupView _ p _ = R.createElement el p []
-- buttonAction :: NodeAction -> R.Element
buttonClick (node@{action} /\ setNodePopup) _ todo
@(Documentation x)
= H.div {className: "col-md-2"}
buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: glyphiconActive "question-sign" (action == (Just todo))
, id: "doc"
, title: "Documentation of " <> show x
, onClick : mkEffectFn1 $ \_ -> setNodePopup $ const (node { action = Just todo })
}
[]
]
buttonClick (node@{action} /\ setNodePopup) d Delete = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: glyphiconActive "trash" (action == (Just Delete))
, id: "delete"
, title: "Delete"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const $ node { action = Just Delete }
}
[]
]
buttonClick (node@{action} /\ setNodePopup) d (Add xs) = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: glyphiconActive "plus" (action == (Just $ Add xs))
, id: "add"
, title: "add"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const $ node { action = Just $ Add xs}
}
[]
]
--{-
buttonClick (node@{nodeType,action} /\ setNodePopup) d SearchBox = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: glyphiconActive "search" (action == (Just SearchBox))
, id: "search"
, title: "Search and create " <> show nodeType
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const $ node {action = Just SearchBox}
}
[]
]
buttonClick (node@{action} /\ setNodePopup) _ Upload = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: glyphiconActive "upload" (action == (Just Upload))
, id: "upload"
, title: "Upload [WIP]"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const $ node {action = Just Upload}
, className: glyphiconActive (glyphiconNodeAction todo)
(action == (Just todo) )
, id: show todo
, title: show todo
, onClick : mkEffectFn1
$ \_ -> setNodePopup
$ const (node { action = action' })
}
[]
]
where
action' = if action == (Just todo)
then Nothing
else (Just todo)
buttonClick (node@{action} /\ setNodePopup) _ (Link n) = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: glyphiconActive "transfer" (action == (Just $ Link n))
, id: "link"
, title: "Link [WIP]"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const $ node {action = Just (Link n)}
}
[]
]
buttonClick _ _ _ = H.div {} []
buttonClick (node@{action} /\ setNodePopup) _ Download = H.div {className: "col-md-2"}
[ H.a {style: iconAStyle
, className: glyphiconActive "download" (action == (Just Download))
, id: "download"
, title: "Download [WIP]"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const $ node {action = Just Download}
}
[]
]
buttonClick _ _ _ = H.div {} []
buttonPop f = H.div {className: "col-md-4"}
[ H.a { style: iconAStyle
, className: (glyphicon "plus")
, id: "create"
, title: "Create"
, onClick: mkEffectFn1 $ \_ -> f $ const $ Just CreatePopup
}
[]
]
-- END Popup View
...
...
@@ -403,3 +342,5 @@ reallyDelete d = H.div {className: "panel-footer"}
]
src/Gargantext/Types.purs
View file @
b01a7fe6
...
...
@@ -223,8 +223,6 @@ fldr _ true = "fa fa-folder-o"
{-
------------------------------------------------------------
instance ordNodeType :: Ord NodeType where
...
...
src/Gargantext/Utils.purs
View file @
b01a7fe6
...
...
@@ -57,3 +57,5 @@ glyphicon t = "btn glyphitem glyphicon glyphicon-" <> t
glyphiconActive :: String -> Boolean -> String
glyphiconActive icon b = glyphicon icon <> if b then " active" else ""
src/index.html
View file @
b01a7fe6
...
...
@@ -5,8 +5,8 @@
<title>
CNRS GarganText
</title>
<link
href=
"https://fonts.googleapis.com/icon?family=Material+Icons"
rel=
"stylesheet"
>
<!--<link href="https://use.fontawesome.com/releases/v5.0.8/styles/all.css" rel="stylesheet">-->
<
!--<link rel="stylesheet" href="icons/fork-awesome/css/fork-awesome.css">--
>
<
link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css"
integrity=
"sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY="
crossorigin=
"anonymous"
>
<
link
rel=
"stylesheet"
href=
"icons/fork-awesome/css/fork-awesome.css"
>
<
!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css" integrity="sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY=" crossorigin="anonymous">--
>
<link
href=
"styles/login.min.css"
rel=
"stylesheet"
>
<link
href=
"styles/bootstrap.min.css"
rel=
"stylesheet"
>
<!-- <link href="styles/lavish-bootstrap.css" rel="stylesheet"> -->
...
...
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