Fixed issue #705 - Time accounting works only with dot. Fixed issue #670 - Auto Focus on "Time Accounting" Popupbox.

This commit is contained in:
Martin Edenhofer 2017-02-06 00:15:28 +01:00
parent 7e947dc4bf
commit b70b530e2a
5 changed files with 202 additions and 5 deletions

View file

@ -678,6 +678,7 @@ class App.ControllerModal extends App.Controller
container: null
buttonClass: 'btn--success'
centerButtons: []
leftButtons: []
buttonClose: true
buttonCancel: false
buttonCancelClass: 'btn--text btn--subtle'
@ -729,6 +730,7 @@ class App.ControllerModal extends App.Controller
buttonSubmit: @buttonSubmit
buttonClass: @buttonClass
centerButtons: @centerButtons
leftButtons: @leftButtons
)
modal.find('.modal-body').html content
if !@initRenderingDone

View file

@ -1,20 +1,47 @@
class App.TicketZoomTimeAccounting extends App.ControllerModal
buttonClose: true
buttonCancel: 'skip'
buttonCancel: false
buttonSubmit: 'Account Time'
buttonClass: 'btn--success'
leftButtons: [{
className: 'btn--text btn--subtle js-skip',
text: 'skip'
}]
head: 'Time Accounting'
small: true
events:
'submit form': 'submit'
'click .js-submit:not(.is-disabled)': 'submit'
'click .js-cancel': 'cancel'
'click .js-close': 'cancel'
'click .js-skip': 'skip'
content: ->
App.view('ticket_zoom/time_accounting')()
onShown: =>
@$('[name="time_unit"]').focus()
skip: (e) =>
return if !@submitCallback
@submitCallback({})
@close(e)
onCancel: =>
if @cancelCallback
@cancelCallback()
return if !@cancelCallback
@cancelCallback()
onSubmit: =>
@$('[name="time_unit"]').removeClass('has-error')
params = @formParams()
if params.time_unit
params.time_unit = params.time_unit.replace(',', '.')
if isNaN(parseFloat(params.time_unit)) || params.time_unit.match(/[A-z]|\s/)
@$('[name="time_unit"]').addClass('has-error')
return
@close()
if @submitCallback
params = @formParams()
@submitCallback(params)

View file

@ -15,8 +15,14 @@
<div class="modal-footer">
<% if @buttonCancel: %>
<div class="modal-leftFooter">
<a class="btn <%= @buttonCancelClass %> js-cancel align-left" href="#/"><%- @T(@buttonCancel) %></a>
<a class="btn <%= @buttonCancelClass %> js-cancel align-left" href="#"><%- @T(@buttonCancel) %></a>
</div>
<% else if @leftButtons: %>
<% for button in @leftButtons: %>
<div class="modal-leftFooter">
<div class="btn <%= button.className %> align-left" href="#"><%- @T(button.text) %></div>
</div>
<% end %>
<% end %>
<% for button in @centerButtons: %>
<div class="modal-centerFooter">

View file

