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
simplify permanent controller
ulfertsc9d224341cca
diff --git a/app/forms/work_packages/progress_form.rb b/app/forms/work_packages/progress_form.rbindex f16bc6bced4..9f06bd733f3 100644--- a/app/forms/work_packages/progress_form.rb+++ b/app/forms/work_packages/progress_form.rb@@ -172,16 +172,16 @@ class WorkPackages::ProgressForm < ApplicationForm"work-packages--progress--preview-progress-target": "progressInput","work-packages--progress--touched-field-marker-target": "progressInput","application-target": "dynamic",- controller: "permanent-on-focus",+ controller: "turbo-permanent",action: "input->work-packages--progress--touched-field-marker#markFieldAsTouched " \- "focus->permanent-on-focus#togglePermanentAttribute " \- "blur->permanent-on-focus#togglePermanentAttribute"+ "focus->turbo-permanent#set " \+ "blur->turbo-permanent#remove"}if @focused_field == namedata[:"work-packages--progress--focus-field-target"] = "fieldToFocus"# Prevent changes being morphed into the input that is currently focused.- # After this initial rendering, the permanent-on-focus.controller takes over maintaining+ # After this initial rendering, the turbo-permanent.controller takes over maintaining# the attribute on the input currently focused.data["turbo-permanent"] = trueenddiff --git a/frontend/src/stimulus/controllers/dynamic/permanent-on-focus.controller.ts b/frontend/src/stimulus/controllers/dynamic/turbo-permanent.controller.tssimilarity index 84%rename from frontend/src/stimulus/controllers/dynamic/permanent-on-focus.controller.tsrename to frontend/src/stimulus/controllers/dynamic/turbo-permanent.controller.tsindex a68fb9b69d0..4b2129c7e02 100644--- a/frontend/src/stimulus/controllers/dynamic/permanent-on-focus.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/turbo-permanent.controller.ts@@ -30,10 +30,18 @@import { Controller } from '@hotwired/stimulus';-export default class PermanentOnFocusController extends Controller {- togglePermanentAttribute(event:FocusEvent) {+export default class TurboPermanentController extends Controller {+ set(event:Event) {+ this.toggle(event, true);+ }++ remove(event:Event) {+ this.toggle(event, false);+ }++ private toggle(event:Event, force:boolean) {if (event.target) {- (event.target as HTMLElement).toggleAttribute('data-turbo-permanent', event.type === 'focus');+ (event.target as HTMLElement).toggleAttribute('data-turbo-permanent', force);}}}