mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2024-11-13 09:49:02 +01:00
Added explicit count for all cards
This commit is contained in:
parent
782d7102c9
commit
6c021b5772
@ -75,7 +75,7 @@ Clipperz.PM.UI.Components.Selections = React.createClass({
|
||||
var filterType;
|
||||
var filterValue;
|
||||
|
||||
//console.log("SELECTIONS PROPS", this.props);
|
||||
console.log("SELECTIONS PROPS", this.props);
|
||||
tagInfo = this.props['tags'] ? this.props['tags'] : {};
|
||||
tags = MochiKit.Base.filter(Clipperz.PM.DataModel.Record.isRegularTag, MochiKit.Base.keys(tagInfo)).sort(Clipperz.Base.caseInsensitiveCompare);
|
||||
archivedCardsCount = this.props['archivedCardsCount'];
|
||||
@ -86,10 +86,19 @@ Clipperz.PM.UI.Components.Selections = React.createClass({
|
||||
|
||||
return React.DOM.div({'key':'selections', 'id':'selections', 'className':filterType}, [
|
||||
React.DOM.ul({'className':'defaultSet'}, [
|
||||
React.DOM.li({'className':'allCards', 'onClick': this.selectAll}, "All"),
|
||||
React.DOM.li({'className':'recentCards', 'onClick': this.selectRecent}, "Recent"),
|
||||
React.DOM.li({'className':'allCards', 'onClick': this.selectAll}, [
|
||||
"All",
|
||||
React.DOM.span({'className':'count'}, this.props['allCardsCount'])
|
||||
]),
|
||||
React.DOM.li({'className':'recentCards', 'onClick': this.selectRecent}, [
|
||||
"Recent",
|
||||
React.DOM.span({'className':'count'}, "10")
|
||||
]),
|
||||
// React.DOM.li({'className':'untaggedCards', 'onClick': this.selectUntaggedCards}, "Untagged - " + this.props['untaggedCardsCount'])
|
||||
React.DOM.li({'className':'untaggedCards', 'onClick': this.selectUntaggedCards}, "Untagged")
|
||||
React.DOM.li({'className':'untaggedCards', 'onClick': this.selectUntaggedCards}, [
|
||||
"Untagged",
|
||||
React.DOM.span({'className':'count'}, this.props['untaggedCardsCount'])
|
||||
])
|
||||
]),
|
||||
React.DOM.div({'className':'search'}, [
|
||||
React.DOM.form({'className':'searchForm'}, [
|
||||
|
@ -590,7 +590,7 @@ console.log("THE BROWSER IS OFFLINE");
|
||||
} else if (aFilter['type'] == 'RECENT') {
|
||||
filterCriteria = MochiKit.Base.operator.truth;
|
||||
sortCriteria = Clipperz.Base.reverseComparator(MochiKit.Base.keyComparator('accessDate'));
|
||||
rangeFilter = function (someCards) { return someCards.slice(0, 9)};
|
||||
rangeFilter = function (someCards) { return someCards.slice(0, 10)};
|
||||
} else if (aFilter['type'] == 'SEARCH') {
|
||||
filterCriteria = this.regExpFilterGenerator(Clipperz.PM.DataModel.Record.regExpForSearch(aFilter['value']));
|
||||
sortCriteria = Clipperz.Base.caseInsensitiveKeyComparator('label');
|
||||
@ -666,6 +666,20 @@ console.log("THE BROWSER IS OFFLINE");
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
getAllCardsCount: function () {
|
||||
var archivedCardsFilter = this.shouldIncludeArchivedCards()
|
||||
? MochiKit.Async.succeed
|
||||
: MochiKit.Base.partial(MochiKit.Base.filter, function (someRecordInfo) { return ! someRecordInfo['_isArchived']; });
|
||||
|
||||
return Clipperz.Async.callbacks("MainController.getUntaggedCardsCount", [
|
||||
MochiKit.Base.method(this.user(), 'getRecords'),
|
||||
MochiKit.Base.partial(MochiKit.Base.map, Clipperz.Async.collectResults("collectResults", {'_fullLabel':MochiKit.Base.methodcaller('fullLabel'), '_isArchived':MochiKit.Base.methodcaller('isArchived')}, {trace:false})),
|
||||
Clipperz.Async.collectAll,
|
||||
archivedCardsFilter,
|
||||
function (someCards) { return someCards.length; },
|
||||
], {trace:false});
|
||||
},
|
||||
|
||||
getArchivedCardsCount: function () {
|
||||
return Clipperz.Async.callbacks("MainController.getArchivedCardsCount", [
|
||||
MochiKit.Base.method(this.user(), 'getRecords'),
|
||||
@ -711,6 +725,8 @@ console.log("THE BROWSER IS OFFLINE");
|
||||
// MochiKit.Base.method(this.user(), 'getTags', this.shouldIncludeArchivedCards()),
|
||||
MochiKit.Base.method(this, 'allTags', this.shouldIncludeArchivedCards()),
|
||||
MochiKit.Base.method(this, 'setPageProperties', 'mainPage', 'tags'),
|
||||
MochiKit.Base.method(this, 'getAllCardsCount'),
|
||||
MochiKit.Base.method(this, 'setPageProperties', 'mainPage', 'allCardsCount'),
|
||||
MochiKit.Base.method(this, 'getArchivedCardsCount'),
|
||||
MochiKit.Base.method(this, 'setPageProperties', 'mainPage', 'archivedCardsCount'),
|
||||
MochiKit.Base.method(this, 'getUntaggedCardsCount'),
|
||||
|
Loading…
Reference in New Issue
Block a user