From 2102ae8c7a617cfba8f6314547ba781df95d0166 Mon Sep 17 00:00:00 2001 From: ulferts Date: Mon, 10 Feb 2020 16:48:34 +0100 Subject: [PATCH 1/6] no movement on time entry drop By turning the "add entry" events into background events, an event dropped where the "add entry" is already present will no longer be squished to the side before being rendered correctly. It will also prevent dragging and resizing of the add entry events --- .../te-calendar/te-calendar.component.sass | 5 ++++- .../te-calendar/te-calendar.component.ts | 18 +++++++++++++++--- .../my/time_entries_current_user_spec.rb | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass index a7b31d042548..52840a305807 100644 --- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass +++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass @@ -60,7 +60,7 @@ transition: opacity 1s ease background: #EAEAEA - .fc-content + .te-calendar--add-icon color: black width: 100% font-weight: normal @@ -69,6 +69,9 @@ &.-prohibited cursor: not-allowed + .te-calendar--add-icon + display: none + .te-calendar--time-entry .fc-content height: 100% diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts index 00ebdf962b6f..d8e51f0a62dc 100644 --- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts +++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts @@ -44,6 +44,7 @@ interface CalendarMoveEvent { const TIME_ENTRY_CLASS_NAME = 'te-calendar--time-entry'; const DAY_SUM_CLASS_NAME = 'te-calendar--day-sum'; const ADD_ENTRY_CLASS_NAME = 'te-calendar--add-entry'; +const ADD_ICON_CLASS_NAME = 'te-calendar--add-icon'; const ADD_ENTRY_PROHIBITED_CLASS_NAME = '-prohibited'; @Component({ @@ -279,17 +280,15 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI protected addEntry(date:Moment, duration:number) { let classNames = [ADD_ENTRY_CLASS_NAME]; - let title = '+'; if (duration >= 24) { classNames.push(ADD_ENTRY_PROHIBITED_CLASS_NAME); - title = ''; } return { - title: title, start: date.clone().format(), end: date.clone().add(this.maxHour - Math.min(duration * this.scaleRatio, this.maxHour - 1) - 0.5, 'h').format(), + rendering: "background" as 'background', classNames: classNames }; } @@ -406,6 +405,8 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI } private alterEventEntry(event:CalendarViewEvent) { + this.appendAddIcon(event); + if (!event.event.extendedProps.entry) { return; } @@ -415,6 +416,17 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI this.appendFadeout(event); } + private appendAddIcon(event:CalendarViewEvent) { + if (!event.el.classList.contains(ADD_ENTRY_CLASS_NAME)) { + return; + } + + let addIcon = document.createElement('div'); + addIcon.classList.add(ADD_ICON_CLASS_NAME); + addIcon.innerText = '+'; + event.el.append(addIcon); + } + private addTooltip(event:CalendarViewEvent) { if (this.browserDetector.isMobile) { return; diff --git a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb index b9698cf6ab5f..bb2018f6ae9d 100644 --- a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb +++ b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb @@ -167,7 +167,7 @@ # The add time entry event is invisible within entries_area.area do - find(".fc-content-skeleton td:nth-of-type(5) .fc-event-container .te-calendar--add-entry", visible: false).click + find(".fc-content-skeleton td:nth-of-type(5) .te-calendar--add-entry", visible: false).click end expect(page) From 80661be2b8f2fd68467f7f74b1eb36a93b9b374d Mon Sep 17 00:00:00 2001 From: Henriette Dinger Date: Tue, 11 Feb 2020 12:30:52 +0100 Subject: [PATCH 2/6] Remove unnecessary margin which blows up the column and leads to unwanted truncation dots (#32218) --- .../stylesheets/content/work_packages/_table_hierarchy.sass | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/stylesheets/content/work_packages/_table_hierarchy.sass b/app/assets/stylesheets/content/work_packages/_table_hierarchy.sass index de36c663f7fa..518644216630 100644 --- a/app/assets/stylesheets/content/work_packages/_table_hierarchy.sass +++ b/app/assets/stylesheets/content/work_packages/_table_hierarchy.sass @@ -24,7 +24,6 @@ text-align: right display: block float: left - margin-left: 5px padding-right: 8px height: 1rem // width calculation done in js code From 1b2fb689e19c31b5d7eb3aee900010dbfd12fadb Mon Sep 17 00:00:00 2001 From: ulferts Date: Tue, 11 Feb 2020 13:29:52 +0100 Subject: [PATCH 3/6] switch sums to also be bg events --- .../calendar/te-calendar/te-calendar.component.sass | 10 ++++------ .../calendar/te-calendar/te-calendar.component.ts | 12 ++++++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass index 52840a305807..1d9eefc3c3d3 100644 --- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass +++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass @@ -7,7 +7,7 @@ .fc-head display: table-footer-group - .fc-event + .fc-event, .fc-bgevent border-radius: 0 margin-right: 8px margin-left: 8px @@ -39,12 +39,10 @@ background-color: initial color: #000000 text-align: center - font-size: 1em + font-size: 0.875em font-weight: bold - - .fc-title - // as this is the height of the day sum element - line-height: 22px + line-height: 22px + opacity: 1 .te-calendar--add-entry text-align: center diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts index d8e51f0a62dc..e06bc6aa10d6 100644 --- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts +++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts @@ -271,10 +271,11 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI protected sumEntry(date:Moment, duration:number) { return { - title: this.i18n.t('js.units.hour', { count: this.formatNumber(duration) }), start: date.clone().add(this.maxHour - Math.min(duration * this.scaleRatio, this.maxHour - 0.5) - 0.5, 'h').format(), end: date.clone().add(this.maxHour - Math.min(((duration + 0.05) * this.scaleRatio), this.maxHour - 0.5), 'h').format(), - classNames: DAY_SUM_CLASS_NAME + classNames: DAY_SUM_CLASS_NAME, + rendering: 'background' as 'background', + sum: this.i18n.t('js.units.hour', { count: this.formatNumber(duration) }) }; } @@ -406,6 +407,7 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI private alterEventEntry(event:CalendarViewEvent) { this.appendAddIcon(event); + this.appendSum(event); if (!event.event.extendedProps.entry) { return; @@ -427,6 +429,12 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI event.el.append(addIcon); } + private appendSum(event:CalendarViewEvent) { + if (event.event.extendedProps.sum) { + event.el.append(event.event.extendedProps.sum); + } + } + private addTooltip(event:CalendarViewEvent) { if (this.browserDetector.isMobile) { return; From 8fec6e4e8d2f6c38380eab9ea56e698f53bb477a Mon Sep 17 00:00:00 2001 From: ulferts Date: Tue, 11 Feb 2020 13:42:05 +0100 Subject: [PATCH 4/6] show error message on invalid drop --- .../modules/calendar/te-calendar/te-calendar.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts index e06bc6aa10d6..2ba0b495bb3c 100644 --- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts +++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts @@ -5,7 +5,6 @@ import * as moment from "moment"; import { Moment } from 'moment'; import {StateService} from "@uirouter/core"; import {I18nService} from "core-app/modules/common/i18n/i18n.service"; -import {NotificationsService} from "core-app/modules/common/notifications/notifications.service"; import {DomSanitizer} from "@angular/platform-browser"; import timeGrid from '@fullcalendar/timegrid'; import { EventInput, EventApi, Duration, View } from '@fullcalendar/core'; @@ -24,6 +23,7 @@ import {TimeEntryEditService} from "core-app/modules/time_entries/edit/edit.serv import {TimeEntryCreateService} from "core-app/modules/time_entries/create/create.service"; import {ColorsService} from "core-app/modules/common/colors/colors.service"; import {BrowserDetector} from "core-app/modules/common/browser/browser-detector.service"; +import { HalResourceNotificationService } from 'core-app/modules/hal/services/hal-resource-notification.service'; interface CalendarViewEvent { el:HTMLElement; @@ -102,7 +102,7 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI private element:ElementRef, readonly i18n:I18nService, readonly injector:Injector, - readonly notificationsService:NotificationsService, + readonly notifications:HalResourceNotificationService, private sanitizer:DomSanitizer, private configuration:ConfigurationService, private timezone:TimezoneService, @@ -360,7 +360,8 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI .then(event => { this.updateEventSet(event, 'update'); }) - .catch(() => { + .catch((e) => { + this.notifications.handleRawError(e); event.revert(); }); } From c5a8cc84c32221a310513ee0254ebed849d78747 Mon Sep 17 00:00:00 2001 From: ulferts Date: Tue, 11 Feb 2020 13:45:26 +0100 Subject: [PATCH 5/6] avoid unclear date on dragging --- .../app/modules/calendar/te-calendar/te-calendar.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts index 2ba0b495bb3c..583db901a636 100644 --- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts +++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts @@ -352,7 +352,9 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI private moveEvent(event:CalendarMoveEvent) { let entry = event.event.extendedProps.entry; - entry.spentOn = moment(event.event.start!).format('YYYY-MM-DD'); + // Use end instead of start as when dragging, the event might be too long and would thus be start + // on the day before by fullcalendar. + entry.spentOn = moment(event.event.end!).format('YYYY-MM-DD'); this .timeEntryDm From cf60cca544134954c8386629ff019a3f291b3d1c Mon Sep 17 00:00:00 2001 From: ulferts Date: Tue, 11 Feb 2020 13:55:09 +0100 Subject: [PATCH 6/6] use green button on forum --- app/views/forums/index.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index bea83b9e73e3..bd52d4d56fd4 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -30,10 +30,10 @@ See docs/COPYRIGHT.rdoc for more details. <%= toolbar title: t(:label_forum_plural) do %> <% if User.current.allowed_to?(:manage_forums, @project) %>
  • - <%= link_to({ controller: '/forums', action: 'new', project_id: @project }, - { aria: { label: t(:label_forum_new) }, - title: t(:label_forum_new), - class: 'button -highlight' }) do %> + <%= link_to(new_project_forum_path(@project), + { aria: { label: t(:label_forum_new) }, + title: t(:label_forum_new), + class: 'button -alt-highlight' }) do %> <%= op_icon('button--icon icon-add') %> <%= t('activerecord.models.forum') %> <% end %>