summaryrefslogtreecommitdiff
path: root/app/controllers/call_routes_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-02 11:44:11 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-02 11:44:11 +0100
commitb8c39c59cf7e698d5653cc49fa746506a9c41e24 (patch)
treeb5f782af7817270fc610f7756082608d00685e19 /app/controllers/call_routes_controller.rb
parentaad8a03991fe616f84fa18ed1db81831220f8d64 (diff)
parentba5b2737365592cc511a526a3b14be46c3a75467 (diff)
Merge branch 'sortable' into develop
Diffstat (limited to 'app/controllers/call_routes_controller.rb')
-rw-r--r--app/controllers/call_routes_controller.rb27
1 files changed, 11 insertions, 16 deletions
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
index 894dd61..779e23c 100644
--- a/app/controllers/call_routes_controller.rb
+++ b/app/controllers/call_routes_controller.rb
@@ -1,11 +1,11 @@
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
- }
+ # 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])
@@ -64,21 +64,16 @@ class CallRoutesController < ApplicationController
redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed')
end
- def move_higher
- @call_route = CallRoute.find(params[:id])
- @call_route.move_higher
- redirect_to :back
- end
-
- def move_lower
- @call_route = CallRoute.find(params[:id])
- @call_route.move_lower
- redirect_to :back
+ def sort
+ params[:call_route].each_with_index do |id, index|
+ CallRoute.update_all({position: index+1}, {id: id})
+ end
+ render nothing: true
end
private
def call_route_parameter_params
- params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id)
+ params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id, :position)
end
def spread_breadcrumbs