Updated preferences handling

This commit is contained in:
Giulio Cesare Solaroli
2015-09-23 13:44:29 +02:00
parent 6ad0024600
commit 376ccf24e9
10 changed files with 68 additions and 85 deletions

View File

@@ -39,6 +39,7 @@ Clipperz.PM.UI.Components.Cards.DetailClass = React.createClass({
result['ask'] = (this.props['style'] == 'narrow') ? this.props['ask'] : null;
result['showGlobalMask'] = this.props['showGlobalMask'];
result['allTags'] = this.props['allTags'];
result['preferences'] = this.props['preferences'];
}
return result;

View File

@@ -533,7 +533,7 @@ console.log("DROP"); //, anEvent);
React.DOM.input({'_className_':'_fieldLabel_', 'onChange':this.handleChange(field, 'setLabel'), 'defaultValue':aField['label'], 'placeholder': "label"}),
]),
React.DOM.div({'className':'fieldValue'}, [
(ref == this.state['passwordGeneratorFieldReference']) ? Clipperz.PM.UI.Components.Cards.PasswordGenerator({'field':aField, 'setValueCallback':this.setValueFromPasswordGenerator(field, fieldValueRef), 'closeClallback':this.closePasswordGenerator}) : null,
(ref == this.state['passwordGeneratorFieldReference']) ? Clipperz.PM.UI.Components.Cards.PasswordGenerator({'field':aField, 'setValueCallback':this.setValueFromPasswordGenerator(field, fieldValueRef), 'closeClallback':this.closePasswordGenerator, 'preferences':this.props['preferences']}) : null,
Clipperz.PM.UI.Components.Cards.TextArea({'className':Clipperz.PM.UI.Components.classNames(cardFieldValueClasses), 'onChange':this.handleChange(field, 'setValue'), 'onKeyDown':this.handleKeyDown(field), 'defaultValue':aField['value'], 'placeholder':(aField['actionType'].toLowerCase() == 'password')?'':"value", 'ref':fieldValueRef}),
])
]),
@@ -608,7 +608,6 @@ console.log("DROP"); //, anEvent);
'edit': true
}
//console.log("RENDER CARD EDIT", this.props['showGlobalMask']);
return React.DOM.div({'className':'editWrapper'}, [
this.props['showGlobalMask'] ? null : React.DOM.div({'className':'mask'}),
React.DOM.div({'className':Clipperz.PM.UI.Components.classNames(classes)},[

View File

@@ -27,25 +27,26 @@ Clipperz.Base.module('Clipperz.PM.UI.Components.Cards');
Clipperz.PM.UI.Components.Cards.PasswordGeneratorClass = React.createClass({
charsetBlocks: {
'chars_AZ': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'chars_az': 'abcdefghijklmnopqrstuvwxyz',
'chars_09': '0123456789',
'chars_space': ' ',
'chars_other': '~`!@#$%^&*()-_=+,.<>/?[]{}\\|:;\'"'
'chars_AZ': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'chars_az': 'abcdefghijklmnopqrstuvwxyz',
'chars_09': '0123456789',
'chars_space': ' ',
'chars_other': '~`!@#$%^&*()-_=+,.<>/?[]{}\\|:;\'"'
},
gradientColors: ['#ff3236', '#e74030', '#cf4e2a', '#b75c24', '#9f6a1e', '#877818', '#6f8612', '#57940c', '#3fa206', '#25ad00', '#25ad00'],
getInitialState: function () {
return {
'length': 24,
'length': this.props['preferences'].getValue('passwordGenerator.length'),
'options': 'closed',
'chars_AZ': true,
'chars_az': true,
'chars_09': true,
'chars_space': false,
'chars_other': true,
'chars_AZ': this.props['preferences'].getValue('passwordGenerator.characters.A-Z'),
'chars_az': this.props['preferences'].getValue('passwordGenerator.characters.a-z'),
'chars_09': this.props['preferences'].getValue('passwordGenerator.characters.0-9'),
'chars_space': this.props['preferences'].getValue('passwordGenerator.characters.space'),
'chars_other': this.props['preferences'].getValue('passwordGenerator.characters.!#?'),
// 'charset': this.props['preferences'].getValue('passwordGenerator.charset'),
'charset': '',
'password': '',
'entropy': 0,
@@ -154,10 +155,6 @@ Clipperz.PM.UI.Components.Cards.PasswordGeneratorClass = React.createClass({
}
},
// isPasswordField: function () {
// return this.props['field']['actionType'] == 'PASSWORD';
// },
componentDidMount: function () {
this.updateCharset();
this.refreshPasswordValue();
@@ -208,7 +205,6 @@ Clipperz.PM.UI.Components.Cards.PasswordGeneratorClass = React.createClass({
React.DOM.div({'className':'button setPasswordValue', 'onClick':this.setPasswordValue}, "set password"),
React.DOM.div({'className':'button generatePassword', 'onClick':this.refreshPasswordValue}, "generate password"),
]),
// React.DOM.div({'className':'button setValue', 'onClick':this.setPasswordValue})
])
])
]);