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()`.
This commit is contained in:
Maxime Quandalle 2015-10-23 16:56:55 +02:00
parent b3696e1e3b
commit 31b60d82fc
12 changed files with 50 additions and 48 deletions

View file

@ -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,

View file

@ -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);
}

View file

@ -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,
});

View file

@ -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());
}

View file

@ -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,

View file

@ -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());
}
},

View file

@ -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) {

View file

@ -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,