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
128
Issues
128
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
gargantext
purescript-gargantext
Commits
81fa2009
Commit
81fa2009
authored
Mar 03, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[user] fix changing more than 1 field on user page
parent
29887531
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
Contacts.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
+14
-6
Types.purs
...antext/Components/Nodes/Annuaire/User/Contacts/Types.purs
+1
-1
No files found.
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
View file @
81fa2009
...
...
@@ -13,6 +13,7 @@ import Data.Newtype (unwrap)
import Data.String (joinWith)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Aff (Aff, launchAff_)
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -112,7 +113,8 @@ contactInfoItemCpt = R.hooksComponent "G.C.N.A.U.C.contactInfoItem" cpt
onClick _ = setIsEditing $ const true
item (true /\ setIsEditing) valueRef =
H.span {} [
H.input { className: "form-control"
H.input { autoFocus: true
, className: "form-control"
, defaultValue: R.readRef valueRef
, on: {change: \e -> R.setRef valueRef $ R2.unsafeEventValue e}
, placeholder }
...
...
@@ -145,18 +147,21 @@ userLayoutCpt :: R.Component LayoutProps
userLayoutCpt = R.hooksComponent "G.C.Nodes.Annuaire.User.Contacts.userLayout" cpt
where
cpt {frontends, nodeId, session} _ = do
useLoader nodeId (getContact session) $
reload <- R.useState' 0
useLoader {nodeId, reload: fst reload, session} getContactWithReload $
\contactData@{contactNode: Contact {name, hyperdata}} ->
H.ul { className: "col-md-12 list-group" }
[ display (fromMaybe "no name" name) (contactInfos hyperdata
onUpdateHyperdata
)
[ display (fromMaybe "no name" name) (contactInfos hyperdata
(onUpdateHyperdata reload)
)
, Tabs.tabs {frontends, nodeId, contactData, session} ]
where
onUpdateHyperdata :: HyperdataUser -> Effect Unit
onUpdateHyperdata hd = do
onUpdateHyperdata ::
R.State Int ->
HyperdataUser -> Effect Unit
onUpdateHyperdata
(_ /\ setReload)
hd = do
log2 "[onUpdateHyperdata] hd" hd
launchAff_ $ do
saveContactHyperdata session nodeId hd
_ <- saveContactHyperdata session nodeId hd
liftEffect $ setReload $ (+) 1
-- | toUrl to get data
getContact :: Session -> Int -> Aff ContactData
...
...
@@ -171,6 +176,9 @@ getContact session id = do
-- throwError $ error "Missing default list"
pure {contactNode, defaultListId: 424242}
getContactWithReload :: {nodeId :: Int, reload :: Int, session :: Session} -> Aff ContactData
getContactWithReload {nodeId, session} = getContact session nodeId
saveContactHyperdata :: Session -> Int -> HyperdataUser -> Aff Int
saveContactHyperdata session id h = do
put session (Routes.NodeAPI Node (Just id) "") h
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Types.purs
View file @
81fa2009
...
...
@@ -225,7 +225,7 @@ instance encodeHyperdataContact :: EncodeJson HyperdataContact
encodeJson (HyperdataContact {bdd, lastValidation, ou, source, title, uniqId, uniqIdBdd, who}) =
"bdd" := bdd
~> "lastValidation" := lastValidation
~> "
ou
" := ou
~> "
where
" := ou
~> "source" := source
~> "title" := title
~> "uniqId" := uniqId
...
...
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