Sha256: 1dfed0ae6890286615eb2b05434c798c41fe23b8e46e157d41bf1310e442acea

Contents?: true

Size: 1016 Bytes

Versions: 36

Compression:

Stored size: 1016 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbContact
    class Contact
      include ActionView::Helpers::NumberHelper
      include Playbook::Props

      partial "pb_contact/contact"

      prop :contact_type
      prop :contact_value
      prop :contact_detail

      def classname
        generate_classname("pb_contact_kit")
      end

      def contact_icon
        case contact_type
        when "cell"
          "mobile"
        when "home"
          "phone"
        when "work"
          "phone-office"
        when "email"
          "envelope"
        when "wrong-phone"
          "phone-slash"
        else # "unknown" || "other"
          "phone"
        end
      end

      def formatted_contact_value
        if contact_type == "email"
          contact_value
        else
          number_to_phone(formatted_value, area_code: true)
        end
      end

    private

      def formatted_value
        contact_value.to_s.gsub(/\D/, "")
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
playbook_ui-4.14.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.13.1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.13.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.12.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.11.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.10.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.9.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.8.2 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.8.1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.7.1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.7.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.6.1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.6.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.5.2 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-4.5.1 app/pb_kits/playbook/pb_contact/contact.rb