Focused state for custom checkbox (Closes #604)

This commit is contained in:
RainLoop Team 2015-04-25 17:50:10 +04:00
parent 48b91fb957
commit a11dcbed4b
25 changed files with 209 additions and 65 deletions

View file

@ -284,14 +284,17 @@
ko.components.register('x-script', require('Component/Script'));
if (Settings.settingsGet('MaterialDesign') && Globals.bAnimationSupported)
if (/**false && /**/Settings.settingsGet('MaterialDesign') && Globals.bAnimationSupported)
{
ko.components.register('Checkbox', require('Component/MaterialDesign/Checkbox'));
ko.components.register('CheckboxSimple', require('Component/Checkbox'));
}
else
{
// ko.components.register('Checkbox', require('Component/Classic/Checkbox'));
// ko.components.register('CheckboxSimple', require('Component/Classic/Checkbox'));
ko.components.register('Checkbox', require('Component/Checkbox'));
ko.components.register('CheckboxSimple', require('Component/Checkbox'));
}
Translator.initOnStartOrLangChange(Translator.initNotificationLanguage, Translator);

View file

@ -48,6 +48,7 @@
this.inverted = Utils.isUnd(oParams.inverted) ? false : !!oParams.inverted;
this.labeled = !Utils.isUnd(oParams.label);
this.labelAnimated = !!oParams.labelAnimated;
}
_.extend(AbstracCheckbox.prototype, AbstractComponent.prototype);
@ -59,6 +60,13 @@
}
};
AbstracCheckbox.prototype.keypress = function() {
if (!this.readOnly && this.enable() && !this.disable())
{
this.value(!this.value());
}
};
AbstracCheckbox.componentExportHelper = AbstractComponent.componentExportHelper;
module.exports = AbstracCheckbox;

27
dev/External/ko.js vendored
View file

@ -317,6 +317,18 @@
}
};
ko.bindingHandlers.keypress = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
$(oElement).on('keypress.koKeyPress', function (oEvent) {
fValueAccessor().call(oViewModel, oEvent);
});
ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () {
$(oElement).off('keypress.koKeyPress');
});
}
};
ko.bindingHandlers.onEnter = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
$(oElement).on('keypress.koOnEnter', function (oEvent) {
@ -333,6 +345,21 @@
}
};
ko.bindingHandlers.onTab = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
$(oElement).on('keydown.koOnTab', function (oEvent) {
if (oEvent && 9 === window.parseInt(oEvent.keyCode, 10))
{
return fValueAccessor().call(oViewModel, !!oEvent.shiftKey);
}
});
ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () {
$(oElement).off('keydown.koOnTab');
});
}
};
ko.bindingHandlers.onEsc = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
$(oElement).on('keypress.koOnEsc', function (oEvent) {

View file

@ -6,8 +6,15 @@
}
.flag-name {
border-bottom: 1px dashed #555;
cursor: pointer;
padding: 2px;
&:focus {
outline: 1px;
outline-style: dotted;
}
}
}

View file

@ -37,13 +37,36 @@
.e-component {
&.e-select {
select:focus {
outline: 1px;
outline-style: dotted;
}
}
&.e-checkbox {
margin-bottom: 6px;
margin-left: -2px;
padding: 2px;
cursor: pointer;
&:focus {
outline: 1px;
outline-style: dotted;
}
.e-checkbox-icon {
padding: 1px 0 0 1px;
}
&.disabled {
cursor: default;
color: #999;
outline: 0;
outline-style: none;
}
}
@ -60,11 +83,12 @@
.e-component.material-design {
margin-top: 2px;
margin-bottom: 6px;
&.e-checkbox {
margin-top: 2px;
padding: 2px 2px 1px 2px;
.sub-checkbox-container {
display: inline-block;
position: relative;

View file

@ -60,7 +60,11 @@
}
}
.signMeLabel, .languageLabel {
.languageLabel {
margin-top: 5px;
}
.signMeLabel .e-checkbox {
margin-top: 5px;
}

View file

@ -22,5 +22,11 @@
.flag-name {
border-bottom: 1px dashed #555;
cursor: pointer;
padding: 2px;
&:focus {
outline: 1px;
outline-style: dotted;
}
}
}

View file

@ -21,6 +21,12 @@
color: #336699;
text-decoration: underline;
cursor: pointer;
padding: 2px;
&:focus {
outline: 1px;
outline-style: dotted;
}
}
.g-ui-min-height-300 {
@ -181,12 +187,21 @@ e-spinner {
}
.e-languages {
margin-top: 8px;
color: #333;
.flag-name {
color: #333;
/*text-decoration: underline;*/
border-bottom: 1px dashed #333;
cursor: pointer;
padding: 2px;
&:focus {
outline: 1px;
outline-style: dotted;
}
}
}

View file

@ -7,7 +7,7 @@ label {
cursor: pointer;
}
label.inline {
label.inline, span.inline {
display: inline-block;
}

View file

@ -8,6 +8,7 @@
ko = require('ko'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
MessageStore = require('Stores/User/Message'),
@ -46,6 +47,19 @@
this.cancelCommand();
});
this.selectedDates = ko.computed(function () {
Translator.trigger();
return [
{'id': -1, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_ALL')},
{'id': 3, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_3_DAYS')},
{'id': 7, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_7_DAYS')},
{'id': 30, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_MONTH')},
{'id': 90, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS')},
{'id': 180, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS')},
{'id': 365, 'name': Translator.i18n('SEARCH/LABEL_ADV_DATE_YEAR')}
];
}, this);
kn.constructorEnd(this);
}

View file

@ -525,7 +525,6 @@
if (window.Dropbox)
{
window.Dropbox.choose({
//'iframe': true,
'success': function(aFiles) {
if (aFiles && aFiles[0] && aFiles[0]['link'])
@ -1436,7 +1435,7 @@
Events.sub('window.resize.real', this.resizerTrigger);
Events.sub('window.resize.real', _.debounce(this.resizerTrigger, 50));
if (this.dropboxEnabled())
if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox)
{
oScript = window.document.createElement('script');
oScript.type = 'text/javascript';

View file

@ -467,6 +467,21 @@
]);
};
LoginUserView.prototype.selectLanguageOnTab = function (bShift)
{
if (!bShift)
{
var self = this;
_.delay(function () {
self.emailFocus(true);
}, 5);
return false;
}
return true;
};
module.exports = LoginUserView;
}());