diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/gateway_settings_controller.rb | 1 | ||||
-rw-r--r-- | app/models/gateway_setting.rb | 3 | ||||
-rw-r--r-- | app/views/gateway_settings/_form_core.html.haml | 3 | ||||
-rw-r--r-- | app/views/gateways/show.html.haml | 2 |
4 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb index 4d19b35..0304411 100644 --- a/app/controllers/gateway_settings_controller.rb +++ b/app/controllers/gateway_settings_controller.rb @@ -15,6 +15,7 @@ class GatewaySettingsController < ApplicationController def create @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting]) + @gateway_setting.class_type = GatewaySetting::GATEWAY_SETTINGS[@gateway.technology][@gateway_setting.name] if @gateway_setting.save redirect_to @gateway, :notice => t('gateway_settings.controller.successfuly_created') else diff --git a/app/models/gateway_setting.rb b/app/models/gateway_setting.rb index cf1292d..cb430d1 100644 --- a/app/models/gateway_setting.rb +++ b/app/models/gateway_setting.rb @@ -1,5 +1,8 @@ class GatewaySetting < ActiveRecord::Base CLASS_TYPES = ['String', 'Integer', 'Boolean'] + GATEWAY_SETTINGS = { + 'sip' => { 'domain' => 'String', 'username' => 'String', 'password' => 'String', 'register' => 'Boolean' }, + } attr_accessible :gateway_id, :name, :value, :class_type, :description diff --git a/app/views/gateway_settings/_form_core.html.haml b/app/views/gateway_settings/_form_core.html.haml index 3d93509..3e7dc49 100644 --- a/app/views/gateway_settings/_form_core.html.haml +++ b/app/views/gateway_settings/_form_core.html.haml @@ -1,5 +1,4 @@ .inputs - = f.input :name, :label => t('gateway_settings.form.name.label'), :hint => conditional_hint('gateway_settings.form.name.hint'), :autofocus => true + = f.input :name, :collection => GatewaySetting::GATEWAY_SETTINGS['sip'].keys, :label => t('gateway_settings.form.name.label'), :hint => conditional_hint('gateway_settings.form.name.hint'), :autofocus => true, :include_blank => false = f.input :value, :label => t('gateway_settings.form.value.label'), :hint => conditional_hint('gateway_settings.form.value.hint') - = f.input :class_type, :collection => GatewaySetting::CLASS_TYPES, :label => t('gateway_settings.form.class_type.label'), :hint => conditional_hint('gateway_settings.form.class_type.hint'), :include_blank => false = f.input :description, :label => t('gateway_settings.form.description.label'), :hint => conditional_hint('gateway_settings.form.description.hint') diff --git a/app/views/gateways/show.html.haml b/app/views/gateways/show.html.haml index 3460c58..ebf75a5 100644 --- a/app/views/gateways/show.html.haml +++ b/app/views/gateways/show.html.haml @@ -25,8 +25,8 @@ %br = render :partial => 'shared/create_link', :locals => { :parent => @gateway, :child_class => GatewaySetting } -%h2= t('gateway_parameters.index.page_title') - if @gateway.gateway_parameters.any? + %h2= t('gateway_parameters.index.page_title') = render "gateway_parameters/index_core", :gateway_parameters => @gateway.gateway_parameters %br = render :partial => 'shared/create_link', :locals => { :parent => @gateway, :child_class => GatewayParameter } |