Sha256: 98598ce43913e19ba06cf0953332f1936ae4e81845d28c560c4f276b7a23f649

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

module CustomerVault
  module ApplicationHelper
    def customer_vault_breadcrumb
      breadcrumb = []

      breadcrumb << link_to(icon(:home), "/")

      breadcrumb << link_to(t("customer_vault"), customer_vault.people_path)

      person = @person || @individual || @corporation
      breadcrumb << link_to(person.name, person) if person.present? && person.persisted?

      if params[:controller].to_s.include?("links")
        breadcrumb << CustomerVault::Link.model_name.human.pluralize
        breadcrumb << @link.title if @link.try(:title).present?
      end

      # Add action
      action      = params[:action]
      action_name = t("actions.#{action}")
      breadcrumb << action_name unless action == "show"

      # Last element is not a link
      breadcrumb << strip_tags(breadcrumb.pop)

      breadcrumb
    end

    def person_tags(person)
      return if person.tag_list.empty?

      person.tag_list.map { |tag|
        content_tag(:span, class: "tag label label-primary"){
          "#{icon :tag} #{tag}".html_safe
        }
      }.join(" ").html_safe
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
customer_vault-1.3.2 app/helpers/customer_vault/application_helper.rb
customer_vault-1.3.1 app/helpers/customer_vault/application_helper.rb
customer_vault-1.3.0 app/helpers/customer_vault/application_helper.rb
customer_vault-1.2.10 app/helpers/customer_vault/application_helper.rb
customer_vault-1.2.9 app/helpers/customer_vault/application_helper.rb