This repository has been archived by the owner on Jan 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Noëlie Andrieu
committed
Jan 20, 2017
1 parent
557c641
commit 852ff31
Showing
9 changed files
with
155 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,15 +26,61 @@ module.exports = class Contacts extends Backbone.Collection | |
|
||
@reset() if options.reset | ||
|
||
cozy.init { isV2: true } | ||
cozy.defineIndex 'io.cozy.contacts', ['id'] | ||
.then (index) => | ||
cozy.query index, { selector: id: {"$gte": " "} } | ||
.then (result=[]) => | ||
@add result | ||
success result | ||
, (err) => | ||
success null, err | ||
# FIXME: remove this fakeData | ||
# when request will work | ||
n = 'last name;first name;middle name;préfix;suffixe' | ||
datapoints = [] | ||
datapoints.push { | ||
id: "06", | ||
name: "email", | ||
value: "[email protected]", | ||
type: "work" | ||
} | ||
datapoints.push { | ||
id: "05", | ||
name: "email", | ||
value: "[email protected]", | ||
type: "work" | ||
} | ||
datapoints.push { | ||
id: "04", | ||
name: "tel", | ||
value: "0619384462", | ||
type: "main" | ||
} | ||
datapoints.push { | ||
id: "03", | ||
name: "tel", | ||
value: "0619384462", | ||
type: "portable" | ||
} | ||
datapoints.push { | ||
id: "02", | ||
name: "tel", | ||
value: "n0619384462", | ||
type: "work" | ||
} | ||
|
||
|
||
result = [] | ||
result.push { _id: '01', n, datapoints } | ||
result.push { _id: '02', n, datapoints } | ||
result.push { _id: '03', n, datapoints } | ||
result.push { _id: '04', n, datapoints } | ||
result.push { _id: '05', n, datapoints } | ||
# | ||
@add result | ||
success result, @ | ||
|
||
# cozy.init { isV2: true } | ||
# cozy.defineIndex 'io.cozy.contacts', ['id'] | ||
# .then (index) => | ||
# cozy.query index, { selector: id: {"$gte": " "} } | ||
# .then (result=[]) => | ||
# @add result | ||
# success result, @ | ||
# , (err) => | ||
# success null, err | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.