summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/call_routes_controller.rb11
-rw-r--r--app/models/call_route.rb4
-rw-r--r--app/views/call_routes/_form_core.html.haml3
3 files changed, 16 insertions, 2 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