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
133
Issues
133
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
5252332f
Commit
5252332f
authored
Aug 26, 2024
by
Fabien Maniere
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding a function to open url in new window
parent
a5010ff3
Pipeline
#6533
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+5
-5
DocList.purs
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
+5
-5
LinkHandler.purs
src/Gargantext/Hooks/LinkHandler.purs
+10
-2
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
View file @
5252332f
...
...
@@ -174,7 +174,7 @@ docListCpt = here.component "main" cpt where
, state
}
{ goToURL } <- useLinkHandler
{ goToURL
, goToURLInNewTab
} <- useLinkHandler
-- | Effects
-- |
...
...
@@ -261,8 +261,8 @@ docListCpt = here.component "main" cpt where
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
[ H.li {} [ andOrButton { state: buttonState } ]
, H.li {} [ H.p { className: "text-bold" } [ H.text "No related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURL } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL } ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
]
, B.caveat
{}
...
...
@@ -278,8 +278,8 @@ docListCpt = here.component "main" cpt where
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
[ H.li {} [ andOrButton { state: buttonState } ]
, H.li {} [ H.p { className: "text-bold" } [ H.text $ show (Seq.length results) <> " related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURL } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL } ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
]
, H.ul
{ className: intercalate " "
...
...
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
View file @
5252332f
...
...
@@ -164,7 +164,7 @@ docListCpt = here.component "main" cpt where
, path: path'
}
{ goToURL } <- useLinkHandler
{ goToURL
, goToURLInNewTab
} <- useLinkHandler
-- | Effects
-- |
...
...
@@ -248,8 +248,8 @@ docListCpt = here.component "main" cpt where
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
[ H.li {} [ andOrButton { state: buttonState } ]
, H.li {} [ H.p { className: "text-bold" } [ H.text "No related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch q' goToURL} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL} ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch q' goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL
InNewTab
} ]
]
, B.caveat
{}
...
...
@@ -264,8 +264,8 @@ docListCpt = here.component "main" cpt where
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
[ H.li {} [ andOrButton { state: buttonState } ]
, H.li {} [ H.p { className: "text-bold" } [ H.text $ show (Seq.length results) <> " related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch q' goToURL} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL} ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch q' goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL
InNewTab
} ]
]
,
H.ul
...
...
src/Gargantext/Hooks/LinkHandler.purs
View file @
5252332f
module Gargantext.Hooks.LinkHandler
( Methods, useLinkHandler
, goToRoute, goTo
URL, goToPreviousPage
, goToRoute, goTo
PreviousPage, goToURL, goToURLInNewTab
) where
import Gargantext.Prelude
...
...
@@ -18,12 +18,13 @@ import Type.Proxy (Proxy(..))
import Web.HTML (window)
import Web.HTML.History (back)
import Web.HTML.Location (assign, setHref)
import Web.HTML.Window (history, location)
import Web.HTML.Window (history, location
, open
)
type Methods =
( goToRoute :: AppRoute -> Effect Unit
, goToPreviousPage :: Unit -> Effect Unit
, goToURL :: String -> Effect Unit
, goToURLInNewTab :: String -> Effect Unit
)
useLinkHandler :: R.Hooks (Record Methods)
...
...
@@ -41,6 +42,7 @@ useLinkHandler = do
tile
, goToPreviousPage : const goToPreviousPage
, goToURL : goToURL
, goToURLInNewTab : goToURLInNewTab
}
-- (?) Also exporting implementation methods, as it can be useful in an
...
...
@@ -55,6 +57,12 @@ goToPreviousPage = window >>= history >>= back
goToURL :: String -> Effect Unit
goToURL url = window >>= location >>= setHref url
goToURLInNewTab :: String -> Effect Unit
goToURLInNewTab url = do
_ <- window >>= open url "_blank" ""
-- _ <- window >>= \win -> win.open url "_blank" window
pure unit
--------------------------------------
changeTileRoute ::
...
...
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