0013286: Timesheet: select duration text on focus
authorCornelius Weiß <c.weiss@metaways.de>
Fri, 30 Jun 2017 13:39:48 +0000 (15:39 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 30 Jun 2017 16:18:45 +0000 (18:18 +0200)
https://forge.tine20.org/view.php?id=13286

Change-Id: I32cc66d84cbe9eb948ddf9ac93b89cd9df28dc50
Reviewed-on: http://gerrit.tine20.com/customers/4988
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Timetracker/js/DurationSpinner.js
tine20/Timetracker/js/TimesheetEditDialog.js

index c25e95a..304ea67 100644 (file)
@@ -29,6 +29,8 @@ Tine.Timetracker.DurationSpinner = Ext.extend(Ext.ux.form.Spinner,  {
             incrementValue : 15
         });
         this.format = this.strategy.format;
+
+        this.on('focus', function(field) {field.focus(true, 10)});
     },
 
     setValue: function(value) {
index 596a8a8..82562fa 100644 (file)
@@ -122,6 +122,11 @@ Tine.Timetracker.TimesheetEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog
         if (this.record.id == 0 && this.record.get('timeaccount_id') && this.record.get('timeaccount_id').is_billable) {
             this.getForm().findField('is_billable').setValue(this.record.get('timeaccount_id').is_billable);
         }
+
+        var focusFieldName = this.record.get('timeaccount_id') ? 'duration' : 'timeaccount_id',
+            focusField = this.getForm().findField(focusFieldName);
+
+        focusField.focus(true, 250);
     },
 
     /**
@@ -248,19 +253,11 @@ Tine.Timetracker.TimesheetEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog
                         allowBlank: false,
                         forceSelection: true,
                         name: 'timeaccount_id',
-                        lazyInit: false,
-                        listeners: {
-                            scope: this,
-                            render: function(field){
-                                if(!this.useMultiple) {
-                                    field.focus(false, 250);
-                                }
-                            },
-                            select: this.onTimeaccountUpdate
-                        }
+                        lazyInit: false
                     })], [{
                         fieldLabel: this.app.i18n._('Duration'),
                         name: 'duration',
+                        selectOnFocus: true,
                         allowBlank: false,
                         xtype: 'tinedurationspinner'
                         }, {