From 113e3c6c6117fbeca7b9bf1f0e6dc26b0db9c407 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 16 Jan 2013 08:33:45 -0500 Subject: call_routes added --- app/controllers/call_routes_controller.rb | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/controllers/call_routes_controller.rb (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb new file mode 100644 index 0000000..631339b --- /dev/null +++ b/app/controllers/call_routes_controller.rb @@ -0,0 +1,41 @@ +class CallRoutesController < ApplicationController + def index + @call_routes = CallRoute.all + end + + def show + @call_route = CallRoute.find(params[:id]) + end + + def new + @call_route = CallRoute.new + end + + def create + @call_route = CallRoute.new(params[:call_route]) + if @call_route.save + redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') + else + render :new + end + end + + def edit + @call_route = CallRoute.find(params[:id]) + end + + def update + @call_route = CallRoute.find(params[:id]) + if @call_route.update_attributes(params[:call_route]) + redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @call_route = CallRoute.find(params[:id]) + @call_route.destroy + redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') + end +end -- cgit v1.2.3 From 0ee17f52f8ad337c1240b4c55dbd8f6c6c74dc90 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 16:32:59 +0100 Subject: Fixed routes and breadcrumbs. #106 --- app/controllers/call_routes_controller.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 631339b..41abe6d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,14 +1,15 @@ class CallRoutesController < ApplicationController + load_and_authorize_resource :call_route + + before_filter :spread_breadcrumbs + def index - @call_routes = CallRoute.all end def show - @call_route = CallRoute.find(params[:id]) end def new - @call_route = CallRoute.new end def create @@ -21,11 +22,9 @@ class CallRoutesController < ApplicationController end def edit - @call_route = CallRoute.find(params[:id]) end def update - @call_route = CallRoute.find(params[:id]) if @call_route.update_attributes(params[:call_route]) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else @@ -34,8 +33,16 @@ class CallRoutesController < ApplicationController end def destroy - @call_route = CallRoute.find(params[:id]) @call_route.destroy redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') end + + private + def spread_breadcrumbs + add_breadcrumb t("call_routes.index.page_title"), call_routes_path + if @call_route && !@call_route.new_record? + add_breadcrumb @call_route, call_route_path(@call_route) + end + end + end -- cgit v1.2.3 From 24e47521f1a57c73dc349de35909af7e1f8a4a1f Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 17 Jan 2013 17:50:47 +0100 Subject: group by table --- app/controllers/call_routes_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 41abe6d..b0c173d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -4,6 +4,8 @@ class CallRoutesController < ApplicationController before_filter :spread_breadcrumbs def index + @call_routes = CallRoute.order(['`table`', :position]) + @tables = @call_routes.pluck('`table`').uniq.sort end def show -- cgit v1.2.3 From 17206a20e5bcb44fa4d90f0e176f7aa0fe43bca3 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 17 Jan 2013 21:51:58 +0100 Subject: rename_column table to routing_table --- app/controllers/call_routes_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index b0c173d..130a160 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -4,8 +4,8 @@ class CallRoutesController < ApplicationController before_filter :spread_breadcrumbs def index - @call_routes = CallRoute.order(['`table`', :position]) - @tables = @call_routes.pluck('`table`').uniq.sort + @call_routes = CallRoute.order([:routing_table, :position]) + @routing_tables = @call_routes.pluck(:routing_table).uniq.sort end def show -- cgit v1.2.3 From 73c9984510d572030329d967e44c6adb00d98613 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 08:11:56 +0100 Subject: Clean up mess which was created by renaming :table to :routing_table. --- app/controllers/call_routes_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 130a160..89f66ba 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -15,7 +15,7 @@ class CallRoutesController < ApplicationController end def create - @call_route = CallRoute.new(params[:call_route]) + @call_route = CallRoute.new(call_route_parameter_params[:call_route]) if @call_route.save redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') else @@ -27,7 +27,7 @@ class CallRoutesController < ApplicationController end def update - if @call_route.update_attributes(params[:call_route]) + if @call_route.update_attributes(call_route_parameter_params[:call_route]) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else render :edit @@ -40,6 +40,10 @@ class CallRoutesController < ApplicationController end private + def call_route_parameter_params + params.require(:call_route).permit(:id, :routing_table, :name, :endpoint_type, :endpoint_id, :position) + end + def spread_breadcrumbs add_breadcrumb t("call_routes.index.page_title"), call_routes_path if @call_route && !@call_route.new_record? @@ -47,4 +51,5 @@ class CallRoutesController < ApplicationController end end + end -- cgit v1.2.3 From 5efd9bdd2f78a15569fb7d1569dceff3bb4f8800 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 10:19:09 +0100 Subject: Fixed a strange strong_parameter cancan bug. --- app/controllers/call_routes_controller.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 89f66ba..8b8698f 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,6 +1,4 @@ class CallRoutesController < ApplicationController - load_and_authorize_resource :call_route - before_filter :spread_breadcrumbs def index @@ -9,13 +7,15 @@ class CallRoutesController < ApplicationController end def show + @call_route = CallRoute.find(params[:id]) end def new + @call_route = CallRoute.new end def create - @call_route = CallRoute.new(call_route_parameter_params[:call_route]) + @call_route = CallRoute.new(call_route_parameter_params) if @call_route.save redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') else @@ -27,7 +27,8 @@ class CallRoutesController < ApplicationController end def update - if @call_route.update_attributes(call_route_parameter_params[:call_route]) + @call_route = CallRoute.find(params[:id]) + if @call_route.update_attributes(call_route_parameter_params) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else render :edit @@ -35,13 +36,14 @@ class CallRoutesController < ApplicationController end def destroy + @call_route = CallRoute.find(params[:id]) @call_route.destroy redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') end private def call_route_parameter_params - params.require(:call_route).permit(:id, :routing_table, :name, :endpoint_type, :endpoint_id, :position) + params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id) end def spread_breadcrumbs @@ -51,5 +53,4 @@ class CallRoutesController < ApplicationController end end - end -- cgit v1.2.3 From 277744c7412c44b54ff46c1d6548c2c4242327e3 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 15:20:20 +0100 Subject: added load_and_authorize_resource :call_route --- app/controllers/call_routes_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 8b8698f..cdb425b 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,4 +1,5 @@ class CallRoutesController < ApplicationController + load_and_authorize_resource :call_route before_filter :spread_breadcrumbs def index -- cgit v1.2.3 From 6defcadbb9500efbfcf487c384ad41f958f5e46f Mon Sep 17 00:00:00 2001 From: spag Date: Sat, 19 Jan 2013 09:09:04 +0100 Subject: move actions added --- app/controllers/call_routes_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index cdb425b..5ef7c4b 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -42,6 +42,16 @@ class CallRoutesController < ApplicationController redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') end + def move_higher + @call_route.move_higher + redirect_to :back + end + + def move_lower + @call_route.move_lower + redirect_to :back + end + private def call_route_parameter_params params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id) -- cgit v1.2.3 From a2abe7dffb8fe31687910ca4be6dc0374a247d00 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 20:07:28 +0100 Subject: Fixed some strange cancan problem. #119 --- app/controllers/call_routes_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 5ef7c4b..0f4a02d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,5 +1,5 @@ class CallRoutesController < ApplicationController - load_and_authorize_resource :call_route + authorize_resource :call_route before_filter :spread_breadcrumbs def index @@ -25,6 +25,7 @@ class CallRoutesController < ApplicationController end def edit + @call_route = CallRoute.find(params[:id]) end def update -- cgit v1.2.3 From fb18fd9bae2d24bef4652b40a4b0d206b77ebb4f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 21:09:10 +0100 Subject: Added breadcrumbs. --- app/controllers/call_routes_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 0f4a02d..2437d8d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,22 +1,25 @@ class CallRoutesController < ApplicationController authorize_resource :call_route - before_filter :spread_breadcrumbs def index @call_routes = CallRoute.order([:routing_table, :position]) @routing_tables = @call_routes.pluck(:routing_table).uniq.sort + spread_breadcrumbs end def show @call_route = CallRoute.find(params[:id]) + spread_breadcrumbs end def new @call_route = CallRoute.new + spread_breadcrumbs end def create @call_route = CallRoute.new(call_route_parameter_params) + spread_breadcrumbs if @call_route.save redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') else @@ -26,10 +29,12 @@ class CallRoutesController < ApplicationController def edit @call_route = CallRoute.find(params[:id]) + spread_breadcrumbs end def update @call_route = CallRoute.find(params[:id]) + spread_breadcrumbs if @call_route.update_attributes(call_route_parameter_params) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else @@ -61,7 +66,7 @@ class CallRoutesController < ApplicationController def spread_breadcrumbs add_breadcrumb t("call_routes.index.page_title"), call_routes_path if @call_route && !@call_route.new_record? - add_breadcrumb @call_route, call_route_path(@call_route) + add_breadcrumb @call_route, @call_route end end -- cgit v1.2.3 From a6779c02f83d1873ebc33b1610013dcbadfeb10b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 11:07:54 +0100 Subject: Bug fix #121 --- app/controllers/call_routes_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers/call_routes_controller.rb') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 2437d8d..0259a10 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -49,11 +49,13 @@ class CallRoutesController < ApplicationController 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 end -- cgit v1.2.3