summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-25 14:00:41 +0200
committerPeter Kozak <spag@golwen.net>2013-04-25 14:00:41 +0200
commit15664d01ab69da8e7478dfd45cf52ef709349428 (patch)
tree0aac82e621585cc0ca7d4047ff9d49cca7d243f7 /app/controllers
parentf9012f9ffa7eb074cf5c7db74a372437017e2ddd (diff)
defailt voicemail settings
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/voicemail_accounts_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/voicemail_accounts_controller.rb b/app/controllers/voicemail_accounts_controller.rb
index 7e00131..0bfa160 100644
--- a/app/controllers/voicemail_accounts_controller.rb
+++ b/app/controllers/voicemail_accounts_controller.rb
@@ -31,6 +31,15 @@ class VoicemailAccountsController < ApplicationController
def create
@voicemail_account = @parent.voicemail_accounts.new(params[:voicemail_account])
if @voicemail_account.save
+ if @parent.class == User
+ @email = @parent.email
+ end
+ @voicemail_account.voicemail_settings.create(:name => 'pin', :value => ("%06d" % SecureRandom.random_number(999999)), :class_type => 'String')
+ @voicemail_account.voicemail_settings.create(:name => 'notify', :value => 'true', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'attachment', :value => 'true', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'mark_read', :value => 'true', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'purge', :value => 'false', :class_type => 'Boolean')
+ @voicemail_account.voicemail_settings.create(:name => 'email', :value => @email, :class_type => 'String')
m = method( :"#{@parent.class.name.underscore}_voicemail_accounts_url" )
redirect_to m.( @parent ), :notice => t('voicemail_accounts.controller.successfuly_created')
else
@@ -65,4 +74,5 @@ class VoicemailAccountsController < ApplicationController
authorize! :read, @parent
end
+
end