diff --git a/lib/full_calendar/event.rb b/lib/full_calendar/event.rb
index 1d56c563109..ee1c5e37ab9 100644
--- a/lib/full_calendar/event.rb
+++ b/lib/full_calendar/event.rb
@@ -42,6 +42,11 @@ module FullCalendar
attribute :url, :string
attribute :class_names, array: true, default: []
+ # override in subclasses to add more fields to the JSON
+ def additional_attributes
+ {}
+ end
+
def as_json
{
"id" => id,
@@ -51,26 +56,12 @@ module FullCalendar
"end" => ends_at,
"title" => title,
"url" => url,
- "classNames" => class_names,
- "customEventView" => rendered_event_content
- }.compact_blank.as_json
+ "classNames" => class_names
+ }.merge(additional_attributes).compact_blank.as_json
end
def to_json(*)
as_json.to_json(*)
end
-
- def event_content_view_component
- # override in subclasses
- nil
- end
-
- private
-
- def rendered_event_content
- if event_content_view_component
- ApplicationController.render(event_content_view_component, layout: false)
- end
- end
end
end
diff --git a/modules/costs/app/components/_index.sass b/modules/costs/app/components/_index.sass
index baf9ffc4943..c2d6cebea24 100644
--- a/modules/costs/app/components/_index.sass
+++ b/modules/costs/app/components/_index.sass
@@ -1,2 +1 @@
@import "time_entries/entry_dialog_component"
-@import "time_tracking/time_entry_event_component"
diff --git a/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb b/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb
deleted file mode 100644
index 4879bc8cd2b..00000000000
--- a/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- <%= link_to "edit", dialog_time_entry_path(time_entry, onlyMe: true), data: { "turbo-stream" => true } %>
- <%= l(time_entry.spent_on) %>
- <%- if time_entry.has_start_and_end_time? %>
- <%= time_entry.start_timestamp.strftime("%H:%M") %>-<%= time_entry.end_timestamp.strftime("%H:%M") %>
- (<%= time_entry.hours %>)
- <%- else %>
- <%= time_entry.hours %>)
- <%- end %>
-
-
<%= time_entry.work_package.subject %>
-
<%= time_entry.project.name %>
-
diff --git a/modules/costs/app/components/time_tracking/time_entry_event_component.rb b/modules/costs/app/components/time_tracking/time_entry_event_component.rb
deleted file mode 100644
index fa5b74bfdf2..00000000000
--- a/modules/costs/app/components/time_tracking/time_entry_event_component.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-# -- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-# ++
-
-module TimeTracking
- class TimeEntryEventComponent < ApplicationComponent
- options :time_entry
- end
-end
diff --git a/modules/costs/app/components/time_tracking/time_entry_event_component.sass b/modules/costs/app/components/time_tracking/time_entry_event_component.sass
deleted file mode 100644
index 0ee491c93ef..00000000000
--- a/modules/costs/app/components/time_tracking/time_entry_event_component.sass
+++ /dev/null
@@ -1,66 +0,0 @@
-@import 'helpers'
-@import '../../app/spot/styles/sass/variables'
-
-.calendar-time-entry-event
- display: flex
- user-select: none
- // Leave space for the shadow to be displayed
- width: calc(100% - 4px)
- border: 1px solid var(--borderColor-default)
- border-radius: 5px
- padding: 10px
- position: relative
- box-shadow: 1px 1px 3px 0px var(--borderColor-default)
- background: var(--body-background)
- color: var(--body-font-color)
- font-size: var(--body-font-size)
-
- &:hover
- .calendar-time-entry-event--inline-buttons
- opacity: 1
- z-index: 2
- box-shadow: -4px -4px 10px 4px var(--body-background)
-
- &--content
- display: grid
- grid-template-columns: max-content max-content auto auto 1fr
- grid-template-rows: auto 1fr max-content auto
- grid-row-gap: 5px
- grid-column-gap: 5px
- grid-template-areas: "dates" "subject" "project"
- overflow: hidden
- flex-grow: 1
- font-size: var(--body-font-size)
- line-height: 16px
-
- &-project-name
- grid-area: project
- font-style: italic
- color: var(--fgColor-muted)
- font-size: 12px
- @include text-shortener
-
- &-type
- grid-area: type
- margin-right: 4px
-
- &-subject-line
- grid-area: subject
- @include text-shortener(false)
-
- &-dates
- grid-area: dates
- place-self: center end
- white-space: nowrap
- color: var(--fgColor-muted)
- font-size: 12px
- color: var(--fgColor-muted)
- margin: 0 8px
-
- &--highlighting
- width: 100%
- height: 4px
- position: absolute
- top: 0
- left: 0
- border-radius: 5px 5px 0 0
diff --git a/modules/costs/lib/full_calendar/time_entry_event.rb b/modules/costs/lib/full_calendar/time_entry_event.rb
index ba404b22e61..72bac191a54 100644
--- a/modules/costs/lib/full_calendar/time_entry_event.rb
+++ b/modules/costs/lib/full_calendar/time_entry_event.rb
@@ -47,19 +47,15 @@ module FullCalendar
end
end
- def as_json(*)
- super.merge(
+ def additional_attributes
+ {
hours: time_entry.hours,
statusId: time_entry.work_package.status_id,
workPackageId: time_entry.work_package.id,
workPackageSubject: time_entry.work_package.subject,
projectId: time_entry.project.id,
projectName: time_entry.project.name
- )
- end
-
- def event_content_view_component
- TimeTracking::TimeEntryEventComponent.new(time_entry: time_entry)
+ }
end
end
end