diff options
Diffstat (limited to 'client/lib')
-rw-r--r-- | client/lib/escapeActions.js | 2 | ||||
-rw-r--r-- | client/lib/filter.js | 25 | ||||
-rw-r--r-- | client/lib/i18n.js | 37 | ||||
-rw-r--r-- | client/lib/utils.js | 2 |
4 files changed, 43 insertions, 23 deletions
diff --git a/client/lib/escapeActions.js b/client/lib/escapeActions.js index 49b80422..dc6b05b7 100644 --- a/client/lib/escapeActions.js +++ b/client/lib/escapeActions.js @@ -44,7 +44,7 @@ EscapeActions = { executeLowest() { return this._execute({ - multipleAction: false, + multipleActions: false, }); }, diff --git a/client/lib/filter.js b/client/lib/filter.js index 74305284..8129776b 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -63,6 +63,17 @@ class SetFilter { this._dep.depend(); return { $in: this._selectedElements }; } + + _getEmptySelector() { + this._dep.depend(); + let includeEmpty = false; + this._selectedElements.forEach((el) => { + if (el === undefined) { + includeEmpty = true; + } + }); + return includeEmpty ? { $eq: [] } : null; + } } // The global Filter object. @@ -95,16 +106,26 @@ Filter = { return {}; const filterSelector = {}; + const emptySelector = {}; + let includeEmptySelectors = false; this._fields.forEach((fieldName) => { const filter = this[fieldName]; - if (filter._isActive()) + if (filter._isActive()) { filterSelector[fieldName] = filter._getMongoSelector(); + emptySelector[fieldName] = filter._getEmptySelector(); + if (emptySelector[fieldName] !== null) { + includeEmptySelectors = true; + } + } }); const exceptionsSelector = {_id: {$in: this._exceptions}}; this._exceptionsDep.depend(); - return {$or: [filterSelector, exceptionsSelector]}; + if (includeEmptySelectors) + return {$or: [filterSelector, exceptionsSelector, emptySelector]}; + else + return {$or: [filterSelector, exceptionsSelector]}; }, mongoSelector(additionalSelector) { diff --git a/client/lib/i18n.js b/client/lib/i18n.js index e49a0001..4c02211a 100644 --- a/client/lib/i18n.js +++ b/client/lib/i18n.js @@ -2,26 +2,25 @@ // the language reactively. If the user is not connected we use the language // information provided by the browser, and default to english. -Tracker.autorun(() => { - const currentUser = Meteor.user(); - let language; - if (currentUser) { - language = currentUser.profile && currentUser.profile.language; - } - - if (!language) { - if(navigator.languages) { - language = navigator.languages[0]; - } else { - language = navigator.language || navigator.userLanguage; +Meteor.startup(() => { + Tracker.autorun(() => { + const currentUser = Meteor.user(); + let language; + if (currentUser) { + language = currentUser.profile && currentUser.profile.language; } - } - if (language) { - TAPi18n.setLanguage(language); + if (!language) { + if(navigator.languages) { + language = navigator.languages[0]; + } else { + language = navigator.language || navigator.userLanguage; + } + } - // XXX - const shortLanguage = language.split('-')[0]; - T9n.setLanguage(shortLanguage); - } + if (language) { + TAPi18n.setLanguage(language); + T9n.setLanguage(language); + } + }); }); diff --git a/client/lib/utils.js b/client/lib/utils.js index 4f772a60..9a9ff654 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -27,7 +27,7 @@ Utils = { // in fact, what we really care is screen size // large mobile device like iPad or android Pad has a big screen, it should also behave like a desktop // in a small window (even on desktop), Wekan run in compact mode. - // we can easily debug with a small window of desktop broswer. :-) + // we can easily debug with a small window of desktop browser. :-) isMiniScreen() { this.windowResizeDep.depend(); return $(window).width() <= 800; |