diff options
author | spag <spag@golwen.net> | 2013-01-30 15:59:52 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-01-30 15:59:52 +0100 |
commit | d4a664a0495bd183b16a239aeb4c342e1ca739fa (patch) | |
tree | a6ef715208cbfdcbe8567388d27311daac3fef58 | |
parent | 44337fb9a2bcbb8766e7c2b508cf2206afa09c05 (diff) |
select route endpoint
-rw-r--r-- | app/controllers/call_routes_controller.rb | 11 | ||||
-rw-r--r-- | app/models/call_route.rb | 4 | ||||
-rw-r--r-- | app/views/call_routes/_form_core.html.haml | 3 | ||||
-rw-r--r-- | config/locales/views/call_routes/de.yml | 5 | ||||
-rw-r--r-- | config/locales/views/call_routes/en.yml | 5 |
5 files changed, 18 insertions, 10 deletions
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 0259a10..653fd55 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,6 +1,12 @@ class CallRoutesController < ApplicationController authorize_resource :call_route + before_filter { |controller| + if !params[:call_route].blank? and !params[:call_route][:endpoint_str].blank? + params[:call_route][:endpoint_type], delimeter, params[:call_route][:endpoint_id] = params[:call_route][:endpoint_str].partition('=') + end + } + def index @call_routes = CallRoute.order([:routing_table, :position]) @routing_tables = @call_routes.pluck(:routing_table).uniq.sort @@ -29,6 +35,11 @@ class CallRoutesController < ApplicationController def edit @call_route = CallRoute.find(params[:id]) + @endpoints = Gateway.all.collect {|r| [ "gateway: #{r.to_s}", "gateway=#{r.id}" ] } + @endpoints << [ 'phonenumber', 'phonenumber' ] + @endpoints << [ 'dialplanfunction', 'dialplanfunction' ] + @endpoints << [ 'hangup', 'hangup' ] + @endpoints << [ 'unknown', 'unknown' ] spread_breadcrumbs end diff --git a/app/models/call_route.rb b/app/models/call_route.rb index b4496ab..1c3f70a 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -239,6 +239,10 @@ class CallRoute < ActiveRecord::Base end end + def endpoint_str + "#{endpoint_type}=#{endpoint_id}" + end + def endpoint if self.endpoint_id.to_i > 0 begin diff --git a/app/views/call_routes/_form_core.html.haml b/app/views/call_routes/_form_core.html.haml index b64d660..6679a7b 100644 --- a/app/views/call_routes/_form_core.html.haml +++ b/app/views/call_routes/_form_core.html.haml @@ -1,5 +1,4 @@ .inputs = f.input :routing_table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false, :autofocus => true = f.input :name, :label => t('call_routes.form.name.label'), :hint => conditional_hint('call_routes.form.name.hint') - = f.input :endpoint_type, :label => t('call_routes.form.endpoint_type.label'), :hint => conditional_hint('call_routes.form.endpoint_type.hint') - = f.input :endpoint_id, :label => t('call_routes.form.endpoint_id.label'), :hint => conditional_hint('call_routes.form.endpoint_id.hint') + = f.input :endpoint_str, :collection => @endpoints, :label => t('call_routes.form.endpoint.label'), :hint => conditional_hint('call_routes.form.endpoint.hint'), :include_blank => false diff --git a/config/locales/views/call_routes/de.yml b/config/locales/views/call_routes/de.yml index a8d6f4b..77b597b 100644 --- a/config/locales/views/call_routes/de.yml +++ b/config/locales/views/call_routes/de.yml @@ -46,10 +46,7 @@ de: name: label: 'Name' hint: '' - endpoint_type: - label: 'Endpoint type' - hint: '' - endpoint_id: + endpoint: label: 'Endpoint' hint: '' position: diff --git a/config/locales/views/call_routes/en.yml b/config/locales/views/call_routes/en.yml index 8596474..c37773d 100644 --- a/config/locales/views/call_routes/en.yml +++ b/config/locales/views/call_routes/en.yml @@ -46,10 +46,7 @@ en: name: label: 'Name' hint: '' - endpoint_type: - label: 'Endpoint type' - hint: '' - endpoint_id: + endpoint: label: 'Endpoint' hint: '' position: |