summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/acd_agents_controller.rb32
-rw-r--r--app/controllers/calls_controller.rb2
-rw-r--r--app/controllers/softkeys_controller.rb3
3 files changed, 23 insertions, 14 deletions
diff --git a/app/controllers/acd_agents_controller.rb b/app/controllers/acd_agents_controller.rb
index 4c08f68..e2aabdf 100644
--- a/app/controllers/acd_agents_controller.rb
+++ b/app/controllers/acd_agents_controller.rb
@@ -1,7 +1,7 @@
class AcdAgentsController < ApplicationController
- load_and_authorize_resource :automatic_call_distributor
- load_and_authorize_resource :acd_agent, :through => [:automatic_call_distributor]
-
+ load_and_authorize_resource :automatic_call_distributor, :except => [:toggle]
+ load_and_authorize_resource :acd_agent, :through => [:automatic_call_distributor], :except => [:toggle]
+ load_and_authorize_resource :acd_agent, :only => [:toggle]
before_filter :spread_breadcrumbs
def index
@@ -62,16 +62,24 @@ class AcdAgentsController < ApplicationController
redirect_to automatic_call_distributor_acd_agents_path(@automatic_call_distributor), :notice => t('acd_agents.controller.successfuly_destroyed')
end
+ def toggle
+ @acd_agent.toggle_status
+ redirect_to request.referer
+ end
+
+ private
def spread_breadcrumbs
- if @automatic_call_distributor.automatic_call_distributorable.class == User
- add_breadcrumb t("#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore.pluralize}.index.page_title"), method( :"tenant_#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore.pluralize}_path" ).(@automatic_call_distributor.tenant)
- add_breadcrumb @automatic_call_distributor.automatic_call_distributorable, method( :"tenant_#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore}_path" ).(@automatic_call_distributor.tenant, @automatic_call_distributor.automatic_call_distributorable)
- end
- add_breadcrumb t("automatic_call_distributors.index.page_title"), method( :"#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore}_automatic_call_distributors_path" ).(@automatic_call_distributor.automatic_call_distributorable)
- add_breadcrumb @automatic_call_distributor, method( :"#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore}_automatic_call_distributor_path" ).(@automatic_call_distributor.automatic_call_distributorable, @automatic_call_distributor)
- add_breadcrumb t("acd_agents.index.page_title"), automatic_call_distributor_acd_agents_path(@automatic_call_distributor)
- if @acd_agent && !@acd_agent.new_record?
- add_breadcrumb @acd_agent, automatic_call_distributor_acd_agent_path(@automatic_call_distributor, @acd_agent)
+ if @automatic_call_distributor
+ if @automatic_call_distributor.automatic_call_distributorable.class == User
+ add_breadcrumb t("#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore.pluralize}.index.page_title"), method( :"tenant_#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore.pluralize}_path" ).(@automatic_call_distributor.tenant)
+ add_breadcrumb @automatic_call_distributor.automatic_call_distributorable, method( :"tenant_#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore}_path" ).(@automatic_call_distributor.tenant, @automatic_call_distributor.automatic_call_distributorable)
+ end
+ add_breadcrumb t("automatic_call_distributors.index.page_title"), method( :"#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore}_automatic_call_distributors_path" ).(@automatic_call_distributor.automatic_call_distributorable)
+ add_breadcrumb @automatic_call_distributor, method( :"#{@automatic_call_distributor.automatic_call_distributorable.class.name.underscore}_automatic_call_distributor_path" ).(@automatic_call_distributor.automatic_call_distributorable, @automatic_call_distributor)
+ add_breadcrumb t("acd_agents.index.page_title"), automatic_call_distributor_acd_agents_path(@automatic_call_distributor)
+ if @acd_agent && !@acd_agent.new_record?
+ add_breadcrumb @acd_agent, automatic_call_distributor_acd_agent_path(@automatic_call_distributor, @acd_agent)
+ end
end
end
end
diff --git a/app/controllers/calls_controller.rb b/app/controllers/calls_controller.rb
index 9d85a10..6182ad8 100644
--- a/app/controllers/calls_controller.rb
+++ b/app/controllers/calls_controller.rb
@@ -31,7 +31,7 @@ class CallsController < ApplicationController
end
def create
- @call = @sip_account.calls.create(params[:call])
+ @call = @sip_account.call_legs.build(params[:call])
if @call && @call.call
m = method( :"#{@parent.class.name.underscore}_calls_url" )
diff --git a/app/controllers/softkeys_controller.rb b/app/controllers/softkeys_controller.rb
index 9179d8c..6727de1 100644
--- a/app/controllers/softkeys_controller.rb
+++ b/app/controllers/softkeys_controller.rb
@@ -2,7 +2,7 @@ class SoftkeysController < ApplicationController
load_and_authorize_resource :sip_account, :except => [:sort]
load_and_authorize_resource :softkey, :through => [:sip_account], :except => [:sort]
- before_filter :set_available_softkey_functions, :only => [ :new, :edit, :update ]
+ before_filter :set_available_softkey_functions, :only => [ :new, :edit, :update, :create ]
before_filter :spread_breadcrumbs, :except => [:sort]
def index
@@ -35,6 +35,7 @@ class SoftkeysController < ApplicationController
redirect_to sip_account_softkey_path(@softkey.sip_account, @softkey), :notice => t('softkeys.controller.successfuly_updated')
else
delete_call_forward_softkey_if_no_callforward_is_available
+
render :edit
end
end