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
f2addfc7
Commit
f2addfc7
authored
Nov 07, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FOREST] Search form, removing mkEffectFn1
parent
a417fb7f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
SearchField.purs
src/Gargantext/Components/Search/SearchField.purs
+28
-28
No files found.
src/Gargantext/Components/Search/SearchField.purs
View file @
f2addfc7
...
...
@@ -7,7 +7,6 @@ import Data.Set as Set
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Gargantext.Utils.Reactix as R2
import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..))
import Reactix as R
import Reactix.DOM.HTML (text, button, div, input, span, ul, li, a, option, text)
...
...
@@ -79,8 +78,7 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
[ ul {} $ map ( \org' -> li {}
[ input { type: "checkbox"
, checked: isInFilters org' curFilters
, on: {click: mkEffectFn1
$ \_ -> setFilters
, on: {change: \_ -> setFilters
$ const
$ updateFilter org' curFilters
}
...
...
@@ -121,7 +119,13 @@ updateFilter org (Just (HAL_IMT { imtOrgs})) =
}
where
imtOrgs' = if Set.member org imtOrgs
then Set.delete org imtOrgs
then
if org == All_IMT
then Set.empty
else Set.delete org imtOrgs
else
if org == All_IMT
then Set.fromFoldable allIMTorgs
else Set.insert org imtOrgs
updateFilter org _ = Just $ HAL_IMT { imtOrgs: imtOrgs', structIds: Set.empty}
...
...
@@ -141,8 +145,8 @@ databaseInput (db /\ setDB) (_ /\ setFilters) (_ /\ setOrg) dbs =
$ const
$ readDatabase
$ e .. "target" .. "value")
*> (setFilters $ const Nothing)
*> (setOrg $ const Nothing)
*> (setFilters $ const Nothing)
}
} (liItem <$> dbs)
]
...
...
@@ -156,11 +160,11 @@ langInput (lang /\ setLang) langs =
div { className: "form-group" }
[ text "with lang"
, R2.select { className: "form-control"
, onChange: mkEffectFn1
$ \e -> setLang
, on: { change: \e -> setLang
$ const
$ readLang
$ e .. "target" .. "value"
}
} (liItem <$> langs)
]
where
...
...
@@ -172,11 +176,11 @@ orgInput (org /\ setOrg) orgs =
div { className: "form-group" }
[ text "filter with organization: "
, R2.select { className: "form-control"
, onChange: mkEffectFn1
$ \e -> setOrg
, on: { change: \e -> setOrg
$ const
$ readOrg
$ e .. "target" .. "value"
}
} (liItem <$> orgs)
]
where
...
...
@@ -188,8 +192,8 @@ filterInput (term /\ setTerm) =
div {className: ""} [ input { defaultValue: term
, className: "form-control"
, type: "text"
, on
Change: mkEffectFn1 $ \e -> setTerm $ const $ e .. "target" .. "value"
, place
H
older : "Filter with struct_Ids as integer" }
, on
: { change: \e -> setTerm $ const $ e .. "target" .. "value"}
, place
h
older : "Filter with struct_Ids as integer" }
]
...
...
@@ -199,13 +203,9 @@ searchInput (term /\ setTerm) =
[ input { defaultValue: term
, className: "form-control"
, type: "text"
, on
Change
, place
H
older: "Your Query here" }
, on
: { change : \e -> setTerm $ const $ e .. "target" .. "value" }
, place
n
older: "Your Query here" }
]
where
onChange = mkEffectFn1 $ \e -> setTerm
$ const
$ e .. "target" .. "value"
submitButton :: R.State (Maybe Database)
...
...
@@ -219,11 +219,11 @@ submitButton (database /\ _) (term /\ _) (lang /\ _) (org/\_) (filters /\ _) (_
R.fragment [ div { className : "" } []
, button { className: "btn btn-primary text-center"
, type: "button"
, on
Click: click
, on
: {change: click}
} [ text "Search" ]
]
where
click =
mkEffectFn1 $
\_ -> do
click = \_ -> do
case term of
"" -> setSearch $ const Nothing
_ -> setSearch $ const $ Just { database, lang, filters, term, org}
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