diff options
-rw-r--r-- | app/controllers/fax_documents_controller.rb | 25 | ||||
-rw-r--r-- | app/views/fax_accounts/_index_core.html.haml | 4 |
2 files changed, 12 insertions, 17 deletions
diff --git a/app/controllers/fax_documents_controller.rb b/app/controllers/fax_documents_controller.rb index eff9604..5653683 100644 --- a/app/controllers/fax_documents_controller.rb +++ b/app/controllers/fax_documents_controller.rb @@ -58,23 +58,18 @@ class FaxDocumentsController < ApplicationController end private + def spread_breadcrumbs - breadcrumbs = [] - breadcrumbs = case @fax_account.fax_accountable.class.to_s - when 'User' ; [ - [@fax_account.fax_accountable.to_s, user_path(@fax_account.fax_accountable)], - [t('fax_accounts.name').pluralize, user_fax_accounts_path(@fax_account.fax_accountable)], - [t('fax_documents.name').pluralize, fax_account_fax_documents_path(@fax_account)], - ] - when 'UserGroup' ; [ - [@fax_account.fax_accountable, user_group_path(@fax_account.fax_accountable)], - [t('fax_accounts.name').pluralize, user_group_fax_accounts_path(@fax_account.fax_accountable)], - [t('fax_documents.name').pluralize, fax_account_fax_documents_path(@fax_account)], - ] + if @fax_account && @fax_account.fax_accountable.class == User + add_breadcrumb t("users.index.page_title"), tenant_users_path(@fax_account.fax_accountable.current_tenant) + add_breadcrumb @fax_account.fax_accountable, tenant_user_path(@fax_account.fax_accountable.current_tenant, @fax_account.fax_accountable) end - if !breadcrumbs.blank? - breadcrumbs.each do |breadcrumb| - add_breadcrumb breadcrumb[0], breadcrumb[1] + + if @fax_account + add_breadcrumb t("fax_accounts.index.page_title"), user_fax_accounts_path(@fax_account.fax_accountable) + add_breadcrumb @fax_account, user_fax_account_path(@fax_account.fax_accountable, @fax_account) + if @fax_document && !@fax_document.new_record? + add_breadcrumb @fax_document, fax_account_fax_document_path(@fax_account, @fax_document) end end end diff --git a/app/views/fax_accounts/_index_core.html.haml b/app/views/fax_accounts/_index_core.html.haml index d694f8f..846cda8 100644 --- a/app/views/fax_accounts/_index_core.html.haml +++ b/app/views/fax_accounts/_index_core.html.haml @@ -39,8 +39,8 @@ = time_ago_in_words(fax_account.fax_documents.order(:updated_at).last.updated_at) %td - if can?(:new, FaxDocument, :fax_account_id => fax_account.id) - %a.btn.btn-mini.btn-primary{:href => new_fax_account_fax_document_path(fax_account) } - %i.icon-print.icon-white + %a.btn.btn-small{:href => new_fax_account_fax_document_path(fax_account) } + %i.icon-print %span.hidden-phone =t('fax_accounts.index.send_a_fax') |