summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-05-23 11:47:42 +0200
committerPeter Kozak <spag@golwen.net>2013-05-23 11:47:42 +0200
commit5a89a4dca6b51154611dbdfc6c7619ae4c68976d (patch)
treedae1d7ed068c60883feab8a84f42afb4eaeb244f /app/assets
parente5d047eaf6d4c9f138fce801f4d9b790e7e8a7e6 (diff)
JavaSctipt added to CallForward view
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/call_forward.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/assets/javascripts/call_forward.js b/app/assets/javascripts/call_forward.js
new file mode 100644
index 0000000..744fae0
--- /dev/null
+++ b/app/assets/javascripts/call_forward.js
@@ -0,0 +1,58 @@
+ $(document).ready(function(){
+ if($('#call_forward_call_forward_case_id').val() != "3"){
+ $("#timeout_div").css('display','none');
+ }
+ else{
+ $("#timeout_div").css('display','block');
+ }
+ $('#call_forward_call_forward_case_id').change(function(){
+ if($(this).val() != "3"){
+ $("#timeout_div").css('display','none');
+ }
+ else{
+ $("#timeout_div").css('display','block');
+ }
+ })
+
+ var voicemail_pattern = /VoicemailAccount$/;
+
+ if($('#call_forward_call_forwarding_destination').val() == ":PhoneNumber"){
+ $("#destination_phone_number").attr('name', 'call_forward[destination]');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','block');
+ $("#destination_greeting_div").css('display','none');
+
+ }
+ else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'call_forward[destination]');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','block');
+ }
+ else {
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','none');
+ }
+ $('#call_forward_call_forwarding_destination').change(function(){
+ if($(this).val() == ":PhoneNumber"){
+ $("#destination_phone_number").attr('name', 'call_forward[destination]');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','block');
+ $("#destination_greeting_div").css('display','none');
+ }
+ else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'call_forward[destination]');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','block');
+ }
+ else{
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','none');
+ }
+ })
+ });