mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
remove custom rendering for event from a component, will do in JS
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
@import "time_entries/entry_dialog_component"
|
||||
@import "time_tracking/time_entry_event_component"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<div class="calendar-time-entry-event--content">
|
||||
<div class="calendar-time-entry-event-content-dates">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
<div class="calendar-time-entry-event--content-subject-line"><%= time_entry.work_package.subject %></div>
|
||||
<div class="calendar-time-entry-event--content-project-name"><%= time_entry.project.name %></div>
|
||||
</div>
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user