Commit e755e9e3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FOREST] Search fix.

parent fbd2a276
......@@ -76,7 +76,6 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps
, if isExternal s.datafield
then databaseInput search props.databases
else div {} []
, H.text $ show s.datafield
, if isHAL s.datafield
then orgInput search allOrgs
else div {} []
......@@ -221,6 +220,29 @@ dataFieldNav ({datafield} /\ setSearch) datafields =
------------------------------------------------------------------------
databaseNav :: R.State Search
-> Array Database
-> R.Element
databaseNav ({datafield} /\ setSearch) dbs =
R.fragment [ div {className: "text-primary center"} [text "with DataField"]
, div { className: "nav nav-tabs"} (liItem <$> dbs)
, div {className:"center"} [ text $ maybe "" doc db ]
]
where
db = case datafield of
(Just (External (Just x))) -> Just x
_ -> Nothing
liItem :: Database -> R.Element
liItem df' =
div { className : "nav-item nav-link" <> if (Just $ External $ Just df') == datafield then " active" else ""
, on: { click: \_ -> setSearch $ _ { datafield = Just $ External $ Just df' } }
} [ text (show df') ]
databaseInput :: R.State Search
-> Array Database
-> R.Element
......
......@@ -71,8 +71,8 @@ data DataField = Gargantext
| Files
instance showDataField :: Show DataField where
show Gargantext = "Interne"
show (External x) = "Externe " <> show x
show Gargantext = "Gargantext"
show (External x) = "External" -- <> show x
show Web = "Web"
show Files = "Files"
......@@ -83,12 +83,15 @@ instance docDataField :: Doc DataField where
doc Files = "Zip files with formats.."
-- derive instance eqDataField :: Eq DataField
derive instance eqDataField :: Eq DataField
{-
instance eqDataField :: Eq DataField where
eq Gargantext Gargantext = true
eq (External _) (External _) = true
eq Web Web = true
eq _ _ = false
-}
------------------------------------------------------------------------
-- | Database search specifications
......@@ -141,7 +144,6 @@ readDatabase _ = Nothing
derive instance eqDatabase :: Eq Database
instance encodeJsonDatabase :: EncodeJson Database where
encodeJson a = encodeJson (show a)
------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment