summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/call_forwards_controller.rb14
-rw-r--r--app/controllers/intruders_controller.rb4
-rw-r--r--app/controllers/ringtones_controller.rb12
3 files changed, 18 insertions, 12 deletions
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/intruders_controller.rb b/app/controllers/intruders_controller.rb
index 147e06d..d3c767e 100644
--- a/app/controllers/intruders_controller.rb
+++ b/app/controllers/intruders_controller.rb
@@ -1,6 +1,8 @@
class IntrudersController < ApplicationController
+ load_and_authorize_resource :intruder
+
def index
- @intruders = Intruder.all
+ @intruders = Intruder.order('list_type ASC, contact_last DESC').all
spread_breadcrumbs
end
diff --git a/app/controllers/ringtones_controller.rb b/app/controllers/ringtones_controller.rb
index 7ffe30e..e5a4f64 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
@@ -14,12 +15,13 @@ class RingtonesController < ApplicationController
def new
@ringtone = @parent.ringtones.build
+ @ringtone.bellcore_id = GsParameter.get('default_ringtone', 'dialplan', 'parameters')
end
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 +32,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 +40,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