mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2025-10-30 02:47:36 +01:00
Improved tag handling
Now tag counting reflects whether archived cards are shown or not. Also available the option to select all untagged cards, with matching counter. Card deletion is now broken, while I found a way to handle the confirmation dialog (see DialogBox component)
This commit is contained in:
@@ -63,8 +63,10 @@ Clipperz.PM.UI.Components.CardToolbar = React.createClass({
|
||||
|
||||
renderWithoutSidePanels: function () {
|
||||
var result;
|
||||
|
||||
|
||||
if (this.props['filter']) {
|
||||
//console.log("CARD TOOLBAR", this.props['filter']['type']);
|
||||
|
||||
if (this.props['filter']['type'] == 'RECENT') {
|
||||
result = [React.DOM.div({className:'clipperz'}, [React.DOM.span({className:'logo recent'}, "recent")])];
|
||||
} else if (this.props['filter']['type'] == 'TAG') {
|
||||
@@ -72,6 +74,11 @@ Clipperz.PM.UI.Components.CardToolbar = React.createClass({
|
||||
React.DOM.span({className:'logo tag'}, "tag"),
|
||||
React.DOM.span({className:'value'}, this.props['filter']['value'])
|
||||
])];
|
||||
} else if (this.props['filter']['type'] == 'UNTAGGED') {
|
||||
result = [React.DOM.div({className:'clipperz'}, [
|
||||
React.DOM.span({className:'logo tag'}, "tag"),
|
||||
React.DOM.span({className:'value'}, "untagged")
|
||||
])];
|
||||
} else if (this.props['filter']['type'] == 'SEARCH') {
|
||||
result = [React.DOM.div({className:'clipperz'}, [
|
||||
React.DOM.span({className:'logo search'}, "search"),
|
||||
|
||||
@@ -83,7 +83,10 @@ Clipperz.PM.UI.Components.Cards.View = React.createClass({
|
||||
},
|
||||
|
||||
renderTags: function (someTags) {
|
||||
return React.DOM.div({'className':'cardTags'}, MochiKit.Base.map(this.renderTag, someTags));
|
||||
var tags;
|
||||
|
||||
tags = MochiKit.Base.filter(Clipperz.PM.DataModel.Record.isRegularTag, someTags).sort(Clipperz.Base.caseInsensitiveCompare);
|
||||
return React.DOM.div({'className':'cardTags'}, MochiKit.Base.map(this.renderTag, tags));
|
||||
},
|
||||
|
||||
//............................................................................
|
||||
|
||||
51
frontend/delta/js/Clipperz/PM/UI/Components/DialogBox.js
Normal file
51
frontend/delta/js/Clipperz/PM/UI/Components/DialogBox.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2013 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
Clipperz.Base.module('Clipperz.PM.UI.Components');
|
||||
|
||||
Clipperz.PM.UI.Components.DialogBox = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
'level': React.PropTypes.oneOf(['HIDE', 'INFO', 'WARNING', 'ERROR']).isRequired,
|
||||
'message': React.PropTypes.string.isRequired,
|
||||
},
|
||||
|
||||
ask: function (someInfo) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred('DialogBox.ask', {trace:false});
|
||||
deferredResult.addCallback(someInfo.['possibleAnswers']['cancel']['answer']);
|
||||
deferredResult.callback();
|
||||
// deferredResult.cancel();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
|
||||
render: function () {
|
||||
return React.DOM.div({className:'messageBox ' + this.props['level']}, this.props['message']);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
});
|
||||
@@ -53,7 +53,6 @@ Clipperz.PM.UI.Components.Pages.MainPage = React.createClass({
|
||||
'mainPage': true
|
||||
};
|
||||
classes[this.props['style']] = true;
|
||||
//console.log("MainPage.cards", this.props['cards'], this.props['cards'].state());
|
||||
|
||||
return React.DOM.div({className:React.addons.classSet(classes)}, [
|
||||
this.props['style'] != 'extra-wide' ? Clipperz.PM.UI.Components.Panels.SelectionPanel(this.props) : null,
|
||||
|
||||
@@ -171,7 +171,7 @@ Clipperz.PM.UI.Components.Panels.MainPanel = React.createClass({
|
||||
},
|
||||
|
||||
render: function () {
|
||||
//console.log("MainPanel.cards", this.props['cards']);
|
||||
//console.log("MainPanel.cards", this.props['ask']);
|
||||
var classes = {
|
||||
'panel': true,
|
||||
'left': this.props['selectionPanelStatus'] == 'OPEN',
|
||||
|
||||
@@ -36,8 +36,12 @@ Clipperz.PM.UI.Components.Selections = React.createClass({
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectRecentCards');
|
||||
},
|
||||
|
||||
selectUntaggedCards: function (anEvent) {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectUntaggedCards');
|
||||
},
|
||||
|
||||
handleCheckboxChanges: function (anEvent) {
|
||||
if (anEvent.target.checked) {
|
||||
if (!this.props['shouldIncludeArchivedCards']) {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'showArchivedCards');
|
||||
} else {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'hideArchivedCards');
|
||||
@@ -50,14 +54,16 @@ Clipperz.PM.UI.Components.Selections = React.createClass({
|
||||
var archivedCardsCount;
|
||||
|
||||
tagInfo = this.props['tags'] ? this.props['tags'] : {};
|
||||
tags = MochiKit.Base.filter(function (aTag) { return aTag != Clipperz.PM.DataModel.Record.archivedTag}, MochiKit.Base.keys(tagInfo)).sort(Clipperz.Base.caseInsensitiveCompare);
|
||||
|
||||
archivedCardsCount = tagInfo[Clipperz.PM.DataModel.Record.archivedTag] ? tagInfo[Clipperz.PM.DataModel.Record.archivedTag] : 0;
|
||||
tags = MochiKit.Base.filter(Clipperz.PM.DataModel.Record.isRegularTag, MochiKit.Base.keys(tagInfo)).sort(Clipperz.Base.caseInsensitiveCompare);
|
||||
|
||||
// archivedCardsCount = tagInfo[Clipperz.PM.DataModel.Record.archivedTag] ? tagInfo[Clipperz.PM.DataModel.Record.archivedTag] : 0;
|
||||
archivedCardsCount = this.props['archivedCardsCount'];
|
||||
|
||||
return React.DOM.div({'key':'selections', 'id':'selections'}, [
|
||||
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':'recentCards', onClick: this.selectRecent}, "Recent"),
|
||||
React.DOM.li({'className':'untaggedCards', onClick: this.selectUntaggedCards}, "Untagged - " + this.props['untaggedCardsCount'])
|
||||
]),
|
||||
React.DOM.div({'className':'search'}, [
|
||||
React.DOM.form({'className':'searchForm'}, [
|
||||
@@ -66,8 +72,8 @@ Clipperz.PM.UI.Components.Selections = React.createClass({
|
||||
])
|
||||
]),
|
||||
React.DOM.ul({'className':'tagList'}, MochiKit.Base.map(function (aTag) {return Clipperz.PM.UI.Components.TagIndexItem({'label':aTag, 'count':tagInfo[aTag]}); }, tags)),
|
||||
React.DOM.div({'className':'showArchivedCards'}, [
|
||||
React.DOM.input({'type':'checkbox', 'onChange':this.handleCheckboxChanges}),
|
||||
React.DOM.div({'className':'showArchivedCards', 'onClick':this.handleCheckboxChanges}, [
|
||||
React.DOM.input({'type':'checkbox', 'checked':this.props['shouldIncludeArchivedCards'] ? 'checked' : null}),
|
||||
React.DOM.span({'className':'label'}, "Show archived cards"),
|
||||
archivedCardsCount > 0 ? React.DOM.span({'className':'count'}, archivedCardsCount) : null
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user