summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-05-24 16:44:02 +0200
committerPeter Kozak <spag@golwen.net>2013-05-24 16:44:02 +0200
commit8bd6a396c891b3f0cc7e4d63f7b00e2c9d61a9b6 (patch)
tree15f493f1d8eaeb72956142ec11ac5824f6c27ef2 /app/assets
parent918b10d26c2f1e4dfddd0894944b0e964636a5e7 (diff)
broken javascript on non call_forwarding views fixed
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/call_forward.js53
1 files changed, 28 insertions, 25 deletions
diff --git a/app/assets/javascripts/call_forward.js b/app/assets/javascripts/call_forward.js
index 744fae0..13c5679 100644
--- a/app/assets/javascripts/call_forward.js
+++ b/app/assets/javascripts/call_forward.js
@@ -16,43 +16,46 @@
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');
+ if($('#call_forward_call_forwarding_destination').val()) {
- }
- 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"){
+ 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{
+ }
+ 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');
+ }
+ })
+ }
});