From 02818937b8f7de0ae2417337c30771827d7c1c9e Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 26 Apr 2013 10:45:45 +0200 Subject: breadcrumbs added --- app/controllers/generic_files_controller.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app') diff --git a/app/controllers/generic_files_controller.rb b/app/controllers/generic_files_controller.rb index b3c0390..ddedbe5 100644 --- a/app/controllers/generic_files_controller.rb +++ b/app/controllers/generic_files_controller.rb @@ -11,6 +11,7 @@ class GenericFilesController < ApplicationController load_and_authorize_resource :generic_file, :through => [:sip_account, :conference, :hunt_group, :automatic_call_distributor, :user, :tenant] before_filter :set_and_authorize_parent + before_filter :spread_breadcrumbs def index @generic_files = @parent.generic_files @@ -69,4 +70,18 @@ class GenericFilesController < ApplicationController authorize! :read, @parent end + + def spread_breadcrumbs + if @parent.class == User + add_breadcrumb t("users.index.page_title"), tenant_users_path(@parent.current_tenant) + add_breadcrumb @parent, tenant_user_path(@parent.current_tenant, @parent) + end + + add_breadcrumb t("generic_files.index.page_title"), method( :"#{@parent.class.name.underscore}_generic_files_url" ).(@parent) + + if @generic_file + add_breadcrumb @generic_file + end + + end end -- cgit v1.2.3