diff options
author | Peter Kozak <spag@golwen.net> | 2013-04-26 12:14:55 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-04-26 12:14:55 +0200 |
commit | a94fafb695e19715505e05ab71034b14d7bde8c1 (patch) | |
tree | e8823a9a329ca0018be8b85b6a73cad8e0d9a45f | |
parent | af24d971e2cd913ad6ad3bcf58e47469090b1eda (diff) |
breadcrumbs added
-rw-r--r-- | app/controllers/voicemail_settings_controller.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/voicemail_settings_controller.rb b/app/controllers/voicemail_settings_controller.rb index 8a7c411..f270c3d 100644 --- a/app/controllers/voicemail_settings_controller.rb +++ b/app/controllers/voicemail_settings_controller.rb @@ -2,6 +2,8 @@ class VoicemailSettingsController < ApplicationController load_and_authorize_resource :voicemail_account load_and_authorize_resource :voicemail_setting, :through => [:voicemail_account] + before_filter :spread_breadcrumbs + def index @voicemail_settings = @voicemail_account.voicemail_settings end @@ -60,4 +62,21 @@ class VoicemailSettingsController < ApplicationController m = method( :"#{@voicemail_account.voicemail_accountable.class.name.underscore}_voicemail_account_path" ) redirect_to m.( @voicemail_account.voicemail_accountable, @voicemail_account ), :notice => t('voicemail_settings.controller.successfuly_destroyed') end + + private + def spread_breadcrumbs + voicemail_accountable = @voicemail_account.voicemail_accountable + if voicemail_accountable.class == User + add_breadcrumb t("users.index.page_title"), tenant_users_path(voicemail_accountable.current_tenant) + add_breadcrumb voicemail_accountable, tenant_user_path(voicemail_accountable.current_tenant, voicemail_accountable) + end + + add_breadcrumb t("voicemail_accounts.index.page_title"), method( :"#{voicemail_accountable.class.name.underscore}_voicemail_accounts_url" ).(voicemail_accountable) + add_breadcrumb @voicemail_account.name, method( :"#{voicemail_accountable.class.name.underscore}_voicemail_account_path" ).(voicemail_accountable, @voicemail_account) + add_breadcrumb t("voicemail_settings.index.page_title"), voicemail_account_voicemail_settings_url(@voicemail_account) + + if !@voicemail_setting.to_s.blank? + add_breadcrumb @voicemail_setting + end + end end |