@ -31,6 +31,7 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/agent_ticket_overview_tab_test.rb
rm test/browser/agent_ticket_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb
rm test/browser/agent_ticket_update1_test.rb
rm test/browser/agent_ticket_update2_test.rb
rm test/browser/agent_ticket_update3_test.rb
@ -87,6 +88,7 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/agent_ticket_overview_tab_test.rb
rm test/browser/agent_ticket_tag_test.rb
# test/browser/agent_ticket_text_module_test.rb
# test/browser/agent_ticket_time_accounting_test.rb
# test/browser/agent_ticket_update1_test.rb
# test/browser/agent_ticket_update2_test.rb
# test/browser/agent_ticket_update3_test.rb
@ -143,6 +145,7 @@ elif [ "$LEVEL" == '3' ]; then
rm test/browser/agent_ticket_overview_tab_test.rb
# test/browser/agent_ticket_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb
rm test/browser/agent_ticket_update1_test.rb
rm test/browser/agent_ticket_update2_test.rb
rm test/browser/agent_ticket_update3_test.rb
@ -199,6 +202,7 @@ elif [ "$LEVEL" == '4' ]; then
# test/browser/agent_ticket_overview_tab_test.rb
rm test/browser/agent_ticket_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb
rm test/browser/agent_ticket_update1_test.rb
rm test/browser/agent_ticket_update2_test.rb
rm test/browser/agent_ticket_update3_test.rb
@ -254,6 +258,7 @@ elif [ "$LEVEL" == '5' ]; then
rm test/browser/agent_ticket_overview_tab_test.rb
rm test/browser/agent_ticket_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb
rm test/browser/agent_ticket_update1_test.rb
rm test/browser/agent_ticket_update2_test.rb
rm test/browser/agent_ticket_update3_test.rb
@ -312,6 +317,7 @@ elif [ "$LEVEL" == '6' ]; then
rm test/browser/agent_ticket_overview_tab_test.rb
rm test/browser/agent_ticket_tag_test.rb
rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb
rm test/browser/agent_ticket_update1_test.rb
rm test/browser/agent_ticket_update2_test.rb
rm test/browser/agent_ticket_update3_test.rb

View file

@ -0,0 +1,156 @@
# encoding: utf-8
require 'browser_test_helper'
class AgentTicketTimeAccountingTest < TestCase
def test_macro
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()
# enable time accounting
click(
css: 'a[href="#manage"]',
)
click(
css: '.content.active a[href="#manage/time_accounting"]',
)
switch(
css: '.content.active .js-timeAccountingSetting',
type: 'on',
)
ticket1 = ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: 'some subject - time accounting#1',
body: 'some body - time accounting#1',
},
)
ticket_update(
data: {
body: 'some note',
},
do_not_submit: true,
)
click(
css: '.active .js-submit',
)
watch_for(
css: '.content.active .modal',
value: 'Time Accounting',
)
set(
css: '.content.active .modal [name=time_unit]',
value: '4',
)
click(
css: '.content.active .modal .js-submit',
)
watch_for_disappear(
css: '.content.active .modal',
value: 'Time Accounting',
)
watch_for(
css: '.content.active .js-timeUnit',
value: '4',
)
ticket2 = ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: 'some subject - time accounting#2',
body: 'some body - time accounting#2',
},
)
ticket_update(
data: {
body: 'some note',
},
do_not_submit: true,
)
click(
css: '.active .js-submit',
)
watch_for(
css: '.content.active .modal',
value: 'Time Accounting',
)
set(
css: '.content.active .modal [name=time_unit]',
value: '4,6',
)
click(
css: '.content.active .modal .js-submit',
)
watch_for_disappear(
css: '.content.active .modal',
value: 'Time Accounting',
)
watch_for(
css: '.content.active .js-timeUnit',
value: '4.6',
)
ticket_update(
data: {
body: 'some note2',
},
do_not_submit: true,
)
click(
css: '.active .js-submit',
)
watch_for(
css: '.content.active .modal',
value: 'Time Accounting',
)
set(
css: '.content.active .modal [name=time_unit]',
value: '4abc',
)
click(
css: '.content.active .modal .js-submit',
)
watch_for(
css: '.content.active .modal [name=time_unit].has-error',
)
set(
css: '.content.active .modal [name=time_unit]',
value: '4 ',
)
click(
css: '.content.active .modal .js-submit',
)
watch_for_disappear(
css: '.content.active .modal',
value: 'Time Accounting',
)
watch_for(
css: '.content.active .js-timeUnit',
value: '8.6',
)
# disable time accounting
click(
css: 'a[href="#manage"]',
)
click(
css: '.content.active a[href="#manage/time_accounting"]',
)
switch(
css: '.content.active .js-timeAccountingSetting',
type: 'off',
)
end
end