From fd07b7b85d2d40d7d2999c2899cc890eda2095fd Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 25 Feb 2013 11:41:55 -0500 Subject: more polymorphic objects --- app/controllers/call_forwards_controller.rb | 14 ++++++++------ app/controllers/ringtones_controller.rb | 11 ++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb index cd72a38..34fb77a 100644 --- a/app/controllers/call_forwards_controller.rb +++ b/app/controllers/call_forwards_controller.rb @@ -48,8 +48,8 @@ class CallForwardsController < ApplicationController @call_forward = @parent.call_forwards.build( params[:call_forward] ) if @call_forward.save - m = method( :"#{@parent.class.name.underscore}_call_forward_path" ) - redirect_to m.( @parent, @call_forward ), :notice => t('call_forwards.controller.successfuly_created') + m = method( :"#{@parent.class.name.underscore}_call_forwards_url" ) + redirect_to m.( @parent ), :notice => t('call_forwards.controller.successfuly_created') else @available_call_forward_cases = CallForwardCase.all render :new @@ -64,8 +64,8 @@ class CallForwardsController < ApplicationController def update @available_call_forward_cases = CallForwardCase.all if @call_forward.update_attributes(params[:call_forward]) - m = method( :"#{@parent.class.name.underscore}_call_forward_path" ) - redirect_to m.( @parent, @call_forward ), :notice => t('call_forwards.controller.successfuly_updated') + m = method( :"#{@parent.class.name.underscore}_call_forwards_url" ) + redirect_to m.( @parent ), :notice => t('call_forwards.controller.successfuly_updated') else @call_forwarding_destinations = call_forwarding_destination_types() render :edit @@ -74,7 +74,8 @@ class CallForwardsController < ApplicationController def destroy @call_forward.destroy - redirect_to :root, :notice => t('call_forwards.controller.successfuly_destroyed') + m = method( :"#{@parent.class.name.underscore}_call_forwards_url" ) + redirect_to m.( @parent ), :notice => t('call_forwards.controller.successfuly_destroyed') end private @@ -110,7 +111,8 @@ class CallForwardsController < ApplicationController add_breadcrumb @sip_account, tenant_sip_account_path(@tenant, @sip_account) end - add_breadcrumb t("call_forwards.index.page_title"), phone_number_call_forwards_path(@parent) + m = method( :"#{@parent.class.name.underscore}_call_forwards_url" ) + add_breadcrumb t("call_forwards.index.page_title"), m.(@parent) if @call_forward && !@call_forward.new_record? m = method( :"#{@parent.class.name.underscore}_call_forward_path" ) add_breadcrumb @call_forward, m.(@parent, @call_forward) diff --git a/app/controllers/ringtones_controller.rb b/app/controllers/ringtones_controller.rb index 7ffe30e..f726650 100644 --- a/app/controllers/ringtones_controller.rb +++ b/app/controllers/ringtones_controller.rb @@ -1,7 +1,8 @@ class RingtonesController < ApplicationController load_resource :phone_number + load_resource :sip_account load_resource :boss_assistant_cooperation - load_and_authorize_resource :ringtone, :through => [:phone_number, :boss_assistant_cooperation] + load_and_authorize_resource :ringtone, :through => [:phone_number, :sip_account, :boss_assistant_cooperation] before_filter :set_parent before_filter :spread_breadcrumbs @@ -19,7 +20,7 @@ class RingtonesController < ApplicationController def create @ringtone = @parent.ringtones.build(params[:ringtone]) if @ringtone.save - redirect_to phone_number_ringtone_path(@parent, @ringtone), :notice => t('ringtones.controller.successfuly_created') + redirect_to method( :"#{@parent.class.name.underscore}_ringtones_url" ).(@parent), :notice => t('ringtones.controller.successfuly_created') else render :new end @@ -30,7 +31,7 @@ class RingtonesController < ApplicationController def update if @ringtone.update_attributes(params[:ringtone]) - redirect_to method( :"#{@parent.class.name.underscore}_ringtone_path" ).(@ringtone.ringtoneable, @ringtone), :notice => t('ringtones.controller.successfuly_updated') + redirect_to method( :"#{@parent.class.name.underscore}_ringtones_url" ).(@parent), :notice => t('ringtones.controller.successfuly_updated') else render :edit end @@ -38,12 +39,12 @@ class RingtonesController < ApplicationController def destroy @ringtone.destroy - redirect_to phone_number_ringtones_path(@parent), :notice => t('ringtones.controller.successfuly_destroyed') + redirect_to method( :"#{@parent.class.name.underscore}_ringtones_url" ).(@parent), :notice => t('ringtones.controller.successfuly_destroyed') end private def set_parent - @parent = @phone_number || @boss_assistant_cooperation + @parent = @phone_number || @boss_assistant_cooperation || @sip_account end def spread_breadcrumbs -- cgit v1.2.3 From dca264b22845b7875b9493c17cc185e809372cc1 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 25 Feb 2013 11:58:20 -0500 Subject: use dialplan ringtone as default --- app/controllers/ringtones_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers') diff --git a/app/controllers/ringtones_controller.rb b/app/controllers/ringtones_controller.rb index f726650..e5a4f64 100644 --- a/app/controllers/ringtones_controller.rb +++ b/app/controllers/ringtones_controller.rb @@ -15,6 +15,7 @@ class RingtonesController < ApplicationController def new @ringtone = @parent.ringtones.build + @ringtone.bellcore_id = GsParameter.get('default_ringtone', 'dialplan', 'parameters') end def create -- cgit v1.2.3 From 387ce8f6694b41ab73d264190ce41dcd13484ede Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 25 Feb 2013 18:03:42 -0500 Subject: icons --- app/controllers/intruders_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb index 147e06d..99cb023 100644 --- a/app/controllers/intruders_controller.rb +++ b/app/controllers/intruders_controller.rb @@ -1,6 +1,6 @@ class IntrudersController < ApplicationController def index - @intruders = Intruder.all + @intruders = Intruder.order('list_type ASC, contact_last DESC').all spread_breadcrumbs end -- cgit v1.2.3 From ad2121462a9ea9a776756a188779a9d504f078b7 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 25 Feb 2013 18:11:50 -0500 Subject: authorization added --- app/controllers/intruders_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb index 99cb023..d3c767e 100644 --- a/app/controllers/intruders_controller.rb +++ b/app/controllers/intruders_controller.rb @@ -1,4 +1,6 @@ class IntrudersController < ApplicationController + load_and_authorize_resource :intruder + def index @intruders = Intruder.order('list_type ASC, contact_last DESC').all spread_breadcrumbs -- cgit v1.2.3