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
ef4c4674
Commit
ef4c4674
authored
Nov 08, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SEARCH FORM] Adding Lang in request.
parent
8602174e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
SearchBar.purs
src/Gargantext/Components/Search/SearchBar.purs
+8
-1
SearchField.purs
src/Gargantext/Components/Search/SearchField.purs
+2
-4
Types.purs
src/Gargantext/Components/Search/Types.purs
+2
-1
No files found.
src/Gargantext/Components/Search/SearchBar.purs
View file @
ef4c4674
...
...
@@ -49,6 +49,7 @@ onSearchChange session (search /\ setSearch) =
log2 "Searching db: " $ show q.database
log2 "Searching term: " q.term
log2 "Searching filters: " q.filters
log2 "Searching lang: " q.lang
r <- (performSearch session $ searchQuery q) :: Aff Unit
...
...
@@ -60,7 +61,13 @@ onSearchChange session (search /\ setSearch) =
over SearchQuery (_ {query=term}) defaultSearchQuery
searchQuery {database: Just db, lang, term, filters, node_id} =
over SearchQuery (_ {databases=[db], lang=lang, query=term, filters=filters', node_id=node_id}) defaultSearchQuery
over SearchQuery (_ { databases=[db]
, lang=lang
, query=term
, filters=filters'
, node_id=node_id
}
) defaultSearchQuery
where
filters' = toInt filters
toInt (Just (HAL_StructId {structIds})) = Set.toUnfoldable structIds
...
...
src/Gargantext/Components/Search/SearchField.purs
View file @
ef4c4674
...
...
@@ -62,12 +62,10 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
pure $
div { className: "search-field-group" }
[ searchInput term
, langInput lang props.langs
, div {className: "text-primary center"} [text "in"]
, databaseInput db filters org props.databases
, if curDb /= Just PubMed
then langInput lang props.langs
else div {} []
, if isHAL curDb
then orgInput org allOrgs
...
...
@@ -165,7 +163,7 @@ databaseInput (db /\ setDB) (_ /\ setFilters) (_ /\ setOrg) dbs =
langInput :: R.State (Maybe Lang) -> Array Lang -> R.Element
langInput (lang /\ setLang) langs =
div { className: "form-group" }
[
text "with lang"
[
div {className: "text-primary center"} [text "with lang"]
, R2.select { className: "form-control"
, on: { change: \e -> setLang
$ const
...
...
src/Gargantext/Components/Search/Types.purs
View file @
ef4c4674
...
...
@@ -310,12 +310,13 @@ instance searchQueryToQuery :: ToQuery SearchQuery where
[ QP.keyFromString k /\ Just (QP.valueFromString $ show v) ]
instance encodeJsonSearchQuery :: EncodeJson SearchQuery where
encodeJson (SearchQuery {query, databases, node_id, files_id, filters})
encodeJson (SearchQuery {query, databases, node_id, files_id, filters
, lang
})
= "query" := query
~> "databases" := databases
~> "node_id" := fromMaybe 0 node_id
~> "files_id" := files_id
~> "filters" := filters
~> "lang" := maybe "EN" show lang
~> jsonEmptyObject
...
...
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