summaryrefslogtreecommitdiff
path: root/app/controllers/calls_controller.rb
diff options
context:
space:
mode:
authorMario "Kuroir" Ricalde <kuroir@gmail.com>2013-03-05 11:01:01 -0600
committerMario "Kuroir" Ricalde <kuroir@gmail.com>2013-03-05 11:01:01 -0600
commit4fcdd330139921b6fa5d4f9d15fb5f91775b27af (patch)
tree62e82c385c9a804a8f32da6f276881ff8c21fc90 /app/controllers/calls_controller.rb
parent2b94b16ee1201d15b3b9d66e142df311141a47db (diff)
parenta865b1f9506b900ed8643c01d94c86268e907720 (diff)
Merge remote-tracking branch 'origin/develop' into develop
Diffstat (limited to 'app/controllers/calls_controller.rb')
-rw-r--r--app/controllers/calls_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/calls_controller.rb b/app/controllers/calls_controller.rb
index 5534b1b..22ff92d 100644
--- a/app/controllers/calls_controller.rb
+++ b/app/controllers/calls_controller.rb
@@ -3,6 +3,7 @@ class CallsController < ApplicationController
load_resource :call
before_filter :set_and_authorize_parent
+ before_filter :spread_breadcrumbs
def index
if @parent
@@ -55,4 +56,20 @@ class CallsController < ApplicationController
def set_and_authorize_parent
@parent = @sip_account
end
+
+ def spread_breadcrumbs
+ if @parent.class == SipAccount
+ if @sip_account.sip_accountable.class == User
+ add_breadcrumb t('users.name'), tenant_users_path(@sip_account.sip_accountable.current_tenant)
+ add_breadcrumb @sip_account.sip_accountable, tenant_user_path(@sip_account.sip_accountable.current_tenant, @sip_account.sip_accountable)
+ add_breadcrumb t('sip_accounts.index.page_title'), user_sip_accounts_path(@sip_account.sip_accountable)
+ add_breadcrumb @sip_account, user_sip_account_path(@sip_account.sip_accountable, @sip_account)
+ add_breadcrumb t('calls.index.page_title'), sip_account_calls_path(@sip_account)
+ elsif @sip_account.sip_accountable.class == Tenant
+ add_breadcrumb t('sip_accounts.index.page_title'), tenant_sip_accounts_path(@sip_account.sip_accountable)
+ add_breadcrumb @sip_account, tenant_sip_account_path(@sip_account.sip_accountable, @sip_account)
+ add_breadcrumb t('calls.index.page_title'), sip_account_calls_path(@sip_account)
+ end
+ end
+ end
end