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
add stimulus controller
Klaus Zanders903c8cf05055
diff --git a/frontend/src/stimulus/controllers/dynamic/time-entry.controller.ts b/frontend/src/stimulus/controllers/dynamic/time-entry.controller.tsnew file mode 100644index 00000000000..35a1287e46e--- /dev/null+++ b/frontend/src/stimulus/controllers/dynamic/time-entry.controller.ts@@ -0,0 +1,44 @@+/*+ * -- 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.+ * +++ */++import { Controller } from '@hotwired/stimulus';++export default class TimeEntryController extends Controller {+ static targets = ['startTimeInput', 'endTimeInput', 'hoursInput'];++ declare readonly startTimeInputTarget:HTMLInputElement;+ declare readonly endTimeInputTarget:HTMLInputElement;+ declare readonly choursInputTarget:HTMLInputElement;++ startTimeInputTargetConnected() {+ // console.log('We have a start input');+ this.startTimeInputTarget.value = '12:00';+ }+}diff --git a/modules/costs/app/components/time_entries/entry_dialog_component.html.erb b/modules/costs/app/components/time_entries/entry_dialog_component.html.erbindex fc783e2b845..c53510ac272 100644--- a/modules/costs/app/components/time_entries/entry_dialog_component.html.erb+++ b/modules/costs/app/components/time_entries/entry_dialog_component.html.erb@@ -1,4 +1,4 @@-<%= render(Primer::Alpha::Dialog.new(title: 'Log Time', size: :large, id: MODAL_ID)) do |d| %>+<%= render(Primer::Alpha::Dialog.new(title: 'Log Time', size: :large, id: MODAL_ID, data: { "controller" => "time-entry", "application-target" => "dynamic" })) do |d| %><% d.with_header(variant: :large, mb: 3) %><%= render(TimeEntries::TimeEntryFormComponent.new(time_entry: time_entry)) %><% end %>diff --git a/modules/costs/app/components/time_entries/time_entry_form.rb b/modules/costs/app/components/time_entries/time_entry_form.rbindex 09d6879cf47..f7291a1e3de 100644--- a/modules/costs/app/components/time_entries/time_entry_form.rb+++ b/modules/costs/app/components/time_entries/time_entry_form.rb@@ -8,7 +8,9 @@ module TimeEntriesendf.text_field name: :spent_on, label: "Date"f.group(layout: :horizontal) do |g|- g.text_field name: :start_time, label: "Start time"+ g.text_field name: :start_time,+ label: "Start time",+ data: { "time-entry-target" => "startTimeInput" }g.text_field name: :end_time, label: "Finish time"endf.text_field name: :hours, label: "Hours"