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
43a489dd
Commit
43a489dd
authored
Dec 04, 2023
by
Fabien Manière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding a pattern attr ti inputs, and trim input values before dispatching email
parent
b43aa50d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+2
-0
Search.purs
src/Gargantext/Components/GraphExplorer/Topbar/Search.purs
+2
-0
InputWithAutocomplete.purs
src/Gargantext/Components/InputWithAutocomplete.purs
+16
-3
TopBar.purs
src/Gargantext/Components/PhyloExplorer/Topbar/TopBar.purs
+2
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
43a489dd
...
...
@@ -99,6 +99,8 @@ shareNodeInnerCpt = here.component "shareNodeInner" cpt
, autocompleteSearch
, onAutocompleteClick
, text
, pattern: "^\\S+$" -- pattern doesn't allow space characters
, title: "Enter a username or an email address (space characters are not allowed)"
, placeholder: "username or email"}
] (H.div {} [H.text text'])
where
...
...
src/Gargantext/Components/GraphExplorer/Topbar/Search.purs
View file @
43a489dd
...
...
@@ -66,6 +66,8 @@ nodeSearchControlCpt = here.component "nodeSearchControl" cpt
, onEnterPress: doSearch
, classes: "filter-results-completions rounded-circle-2 text-small py-0"
, state: search
, pattern: ".*"
, title: ""
, placeholder: "find and select a term here..."
}
,
...
...
src/Gargantext/Components/InputWithAutocomplete.purs
View file @
43a489dd
...
...
@@ -7,6 +7,7 @@ import DOM.Simple as DOM
import DOM.Simple.Event as DE
import Data.Maybe (Maybe(..), maybe)
import Data.Nullable (Nullable, null, toMaybe)
import Data.String as S
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import FFI.Simple ((..))
...
...
@@ -31,6 +32,8 @@ type Props =
, onAutocompleteClick :: String -> Effect Unit
, onEnterPress :: String -> Effect Unit
, placeholder :: String
, pattern :: String
, title :: String
, state :: T.Box String
)
...
...
@@ -44,6 +47,8 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
, onAutocompleteClick
, onEnterPress
, placeholder
, pattern
, title
, state } _ = do
-- States
state' <- T.useLive T.unequal state
...
...
@@ -68,6 +73,8 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
, ref: inputRef
, className: "form-control"
, value: state'
, pattern: pattern
, title: title
, placeholder
, on: { focus: onFocus completions state'
, input: onInput completions
...
...
@@ -114,7 +121,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
onInput :: forall event. T.Box Completions -> event -> Effect Unit
onInput completions e = do
let val = R.unsafeEventValue e
let val =
S.trim $
R.unsafeEventValue e
T.write_ val state
cs <- autocompleteSearch val
T.write_ cs completions
...
...
@@ -145,6 +152,8 @@ type Props' =
, boxAction :: String -> Action
, state :: T.Box String
, text :: T.Box String
, pattern :: String
, title :: String
, placeholder :: String
)
...
...
@@ -160,6 +169,8 @@ inputWithAutocompleteCpt' = here.component "inputWithAutocomplete" cpt
, boxAction
, state
, text
, pattern
, title
, placeholder } _ = do
-- States
state' <- T.useLive T.unequal state
...
...
@@ -184,6 +195,8 @@ inputWithAutocompleteCpt' = here.component "inputWithAutocomplete" cpt
, ref: inputRef
, className: "form-control"
, value: state'
, pattern: pattern
, title: title
, placeholder
, on: { focus: onFocus completions state'
, input: onInput completions
...
...
@@ -246,7 +259,7 @@ inputWithAutocompleteCpt' = here.component "inputWithAutocomplete" cpt
if DE.key e == "Enter" then do
R2.preventDefault e
R2.stopPropagation e
let val = R.unsafeEventValue e
let val =
S.trim $
R.unsafeEventValue e
let mInput = toMaybe $ R.readRef inputRef
T.write_ val state
launchAff_ $ dispatch (boxAction val)
...
...
@@ -260,7 +273,7 @@ inputWithAutocompleteCpt' = here.component "inputWithAutocomplete" cpt
pure $ false
submit val _ = do
T.write_ ("Invited " <> val <> " to the team") text
T.write_ ("Invited " <>
S.trim
val <> " to the team") text
launchAff_ $ dispatch (boxAction val)
---------------------------------------------------------
...
...
src/Gargantext/Components/PhyloExplorer/Topbar/TopBar.purs
View file @
43a489dd
...
...
@@ -147,6 +147,8 @@ component = here.component "main" cpt where
Nothing -> pure unit
Just h -> autocompleteClickCallback h
, classes: "filter-results-completions rounded-circle-2 text-small py-0"
, pattern: ".*"
, title: ""
, placeholder: "find and select a term here..."
, state: searchState
}
...
...
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