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
b6c1c4d8
Commit
b6c1c4d8
authored
Dec 04, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UserPage] needs right alignment.
parent
cf0c1d4a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
34 deletions
+48
-34
CONTRIBUTING.md
CONTRIBUTING.md
+3
-0
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+7
-7
Renders.purs
...argantext/Pages/Annuaire/User/Contacts/Specs/Renders.purs
+19
-18
Types.purs
src/Gargantext/Pages/Annuaire/User/Contacts/Types.purs
+19
-9
No files found.
CONTRIBUTING.md
View file @
b6c1c4d8
...
@@ -7,3 +7,6 @@ to rebuild (after a major upgrade) use ./rebuild
...
@@ -7,3 +7,6 @@ to rebuild (after a major upgrade) use ./rebuild
to add a new dependency: psc-package install PACKAGE
to add a new dependency: psc-package install PACKAGE
use git, commit and pull request :)
use git, commit and pull request :)
## Indentation
-
2 spaces
src/Gargantext/Pages/Annuaire.purs
View file @
b6c1c4d8
...
@@ -155,18 +155,18 @@ renderContactCells Nothing = []
...
@@ -155,18 +155,18 @@ renderContactCells Nothing = []
renderContactCells (Just (Contact { id, hyperdata : (HyperdataContact contact@{who: who, ou:ou} ) })) =
renderContactCells (Just (Contact { id, hyperdata : (HyperdataContact contact@{who: who, ou:ou} ) })) =
[ text ""
[ text ""
, a [ href (toUrl Front NodeContact (Just id)) ] [ text $ maybe "name" identity contact.title ]
, a [ href (toUrl Front NodeContact (Just id)) ] [ text $ maybe "name" identity contact.title ]
, text $ maybe "No ContactWhere" renderContactWhereOrg (
join $ head <$>
ou)
, text $ maybe "No ContactWhere" renderContactWhereOrg (
head $
ou)
, text $ maybe "No ContactWhere" renderContactWhereDept (
join $ head <$>
ou)
, text $ maybe "No ContactWhere" renderContactWhereDept (
head $
ou)
, text $ maybe "No ContactWhere" renderContactWhereRole (
join $ head <$>
ou)
, text $ maybe "No ContactWhere" renderContactWhereRole (
head $
ou)
]
]
where
where
maybe' = maybe "" identity
maybe' = maybe "" identity
renderContactWhereOrg (ContactWhere { organization:
Nothing
}) = "No Organization"
renderContactWhereOrg (ContactWhere { organization:
[]
}) = "No Organization"
renderContactWhereOrg (ContactWhere { organization:
Just
orga }) =
renderContactWhereOrg (ContactWhere { organization: orga }) =
maybe "No orga (list)" identity (head orga)
maybe "No orga (list)" identity (head orga)
renderContactWhereDept (ContactWhere { labTeamDepts :
Nothing
}) = "Empty Dept"
renderContactWhereDept (ContactWhere { labTeamDepts :
[]
}) = "Empty Dept"
renderContactWhereDept (ContactWhere { labTeamDepts :
Just
dept }) =
renderContactWhereDept (ContactWhere { labTeamDepts : dept }) =
maybe "No Dept (list)" identity (head dept)
maybe "No Dept (list)" identity (head dept)
renderContactWhereRole (ContactWhere { role: Nothing }) = "Empty Role"
renderContactWhereRole (ContactWhere { role: Nothing }) = "Empty Role"
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Specs/Renders.purs
View file @
b6c1c4d8
...
@@ -5,7 +5,9 @@ import Gargantext.Pages.Annuaire.User.Contacts.Types
...
@@ -5,7 +5,9 @@ import Gargantext.Pages.Annuaire.User.Contacts.Types
import Data.List (List, zipWith, catMaybes, toUnfoldable)
import Data.List (List, zipWith, catMaybes, toUnfoldable)
import Data.Map (Map, empty, keys, values, lookup)
import Data.Map (Map, empty, keys, values, lookup)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Array (head)
import Data.Semigroup ((<>))
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Set (toUnfoldable) as S
import Data.Set (toUnfoldable) as S
import Data.Tuple (Tuple(..), uncurry)
import Data.Tuple (Tuple(..), uncurry)
import Data.Unfoldable (class Unfoldable)
import Data.Unfoldable (class Unfoldable)
...
@@ -63,30 +65,29 @@ getFirstName' = fromMaybe "no first name" <<< _.firstName <<< unwrap
...
@@ -63,30 +65,29 @@ getFirstName' = fromMaybe "no first name" <<< _.firstName <<< unwrap
getLastName obj = fromMaybe "no title" $ getLastName' <$> obj
getLastName obj = fromMaybe "no title" $ getLastName' <$> obj
getLastName' = fromMaybe "no last name" <<< _.lastName <<< unwrap
getLastName' = fromMaybe "no last name" <<< _.lastName <<< unwrap
getRole obj = joinWith ", " $ getRole' <$>
(fromMaybe [] obj)
getRole obj = joinWith ", " $ getRole' <$>
obj
getRole' = fromMaybe "no role" <<< _.role <<< unwrap
getRole' = fromMaybe "no role" <<< _.role <<< unwrap
-- getTouch :: Maybe (Array ContactWhere) -> Array ContactTouch
getTouch :: Array ContactWhere -> Maybe ContactTouch
-- getTouch obj = (_.touch <<< unwrap) <$>
getTouch = maybe Nothing (\(ContactWhere {touch:x}) -> x) <<< head
-- where
-- ary = fromMaybe [] obj
-- getPhone :: Maybe (Array ContactWhere) -> String
getPhone :: Array ContactWhere -> String
-- getPhone obj = fromMaybe "" $ getPhone' <$> (getTouch obj)
getPhone obj = fromMaybe "" $ getPhone' <$> (getTouch obj)
getPhone' :: ContactTouch -> String
getPhone' = fromMaybe "no phone" <<< _.phone <<< unwrap
-- getPhone' :: ContactTouch -> String
getMail :: Array ContactWhere -> String
-- getPhone' = fromMaybe "no phone" <<< _.phone <<< unwrap
getMail obj = fromMaybe "" $ getMail' <$> (getTouch obj)
getMail' :: ContactTouch -> String
-- getMail obj = fromMaybe "" $ getMail' <$> (getTouch obj)
getMail' = fromMaybe "no mail" <<< _.mail <<< unwrap
-- getMail' = fromMaybe "no mail" <<< _.mail <<< unwrap
contactInfos :: HyperdataContact -> Array ReactElement
contactInfos :: HyperdataContact -> Array ReactElement
contactInfos (HyperdataContact {who:who, ou:ou}) =
contactInfos (HyperdataContact {who:who, ou:ou}) =
[ ul [className "list-group"] (infoRender (Tuple "Last Name" $
getLastName
who))
[ ul [className "list-group"] (infoRender (Tuple "Last Name" $
" " <> getLastName
who))
, ul [className "list-group"] (infoRender (Tuple "First name" $ getFirstName who))
, ul [className "list-group"] (infoRender (Tuple "First name" $
" " <>
getFirstName who))
, ul [className "list-group"] (infoRender (Tuple "Role"
$ getRole ou
))
, ul [className "list-group"] (infoRender (Tuple "Role"
$ " " <> getRole ou
))
-- , ul [className "list-group"] (infoRender (Tuple "Phone" $ getPhone "Phone" ou
))
, ul [className "list-group"] (infoRender (Tuple "Phone" $ " " <> getPhone ou
))
-- , ul [className "list-group"] (infoRender (Tuple "Mail" $ getMail "Mail"
))
, ul [className "list-group"] (infoRender (Tuple "Mail" $ " " <> getMail ou
))
]
]
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Types.purs
View file @
b6c1c4d8
...
@@ -5,7 +5,7 @@ import Prelude
...
@@ -5,7 +5,7 @@ import Prelude
import Data.Argonaut (class DecodeJson, decodeJson, (.?), (.??))
import Data.Argonaut (class DecodeJson, decodeJson, (.?), (.??))
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Lens (Lens', Prism', lens, prism)
import Data.Lens (Lens', Prism', lens, prism)
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe
, fromMaybe
)
import Data.Map (Map(..))
import Data.Map (Map(..))
import React (ReactElement)
import React (ReactElement)
...
@@ -31,8 +31,8 @@ newtype ContactWho =
...
@@ -31,8 +31,8 @@ newtype ContactWho =
ContactWho { idWho :: Maybe String
ContactWho { idWho :: Maybe String
, firstName :: Maybe String
, firstName :: Maybe String
, lastName :: Maybe String
, lastName :: Maybe String
, keywords ::
Maybe
(Array String)
, keywords :: (Array String)
, freetags ::
Maybe
(Array String)
, freetags :: (Array String)
}
}
derive instance newtypeContactWho :: Newtype ContactWho _
derive instance newtypeContactWho :: Newtype ContactWho _
...
@@ -46,11 +46,15 @@ instance decodeContactWho :: DecodeJson ContactWho
...
@@ -46,11 +46,15 @@ instance decodeContactWho :: DecodeJson ContactWho
lastName <- obj .?? "lastName"
lastName <- obj .?? "lastName"
keywords <- obj .?? "keywords"
keywords <- obj .?? "keywords"
freetags <- obj .?? "freetags"
freetags <- obj .?? "freetags"
pure $ ContactWho {idWho, firstName, lastName, keywords, freetags}
let k = fromMaybe [] keywords
let f = fromMaybe [] freetags
pure $ ContactWho {idWho, firstName, lastName, keywords:k, freetags:f}
newtype ContactWhere =
newtype ContactWhere =
ContactWhere { organization ::
Maybe
(Array String)
ContactWhere { organization :: (Array String)
, labTeamDepts ::
Maybe
(Array String)
, labTeamDepts :: (Array String)
, role :: Maybe String
, role :: Maybe String
...
@@ -78,7 +82,11 @@ instance decodeContactWhere :: DecodeJson ContactWhere
...
@@ -78,7 +82,11 @@ instance decodeContactWhere :: DecodeJson ContactWhere
touch <- obj .?? "touch"
touch <- obj .?? "touch"
entry <- obj .?? "entry"
entry <- obj .?? "entry"
exit <- obj .?? "exit"
exit <- obj .?? "exit"
pure $ ContactWhere {organization, labTeamDepts, role, office, country, city, touch, entry, exit}
let o = fromMaybe [] organization
let l = fromMaybe [] labTeamDepts
pure $ ContactWhere {organization:o, labTeamDepts:l, role, office, country, city, touch, entry, exit}
newtype ContactTouch =
newtype ContactTouch =
ContactTouch { mail :: Maybe String
ContactTouch { mail :: Maybe String
...
@@ -100,7 +108,7 @@ instance decodeContactTouch :: DecodeJson ContactTouch
...
@@ -100,7 +108,7 @@ instance decodeContactTouch :: DecodeJson ContactTouch
newtype HyperdataContact =
newtype HyperdataContact =
HyperdataContact { bdd :: Maybe String
HyperdataContact { bdd :: Maybe String
, who :: Maybe ContactWho
, who :: Maybe ContactWho
, ou ::
Maybe
(Array ContactWhere)
, ou :: (Array ContactWhere)
, title :: Maybe String
, title :: Maybe String
, source :: Maybe String
, source :: Maybe String
, lastValidation :: Maybe String
, lastValidation :: Maybe String
...
@@ -122,7 +130,9 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
...
@@ -122,7 +130,9 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
uniqId <- obj .?? "uniqId"
uniqId <- obj .?? "uniqId"
uniqIdBdd <- obj .?? "uniqIdBdd"
uniqIdBdd <- obj .?? "uniqIdBdd"
pure $ HyperdataContact {bdd, who, ou, title, source, lastValidation, uniqId, uniqIdBdd}
let ou' = fromMaybe [] ou
pure $ HyperdataContact {bdd, who, ou:ou', title, source, lastValidation, uniqId, uniqIdBdd}
newtype HyperData c s =
newtype HyperData c s =
...
...
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