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
9c3c8b11
Commit
9c3c8b11
authored
Feb 20, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tree] more work on copy from corpus tree
parent
1a4bb5dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
46 deletions
+25
-46
Login.css
dist/styles/Login.css
+7
-0
Login.sass
dist/styles/Login.sass
+6
-0
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+12
-46
No files found.
dist/styles/Login.css
View file @
9c3c8b11
...
...
@@ -214,5 +214,12 @@ a:focus, a:hover {
.copy-from-corpus
.tree
.node
{
padding-left
:
10px
;
}
.copy-from-corpus
.tree
.node
.name.clickable
{
color
:
#337ab7
;
cursor
:
pointer
;
}
.copy-from-corpus
.tree
.node
.name.clickable
:hover
{
text-decoration
:
underline
;
}
/*# sourceMappingURL=Login.css.map */
dist/styles/Login.sass
View file @
9c3c8b11
...
...
@@ -202,3 +202,9 @@ a:focus, a:hover
.tree
.node
padding-left
:
10px
.name
&
.clickable
color
:
#337ab7
cursor
:
pointer
&
:hover
text-decoration
:
underline
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
9c3c8b11
module Gargantext.Components.Forest.Tree.Node.Action.Upload where
import Data.Array as A
import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype)
import Data.Tuple (Tuple(..), fst, snd)
...
...
@@ -323,66 +324,31 @@ copyFromCorpusViewLoadedCpt :: R.Component CorpusTreeProps
copyFromCorpusViewLoadedCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusViewLoadedCpt" cpt
where
cpt p@{dispatch, id, nodeType, session, tree} _ = do
mCorpusId :: R.State (Maybe ID) <- R.useState' Nothing
pure $ H.div { className: "copy-from-corpus" } [
H.div { className: "tree" } [copyFromCorpusTreeView p]
, H.div {} [ copyFromCorpusButton { dispatch, id, mCorpusId, nodeType, session } ]
]
-- onChangeContents :: forall e. R.State (Maybe ID) -> E.SyntheticEvent_ e -> Effect Unit
-- onChangeContents (mCorpusId /\ setMCorpusId) e = do
-- E.preventDefault e
-- E.stopPropagation e
-- setMCorpusId $ const $ Just 1
copyFromCorpusTreeView :: Record CorpusTreeProps -> R.Element
copyFromCorpusTreeView props = R.createElement copyFromCorpusTreeViewCpt props []
copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps
copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt
where
cpt p@{
tree: NTree (LNode { nam
e }) ary} _ = do
cpt p@{
id, tree: NTree (LNode { id: sourceId, name, nodeTyp
e }) ary} _ = do
pure $ H.div { className: "node" } ([
H.span {} [ H.text name ]
H.span { className: "name " <> clickable
, on: { click: onClick }
} [ H.text name ]
] <> children)
where
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary
type CopyFromCorpusButtonProps =
(
dispatch :: Action -> Aff Unit
, id :: Int
, mCorpusId :: R.State (Maybe Int)
, nodeType :: GT.NodeType
, session :: Session
)
copyFromCorpusButton :: Record CopyFromCorpusButtonProps -> R.Element
copyFromCorpusButton props = R.createElement copyFromCorpusButtonCpt props []
copyFromCorpusButtonCpt :: R.Component CopyFromCorpusButtonProps
copyFromCorpusButtonCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusButton" cpt
where
cpt {dispatch, id, mCorpusId: (mCorpusId /\ setMCorpusId), nodeType, session} _ = do
R.useEffect' $ do
log2 "[copyFromCorpusButton] session" session
pure $ H.button {className: "btn btn-primary", disabled, on: {click: onClick}} [ H.text "Copy" ]
where
disabled = case mCorpusId of
Nothing -> "1"
Just _ -> ""
onClick :: forall e. e -> Effect Unit
onClick e = do
pure unit
-- let corpusId = unsafePartial $ fromJust mCorpusId
-- void $ launchAff do
-- _ <- dispatch $ UploadFile nodeType CSV contents
-- liftEffect $ do
-- setMContents $ const $ Nothing
validNodeType = (A.elem nodeType [GT.Corpus, GT.NodeList]) && (id /= sourceId)
clickable = if validNodeType then "clickable" else ""
onClick _ = case validNodeType of
false -> pure unit
true -> do
log2 "[copyFromCorpusTreeViewCpt] issue copy into" id
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId
loadCorporaTree :: Session -> Aff FTree
loadCorporaTree session = getCorporaTree session treeId
...
...
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