OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Update caption directly instead of as a text field
Mir Bhatia0b3909f31731
diff --git a/modules/meeting/app/components/meetings/index/form_component.html.erb b/modules/meeting/app/components/meetings/index/form_component.html.erbindex 0be5e7a1b24..ebc17facfaf 100644--- a/modules/meeting/app/components/meetings/index/form_component.html.erb+++ b/modules/meeting/app/components/meetings/index/form_component.html.erb@@ -43,31 +43,7 @@endmodal_body.with_row(mt: 3) do- flex_layout(classes: "FormControl-horizontalGroup") do |time_row|- time_row.with_column(flex: 1) do- render(Meeting::StartDate.new(f, meeting: @meeting))- end-- time_row.with_column(flex_layout: true, flex: 1) do |time_field|- time_field.with_row do- render(Meeting::StartTime.new(f, meeting: @meeting))- end-- time_field.with_row(mt: 1) do- render(- Primer::Beta::Text.new(- id: "meeting-timezone",- font_size: :small,- color: :subtle- )- ) { timezone_caption }- end- end-- time_row.with_column(flex: 1) do- render(Meeting::Duration.new(f, meeting: @meeting))- end- end+ render(Meeting::TimeGroup.new(f, meeting: @meeting))endif @meeting.is_a?(RecurringMeeting)diff --git a/modules/meeting/app/components/meetings/index/form_component.rb b/modules/meeting/app/components/meetings/index/form_component.rbindex 85780c6c1d9..da1d60fdf2f 100644--- a/modules/meeting/app/components/meetings/index/form_component.rb+++ b/modules/meeting/app/components/meetings/index/form_component.rb@@ -66,9 +66,5 @@ module Meetings:updateendend-- def timezone_caption- friendly_timezone_name(User.current.time_zone, period: @meeting.start_time)- endendenddiff --git a/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb b/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erbindex 29d74d8c198..567773ead27 100644--- a/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb+++ b/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb@@ -17,32 +17,8 @@render(BaseErrorsComponent.new(@meeting, mb: 3))end- modal_body.with_row(mt: 3) do- flex_layout(classes: "FormControl-horizontalGroup") do |time_row|- time_row.with_column(flex: 1) do- render(Meeting::StartDate.new(f, meeting: @meeting))- end-- time_row.with_column(flex_layout: true, flex: 1) do |time_field|- time_field.with_row do- render(Meeting::StartTime.new(f, meeting: @meeting))- end-- time_field.with_row(mt: 1) do- render(- Primer::Beta::Text.new(- id: "meeting-timezone",- font_size: :small,- color: :subtle- )- ) { timezone_caption }- end- end-- time_row.with_column(flex: 1) do- render(Meeting::Duration.new(f, meeting: @meeting))- end- end+ modal_body.with_row(mb: 3) do+ render(Meeting::TimeGroup.new(f, meeting: @meeting))endmodal_body.with_row dodiff --git a/modules/meeting/app/components/meetings/side_panel/details_form_component.rb b/modules/meeting/app/components/meetings/side_panel/details_form_component.rbindex 0a3e5ba1af2..3ba4b391928 100644--- a/modules/meeting/app/components/meetings/side_panel/details_form_component.rb+++ b/modules/meeting/app/components/meetings/side_panel/details_form_component.rb@@ -53,9 +53,5 @@ module Meetingsdef start_time_initial_valueformat_time(@meeting.start_time, include_date: false, format: "%H:%M")end-- def timezone_caption- friendly_timezone_name(User.current.time_zone, period: @meeting.start_time)- endendenddiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 79308caa6d3..40bd8cab8e2 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -332,16 +332,16 @@ class MeetingsController < ApplicationControllerdef fetch_timezoneUser.execute_as(User.current) domeeting = Meeting.new(timezone_params)- text = friendly_timezone_name(User.current.time_zone, period: meeting.start_time)-- respond_to do |format|- format.html { render plain: text }- format.turbo_stream do- render turbo_stream: turbo_stream.update("meeting-timezone",- plain: text)- end- end+ @text = friendly_timezone_name(User.current.time_zone, period: meeting.start_time)end++ prefix = params[:structured_meeting] ? "structured_" : ""++ add_caption_to_input_element_via_turbo_stream("input[name='#{prefix}meeting[start_time_hour]']",+ caption: @text,+ clean_other_captions: true)++ respond_with_turbo_streamsendprivatediff --git a/modules/meeting/app/forms/meeting/duration.rb b/modules/meeting/app/forms/meeting/duration.rbdeleted file mode 100644index a265d1056eb..00000000000--- a/modules/meeting/app/forms/meeting/duration.rb+++ /dev/null@@ -1,66 +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.-#++--class Meeting::Duration < ApplicationForm- form do |meeting_form|- meeting_form.text_field(- name: :duration,- type: :text,- value: @duration,- placeholder: Meeting.human_attribute_name(:duration),- label: Meeting.human_attribute_name(:duration),- visually_hide_label: false,- required: true,- caption: I18n.t("text_in_hours"),- data: {- controller: "chronic-duration",- application_target: "dynamic"- }- )- end-- def initialize(meeting:)- super()-- @meeting = meeting- duration = duration_value(meeting)- @duration = duration.nil? ? "" : ChronicDuration.output(duration * 3600, format: :hours_only)- end-- private-- def duration_value(meeting)- if meeting.is_a?(RecurringMeeting) && meeting.template- meeting.template.duration- else- meeting.duration- end- end-enddiff --git a/modules/meeting/app/forms/meeting/start_date.rb b/modules/meeting/app/forms/meeting/start_date.rbdeleted file mode 100644index cc59d37f527..00000000000--- a/modules/meeting/app/forms/meeting/start_date.rb+++ /dev/null@@ -1,53 +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.-#++--class Meeting::StartDate < ApplicationForm- form do |meeting_form|- meeting_form.text_field(- name: :start_date,- type: "date",- value: @initial_date,- placeholder: @meeting.class.human_attribute_name(:start_date),- label: @meeting.class.human_attribute_name(:start_date),- required: true,- autofocus: false,- data: {- action: "input->recurring-meetings--form#updateFrequencyText input->meetings--form#updateTimezoneText"- }- )- end-- def initialize(meeting:)- super()-- @meeting = meeting- @initial_date = meeting.start_date.presence || format_time_as_date(meeting.start_time, format: "%Y-%m-%d")- end-enddiff --git a/modules/meeting/app/forms/meeting/start_time.rb b/modules/meeting/app/forms/meeting/start_time.rbdeleted file mode 100644index 1d57da842d6..00000000000--- a/modules/meeting/app/forms/meeting/start_time.rb+++ /dev/null@@ -1,54 +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.-#++--class Meeting::StartTime < ApplicationForm- include Redmine::I18n-- form do |meeting_form|- meeting_form.text_field(- name: :start_time_hour,- type: "time",- value: @initial_time,- placeholder: Meeting.human_attribute_name(:start_time),- label: Meeting.human_attribute_name(:start_time),- required: true,- data: {- action: "input->recurring-meetings--form#updateFrequencyText input->meetings--form#updateTimezoneText"- }- )- end-- def initialize(meeting:)- super()-- @meeting = meeting- @initial_time = meeting.start_time_hour.presence || format_time(meeting.start_time, include_date: false, format: "%H:%M")- end-enddiff --git a/modules/meeting/app/forms/meeting/time_group.rb b/modules/meeting/app/forms/meeting/time_group.rbindex b1a11547dfa..01414be73ad 100644--- a/modules/meeting/app/forms/meeting/time_group.rb+++ b/modules/meeting/app/forms/meeting/time_group.rb@@ -41,7 +41,8 @@ class Meeting::TimeGroup < ApplicationFormrequired: true,autofocus: false,data: {- action: "input->recurring-meetings--form#updateFrequencyText"+ action: "input->recurring-meetings--form#updateFrequencyText \+ input->meetings--form#updateTimezoneText"})@@ -52,11 +53,13 @@ class Meeting::TimeGroup < ApplicationFormplaceholder: Meeting.human_attribute_name(:start_time),label: Meeting.human_attribute_name(:start_time),required: true,- caption: formatted_time_zone_offset,+ caption: timezone_caption,data: {- action: "input->recurring-meetings--form#updateFrequencyText"+ action: "input->recurring-meetings--form#updateFrequencyText \+ input->meetings--form#updateTimezoneText"})+group.text_field(name: :duration,type: :text,@@ -94,4 +97,8 @@ class Meeting::TimeGroup < ApplicationFormmeeting.durationendend++ def timezone_caption+ friendly_timezone_name(User.current.time_zone, period: @meeting.start_time)+ endend