From 31b60d82fcae64a844805a2a76a0af25fb9c16c2 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Fri, 23 Oct 2015 16:56:55 +0200 Subject: Upgrade Meteor to 1.2.1-rc4 This version includes a more complete selection of ES2015 polyfills that I started used across the code base, for instance by replacing `$.trim(str)` by `str.trim()`. --- client/components/activities/activities.js | 4 ++-- client/components/activities/comments.js | 12 +++++++----- client/components/boards/boardBody.js | 6 +++--- client/components/cards/cardDetails.js | 6 +++--- client/components/lists/listBody.js | 6 +++--- client/components/lists/listHeader.js | 6 +++--- client/components/main/editor.js | 8 ++++---- client/components/users/userHeader.js | 6 +++--- 8 files changed, 28 insertions(+), 26 deletions(-) (limited to 'client/components') diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index a491c2e8..64e9865d 100644 --- a/client/components/activities/activities.js +++ b/client/components/activities/activities.js @@ -101,9 +101,9 @@ BlazeComponent.extendComponent({ }, 'submit .js-edit-comment'(evt) { evt.preventDefault(); - const commentText = this.currentComponent().getValue(); + const commentText = this.currentComponent().getValue().trim(); const commentId = Template.parentData().commentId; - if ($.trim(commentText)) { + if (commentText) { CardComments.update(commentId, { $set: { text: commentText, diff --git a/client/components/activities/comments.js b/client/components/activities/comments.js index 08401caa..f9bbcff8 100644 --- a/client/components/activities/comments.js +++ b/client/components/activities/comments.js @@ -23,12 +23,13 @@ BlazeComponent.extendComponent({ commentFormIsOpen.set(true); }, 'submit .js-new-comment-form'(evt) { - const input = this.getInput(); - if ($.trim(input.val())) { + const input = this.getInput() + const text = input.val().trim(); + if (text) { CardComments.insert({ + text, boardId: this.currentData().boardId, cardId: this.currentData()._id, - text: input.val(), }); resetCommentInput(input); Tracker.flush(); @@ -72,8 +73,9 @@ EscapeActions.register('inlinedForm', docId: Session.get('currentCard'), }; const commentInput = $('.js-new-comment-input'); - if ($.trim(commentInput.val())) { - UnsavedEdits.set(draftKey, commentInput.val()); + const draft = commentInput.val().trim(); + if (draft) { + UnsavedEdits.set(draftKey, draft); } else { UnsavedEdits.reset(draftKey); } diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 517e53ba..e7cfc791 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -186,10 +186,10 @@ BlazeComponent.extendComponent({ return [{ submit(evt) { evt.preventDefault(); - const title = this.find('.list-name-input'); - if ($.trim(title.value)) { + const title = this.find('.list-name-input').value.trim(); + if (title) { Lists.insert({ - title: title.value, + title, boardId: Session.get('currentBoard'), sort: $('.list').length, }); diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 2d2679ec..fa818c5a 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -75,8 +75,8 @@ BlazeComponent.extendComponent({ }, 'submit .js-card-details-title'(evt) { evt.preventDefault(); - const title = this.currentComponent().getValue(); - if ($.trim(title)) { + const title = this.currentComponent().getValue().trim(); + if (title) { this.data().setTitle(title); } }, @@ -106,7 +106,7 @@ BlazeComponent.extendComponent({ close(isReset = false) { if (this.isOpen.get() && !isReset) { - const draft = $.trim(this.getValue()); + const draft = this.getValue().trim(); if (draft !== Cards.findOne(Session.get('currentCard')).description) { UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue()); } diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 88b31788..25aeffcc 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -12,7 +12,7 @@ BlazeComponent.extendComponent({ options.position = options.position || 'top'; const forms = this.childrenComponents('inlinedForm'); - let form = _.find(forms, (component) => { + let form = forms.find((component) => { return component.data().position === options.position; }); if (!form && forms.length > 0) { @@ -26,7 +26,7 @@ BlazeComponent.extendComponent({ const firstCardDom = this.find('.js-minicard:first'); const lastCardDom = this.find('.js-minicard:last'); const textarea = $(evt.currentTarget).find('textarea'); - const title = textarea.val(); + const title = textarea.val().trim(); const position = this.currentData().position; let sortIndex; if (position === 'top') { @@ -35,7 +35,7 @@ BlazeComponent.extendComponent({ sortIndex = Utils.calculateIndex(lastCardDom, null).base; } - if ($.trim(title)) { + if (title) { const _id = Cards.insert({ title, listId: this.data()._id, diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index b5df2c81..ab547f02 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -6,9 +6,9 @@ BlazeComponent.extendComponent({ editTitle(evt) { evt.preventDefault(); const newTitle = this.childrenComponents('inlinedForm')[0].getValue(); - const list = this.currentData(); - if ($.trim(newTitle)) { - list.rename(newTitle); + const list = this.currentData().trim(); + if (newTitle) { + list.rename(newTitle.trim()); } }, diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 168c85d0..82fce641 100644 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -8,8 +8,8 @@ Template.editor.onRendered(() => { { match: /\B:([\-+\w]*)$/, search(term, callback) { - callback($.map(Emoji.values, (emoji) => { - return emoji.indexOf(term) === 0 ? emoji : null; + callback(Emoji.values.map((emoji) => { + return emoji.includes(term) ? emoji : null; })); }, template(value) { @@ -28,9 +28,9 @@ Template.editor.onRendered(() => { match: /\B@(\w*)$/, search(term, callback) { const currentBoard = Boards.findOne(Session.get('currentBoard')); - callback($.map(currentBoard.members, (member) => { + callback(currentBoard.members.map((member) => { const username = Users.findOne(member.userId).username; - return username.indexOf(term) === 0 ? username : null; + return username.includes(term) ? username : null; })); }, template(value) { diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index a7382769..7d35c1b9 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -18,9 +18,9 @@ Template.memberMenuPopup.events({ Template.editProfilePopup.events({ submit(evt, tpl) { evt.preventDefault(); - const fullname = $.trim(tpl.find('.js-profile-fullname').value); - const username = $.trim(tpl.find('.js-profile-username').value); - const initials = $.trim(tpl.find('.js-profile-initials').value); + const fullname = tpl.find('.js-profile-fullname').value.trim(); + const username = tpl.find('.js-profile-username').value.trim(); + const initials = tpl.find('.js-profile-initials').value.trim(); Users.update(Meteor.userId(), {$set: { 'profile.fullname': fullname, 'profile.initials': initials, -- cgit v1.2.3-1-g7c22