summaryrefslogtreecommitdiffstats
path: root/client/components
diff options
context:
space:
mode:
authorshoetten <simon@hoetten.org>2016-02-11 15:02:26 +0100
committershoetten <simon@hoetten.org>2016-11-22 21:28:47 +0100
commit6064393ad339333f02ce90fa1814ea47c18e78c2 (patch)
tree9f08d345991c819dc664f9b1babf4da1094ac738 /client/components
parentaa5ed6e48466b2ed3dc83696a6e18d7997b1c01e (diff)
downloadwekan-6064393ad339333f02ce90fa1814ea47c18e78c2.tar.gz
wekan-6064393ad339333f02ce90fa1814ea47c18e78c2.tar.bz2
wekan-6064393ad339333f02ce90fa1814ea47c18e78c2.zip
Refactor code based on eslint guidelines.
Diffstat (limited to 'client/components')
-rw-r--r--client/components/cards/cardDate.js58
-rw-r--r--client/components/cards/cardDate.styl2
2 files changed, 32 insertions, 28 deletions
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index 10bc54ff..f7cd502f 100644
--- a/client/components/cards/cardDate.js
+++ b/client/components/cards/cardDate.js
@@ -11,14 +11,14 @@ const EditCardDate = BlazeComponent.extendComponent({
},
onRendered() {
- let $picker = this.$('.js-datepicker').datepicker({
+ const $picker = this.$('.js-datepicker').datepicker({
todayHighlight: true,
todayBtn: 'linked',
- language: TAPi18n.getLanguage()
- }).on('changeDate', function(e) {
- date.value = moment(e.date).format('L');
+ language: TAPi18n.getLanguage(),
+ }).on('changeDate', function(evt) {
+ this.find('#date').value = moment(evt.date).format('L');
this.error.set('');
- time.focus();
+ this.find('#time').focus();
}.bind(this));
if (this.date.get().isValid()) {
@@ -29,10 +29,12 @@ const EditCardDate = BlazeComponent.extendComponent({
showDate() {
if (this.date.get().isValid())
return this.date.get().format('L');
+ return '';
},
showTime() {
if (this.date.get().isValid())
return this.date.get().format('LT');
+ return '';
},
dateFormat() {
return moment.localeData().longDateFormat('L');
@@ -43,17 +45,17 @@ const EditCardDate = BlazeComponent.extendComponent({
events() {
return [{
- 'keyup .js-date-field'(evt) {
+ 'keyup .js-date-field'() {
// parse for localized date format in strict mode
- const dateMoment = moment(date.value, 'L', true);
+ const dateMoment = moment(this.find('#date').value, 'L', true);
if (dateMoment.isValid()) {
this.error.set('');
this.$('.js-datepicker').datepicker('update', dateMoment.toDate());
}
},
- 'keyup .js-time-field'(evt) {
+ 'keyup .js-time-field'() {
// parse for localized time format in strict mode
- const dateMoment = moment(time.value, 'LT', true);
+ const dateMoment = moment(this.find('#time').value, 'LT', true);
if (dateMoment.isValid()) {
this.error.set('');
}
@@ -62,9 +64,9 @@ const EditCardDate = BlazeComponent.extendComponent({
evt.preventDefault();
// if no time was given, init with 12:00
- var time = evt.target.time.value || moment(new Date().setHours(12,0,0)).format('LT');
-
- const dateString = evt.target.date.value + ' ' + time;
+ const time = evt.target.time.value || moment(new Date().setHours(12, 0, 0)).format('LT');
+
+ const dateString = `${evt.target.date.value} ${time}`;
const newDate = moment(dateString, 'L LT', true);
if (newDate.isValid()) {
this._storeDate(newDate.toDate());
@@ -87,7 +89,7 @@ const EditCardDate = BlazeComponent.extendComponent({
// editCardStartDatePopup
(class extends EditCardDate {
onCreated() {
- super();
+ super.onCreated();
this.data().startAt && this.date.set(moment(this.data().startAt));
}
@@ -103,12 +105,12 @@ const EditCardDate = BlazeComponent.extendComponent({
// editCardDueDatePopup
(class extends EditCardDate {
onCreated() {
- super();
+ super.onCreated();
this.data().dueAt && this.date.set(moment(this.data().dueAt));
}
onRendered() {
- super();
+ super.onRendered();
if (moment.isDate(this.card.startAt)) {
this.$('.js-datepicker').datepicker('setStartDate', this.card.startAt);
}
@@ -131,7 +133,7 @@ const CardDate = BlazeComponent.extendComponent({
},
onCreated() {
- let self = this;
+ const self = this;
self.date = ReactiveVar();
self.now = ReactiveVar(moment());
Meteor.setInterval(() => {
@@ -144,7 +146,7 @@ const CardDate = BlazeComponent.extendComponent({
// is updated to at least moment.js 2.10.5
// until then, the date is displayed in the "L" format
return this.date.get().calendar(null, {
- sameElse: 'llll'
+ sameElse: 'llll',
});
},
@@ -155,10 +157,10 @@ const CardDate = BlazeComponent.extendComponent({
class CardStartDate extends CardDate {
onCreated() {
- super();
- let self = this;
- this.autorun(() => {
- self.date.set(moment(this.data().startAt));
+ super.onCreated();
+ const self = this;
+ self.autorun(() => {
+ self.date.set(moment(self.data().startAt));
});
}
@@ -167,10 +169,11 @@ class CardStartDate extends CardDate {
this.now.get().isBefore(this.data().dueAt)) {
return 'current';
}
+ return '';
}
showTitle() {
- return TAPi18n.__('card-start-on') + ' ' + this.date.get().format('LLLL');
+ return `${TAPi18n.__('card-start-on')} ${this.date.get().format('LLLL')}`;
}
events() {
@@ -183,10 +186,10 @@ CardStartDate.register('cardStartDate');
class CardDueDate extends CardDate {
onCreated() {
- super();
- let self = this;
- this.autorun(() => {
- self.date.set(moment(this.data().dueAt));
+ super.onCreated();
+ const self = this;
+ self.autorun(() => {
+ self.date.set(moment(self.data().dueAt));
});
}
@@ -197,10 +200,11 @@ class CardDueDate extends CardDate {
return 'due';
else if (this.now.get().diff(this.date.get(), 'days') >= -1)
return 'almost-due';
+ return '';
}
showTitle() {
- return TAPi18n.__('card-due-on') + ' ' + this.date.get().format('LLLL');
+ return `${TAPi18n.__('card-due-on')} ${this.date.get().format('LLLL')}`;
}
events() {
diff --git a/client/components/cards/cardDate.styl b/client/components/cards/cardDate.styl
index 51acdaab..1631baa5 100644
--- a/client/components/cards/cardDate.styl
+++ b/client/components/cards/cardDate.styl
@@ -20,7 +20,7 @@
.card-date
display: block
border-radius: 4px
- padding: 1px 3px;
+ padding: 1px 3px
background-color: #dbdbdb
&:hover, &.is-active