fix setting of date and time fields on 'start' action
This commit is contained in:
		
							parent
							
								
									4c13744a0c
								
							
						
					
					
						commit
						4833ebd54b
					
				
					 3 changed files with 12 additions and 20 deletions
				
			
		|  | @ -50,8 +50,8 @@ function showIfIn(node, conditions) { | ||||||
| function setIfIn(node, conditions) { | function setIfIn(node, conditions) { | ||||||
|     dojo.forEach(conditions, function(cond) { |     dojo.forEach(conditions, function(cond) { | ||||||
|         if (node.value == cond[0]) { |         if (node.value == cond[0]) { | ||||||
|             target = dojo.byId(cond[1]); |             target = dijit.byId(cond[1]); | ||||||
|             target.value = cond[2]; |             target.setValue(cond[2]); | ||||||
|         } |         } | ||||||
|     }) |     }) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -478,13 +478,7 @@ class CreateWorkItemForm(ObjectForm, BaseTrackView): | ||||||
| 
 | 
 | ||||||
|     @Lazy |     @Lazy | ||||||
|     def defaultDate(self): |     def defaultDate(self): | ||||||
|         return format.formatDate(date.today(), 'date', 'medium', |         return time.strftime('%Y-%m-%dT%H:%M', time.localtime(getTimeStamp())) | ||||||
|                                  self.languageInfo.language) |  | ||||||
|         #return time.strftime('%Y-%m-%d', time.localtime(getTimeStamp())) |  | ||||||
| 
 |  | ||||||
|     @Lazy |  | ||||||
|     def defaultTime(self): |  | ||||||
|         return time.strftime('%H:%M', time.localtime(getTimeStamp())) |  | ||||||
| 
 | 
 | ||||||
|     @Lazy |     @Lazy | ||||||
|     def date(self): |     def date(self): | ||||||
|  |  | ||||||
|  | @ -124,8 +124,10 @@ | ||||||
|                           setIfIn(this, [['start', 'start_date',  |                           setIfIn(this, [['start', 'start_date',  | ||||||
|                                               this.form.default_date.value], |                                               this.form.default_date.value], | ||||||
|                                          ['start', 'start_time',  |                                          ['start', 'start_time',  | ||||||
|                                                  this.form.default_time.value], |                                               this.form.default_date.value], | ||||||
|                                          ['start', 'end_time', '']])"> |                                          ['start', 'end_time', null], | ||||||
|  |                                          ['start', 'duration', ''], | ||||||
|  |                                          ['start', 'effort', '']])"> | ||||||
|           <option tal:repeat="action view/actions" |           <option tal:repeat="action view/actions" | ||||||
|                   tal:attributes="value action/name" |                   tal:attributes="value action/name" | ||||||
|                   tal:content="action/title" |                   tal:content="action/title" | ||||||
|  | @ -133,8 +135,6 @@ | ||||||
|         </select> |         </select> | ||||||
|         <input type="hidden" name="default_date" id="default_date" |         <input type="hidden" name="default_date" id="default_date" | ||||||
|                tal:attributes="value view/defaultDate" /> |                tal:attributes="value view/defaultDate" /> | ||||||
|         <input type="hidden" name="default_time" id="default_time" |  | ||||||
|                tal:attributes="value view/defaultTime" /> |  | ||||||
|         <span id="target_party" style="display: none">  |         <span id="target_party" style="display: none">  | ||||||
|           <label i18n:translate="delegate_to_party" for="input_party" |           <label i18n:translate="delegate_to_party" for="input_party" | ||||||
|                  style="display: inline">to</label> |                  style="display: inline">to</label> | ||||||
|  | @ -224,12 +224,10 @@ | ||||||
|                  id="start_date" |                  id="start_date" | ||||||
|                  dojoType="dijit.form.DateTextBox" |                  dojoType="dijit.form.DateTextBox" | ||||||
|                  tal:attributes="value view/date" /> |                  tal:attributes="value view/date" /> | ||||||
|           <input type="text" name="start_time" style="width: 6em" |           <input type="text" name="start_time" id="start_time" style="width: 6em" | ||||||
|                  id="start_time" |  | ||||||
|                  dojoType="dijit.form.TimeTextBox" |                  dojoType="dijit.form.TimeTextBox" | ||||||
|                  tal:attributes="value view/startTime" /> - |                  tal:attributes="value view/startTime" /> - | ||||||
|           <input type="text" name="end_time" style="width: 6em" |           <input type="text" name="end_time" id="end_time" style="width: 6em" | ||||||
|                  id="end_time" |  | ||||||
|                  dojoType="dijit.form.TimeTextBox" |                  dojoType="dijit.form.TimeTextBox" | ||||||
|                  tal:attributes="value view/endTime" /></div> |                  tal:attributes="value view/endTime" /></div> | ||||||
|       </div> |       </div> | ||||||
|  | @ -250,11 +248,11 @@ | ||||||
|         <label i18n:translate="" |         <label i18n:translate="" | ||||||
|                for="duration-effort-input">Duration / Effort (hh:mm)</label> |                for="duration-effort-input">Duration / Effort (hh:mm)</label> | ||||||
|         <div id="duration-effort-input"> |         <div id="duration-effort-input"> | ||||||
|           <input type="text" name="duration" style="width: 5em" |           <input type="text" name="duration" id="duration" style="width: 5em" | ||||||
|                  dojoType="dijit.form.ValidationTextBox" |                  dojoType="dijit.form.ValidationTextBox" | ||||||
|                  regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}" |                  regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}" | ||||||
|                  tal:attributes="value view/duration" /> / |                  tal:attributes="value view/duration" /> / | ||||||
|           <input type="text" name="effort" style="width: 5em" |           <input type="text" name="effort" id="effort" style="width: 5em" | ||||||
|                  dojoType="dijit.form.ValidationTextBox" |                  dojoType="dijit.form.ValidationTextBox" | ||||||
|                  regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}" |                  regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}" | ||||||
|                  tal:attributes="value view/effort" /></div> |                  tal:attributes="value view/effort" /></div> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue