diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/components/sidebar/sidebar.jade | 9 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 3 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.styl | 1 | ||||
-rw-r--r-- | client/components/sidebar/sidebarFilters.jade | 12 | ||||
-rw-r--r-- | client/components/users/userHeader.jade | 2 | ||||
-rw-r--r-- | client/components/users/userHeader.js | 15 | ||||
-rw-r--r-- | client/lib/filter.js | 25 | ||||
-rw-r--r-- | client/lib/i18n.js | 29 |
8 files changed, 72 insertions, 24 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index 4f5586cb..f3fdd1bc 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -30,10 +30,13 @@ template(name="membersWidget") .board-widget-content each currentBoard.activeMembers +userAvatar(userId=this.userId showStatus=true) - unless isSandstorm - if currentUser.isBoardAdmin - a.member.add-member.js-manage-board-members + if isSandstorm + if currentUser.isBoardMember + a.member.add-member.sandstorm-powerbox-request-identity i.fa.fa-plus + else if currentUser.isBoardAdmin + a.member.add-member.js-manage-board-members + i.fa.fa-plus .clearfix if isInvited hr diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 0af32f8f..f32a27c5 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -163,6 +163,9 @@ Template.membersWidget.helpers({ Template.membersWidget.events({ 'click .js-member': Popup.open('member'), 'click .js-manage-board-members': Popup.open('addMember'), + 'click .sandstorm-powerbox-request-identity'() { + window.sandstormRequestIdentity(); + }, 'click .js-member-invite-accept'() { const boardId = Session.get('currentBoard'); Meteor.user().removeInvite(boardId); diff --git a/client/components/sidebar/sidebar.styl b/client/components/sidebar/sidebar.styl index 9007af59..24abe990 100644 --- a/client/components/sidebar/sidebar.styl +++ b/client/components/sidebar/sidebar.styl @@ -51,6 +51,7 @@ .member, .card-label margin-right: 7px + margin-top: 5px .sidebar-list-item-description flex: 1 diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade index 2b326493..deefde82 100644 --- a/client/components/sidebar/sidebarFilters.jade +++ b/client/components/sidebar/sidebarFilters.jade @@ -5,6 +5,12 @@ template(name="filterSidebar") ul.sidebar-list + li(class="{{#if Filter.labelIds.isSelected undefined}}active{{/if}}") + a.name.js-toggle-label-filter + span.sidebar-list-item-description + {{_ 'filter-no-label'}} + if Filter.labelIds.isSelected undefined + i.fa.fa-check each currentBoard.labels li a.name.js-toggle-label-filter @@ -18,6 +24,12 @@ template(name="filterSidebar") i.fa.fa-check hr ul.sidebar-list + li(class="{{#if Filter.members.isSelected undefined}}active{{/if}}") + a.name.js-toggle-member-filter + span.sidebar-list-item-description + {{_ 'filter-no-member'}} + if Filter.members.isSelected undefined + i.fa.fa-check each currentBoard.activeMembers with getUser userId li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade index a71e7fc7..ce8cf1af 100644 --- a/client/components/users/userHeader.jade +++ b/client/components/users/userHeader.jade @@ -27,6 +27,8 @@ template(name="editProfilePopup") input.js-profile-fullname(type="text" value=profile.fullname autofocus) label | {{_ 'username'}} + span.error.hide.username-taken + | {{_ 'error-username-taken'}} input.js-profile-username(type="text" value=username) label | {{_ 'initials'}} diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index 10fdf699..17d9eb5f 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -26,11 +26,18 @@ Template.editProfilePopup.events({ 'profile.fullname': fullname, 'profile.initials': initials, }}); - // XXX We should report the error to the user. + if (username !== Meteor.user().username) { - Meteor.call('setUsername', username); - } - Popup.back(); + Meteor.call('setUsername', username, function(error) { + const messageElement = tpl.$('.username-taken'); + if (error) { + messageElement.show(); + } else { + messageElement.hide(); + Popup.back(); + } + }); + } else Popup.back(); }, }); 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 a03fb398..34a789e1 100644 --- a/client/lib/i18n.js +++ b/client/lib/i18n.js @@ -2,20 +2,19 @@ // 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; - } else { - language = navigator.language || navigator.userLanguage; - } +Meteor.startup(() => { + Tracker.autorun(() => { + const currentUser = Meteor.user(); + let language; + if (currentUser && currentUser.profile && currentUser.profile.language) { + language = currentUser.profile.language; + } else { + language = navigator.language || navigator.userLanguage; + } - if (language) { - TAPi18n.setLanguage(language); - - // XXX - const shortLanguage = language.split('-')[0]; - T9n.setLanguage(shortLanguage); - } + if (language) { + TAPi18n.setLanguage(language); + T9n.setLanguage(language); + } + }); }); |