summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-09-28 14:56:51 +0300
committerLauri Ojansivu <x@xet7.org>2019-09-28 14:56:51 +0300
commit5d6c68a9cfe1e83b884e3884e17d5ed82d6f5b98 (patch)
tree9f2a26c68e81419d469d33693217aa492ec26081 /client
parent75dc5f226cb3261337c9be9614856efc0b40e377 (diff)
parented4c49090abfb35ebadc77b40eee4af05ae15ac1 (diff)
downloadwekan-5d6c68a9cfe1e83b884e3884e17d5ed82d6f5b98.tar.gz
wekan-5d6c68a9cfe1e83b884e3884e17d5ed82d6f5b98.tar.bz2
wekan-5d6c68a9cfe1e83b884e3884e17d5ed82d6f5b98.zip
Merge branch 'master' of github.com:wekan/wekan
Diffstat (limited to 'client')
-rw-r--r--client/components/boards/boardBody.js52
-rw-r--r--client/lib/datepicker.js10
2 files changed, 45 insertions, 17 deletions
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js
index 713b6cbc..47042ae7 100644
--- a/client/components/boards/boardBody.js
+++ b/client/components/boards/boardBody.js
@@ -309,26 +309,46 @@ BlazeComponent.extendComponent({
events(start, end, timezone, callback) {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
const events = [];
+ const pushEvent = function(card, title, start, end, extraCls) {
+ start = start || card.startAt;
+ end = end || card.endAt;
+ title = title || card.title;
+ const className =
+ (extraCls ? `${extraCls} ` : '') +
+ (card.color ? `calendar-event-${card.color}` : '');
+ events.push({
+ id: card._id,
+ title,
+ start,
+ end: end || card.endAt,
+ allDay:
+ Math.abs(end.getTime() - start.getTime()) / 1000 === 24 * 3600,
+ url: FlowRouter.url('card', {
+ boardId: currentBoard._id,
+ slug: currentBoard.slug,
+ cardId: card._id,
+ }),
+ className,
+ });
+ };
currentBoard
.cardsInInterval(start.toDate(), end.toDate())
.forEach(function(card) {
- events.push({
- id: card._id,
- title: card.title,
- start: card.startAt,
- end: card.endAt,
- allDay:
- Math.abs(card.endAt.getTime() - card.startAt.getTime()) /
- 1000 ===
- 24 * 3600,
- url: FlowRouter.url('card', {
- boardId: currentBoard._id,
- slug: currentBoard.slug,
- cardId: card._id,
- }),
- className: card.color ? `calendar-event-${card.color}` : null,
- });
+ pushEvent(card);
+ });
+ currentBoard
+ .cardsDueInBetween(start.toDate(), end.toDate())
+ .forEach(function(card) {
+ pushEvent(
+ card,
+ `${card.title} ${TAPi18n.__('card-due')}`,
+ card.dueAt,
+ new Date(card.dueAt.getTime() + 36e5),
+ );
});
+ events.sort(function(first, second) {
+ return first.id > second.id ? 1 : -1;
+ });
callback(events);
},
eventResize(event, delta, revertFunc) {
diff --git a/client/lib/datepicker.js b/client/lib/datepicker.js
index eb5b60b8..da44bbc5 100644
--- a/client/lib/datepicker.js
+++ b/client/lib/datepicker.js
@@ -21,7 +21,15 @@ DatePicker = BlazeComponent.extendComponent({
function(evt) {
this.find('#date').value = moment(evt.date).format('L');
this.error.set('');
- this.find('#time').focus();
+ const timeInput = this.find('#time');
+ timeInput.focus();
+ if (!timeInput.value) {
+ const currentHour = evt.date.getHours();
+ const defaultMoment = moment(
+ currentHour > 0 ? evt.date : '1970-01-01 08:00:00',
+ ); // default to 8:00 am local time
+ timeInput.value = defaultMoment.format('LT');
+ }
}.bind(this),
);