summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-25 12:12:12 +0200
committerPeter Kozak <spag@golwen.net>2013-04-25 12:12:12 +0200
commitae05a20f5b474071dfa9b6c8760636304861a7d1 (patch)
tree9ed40d79add3aaba679f8af5943eaff4257cee4f
parent272c9a9263a902a5a8cf967ceadc868e671cbcf2 (diff)
voicemail_settings controller value input_type
-rw-r--r--app/controllers/voicemail_settings_controller.rb25
1 files changed, 17 insertions, 8 deletions
diff --git a/app/controllers/voicemail_settings_controller.rb b/app/controllers/voicemail_settings_controller.rb
index 1b2e371..8a7c411 100644
--- a/app/controllers/voicemail_settings_controller.rb
+++ b/app/controllers/voicemail_settings_controller.rb
@@ -10,6 +10,19 @@ class VoicemailSettingsController < ApplicationController
end
def new
+ @names_possible = []
+ VoicemailSetting::VOICEMAIL_SETTINGS.keys.each do |name|
+ if @voicemail_account.voicemail_settings.where(:name => name).first
+ next
+ end
+
+ label = t("voicemail_settings.settings.#{name}")
+ if label =~ /^translation missing/
+ label = name.to_s.gsub('_', ' ').capitalize;
+ end
+
+ @names_possible << [label, name]
+ end
end
def create
@@ -25,14 +38,8 @@ class VoicemailSettingsController < ApplicationController
def edit
@voicemail_setting = @voicemail_account.voicemail_settings.find(params[:id])
- @no_edit = {
- :name => {
- :input => VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:input, {}),
- :name => @voicemail_setting.name.to_s,
- :html => VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:html, {}),
- },
- :description => true
- }
+ @input_type = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:input, 'String')
+ @input_html = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:html, {})
end
def update
@@ -41,6 +48,8 @@ class VoicemailSettingsController < ApplicationController
m = method( :"#{@voicemail_account.voicemail_accountable.class.name.underscore}_voicemail_account_path" )
redirect_to m.( @voicemail_account.voicemail_accountable, @voicemail_account ), :notice => t('voicemail_settings.controller.successfuly_updated')
else
+ @input_type = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:input, 'String')
+ @input_html = VoicemailSetting::VOICEMAIL_SETTINGS.fetch(@voicemail_setting.name,{}).fetch(:html, {})
render :edit
end
end