Module: Kaui::UuidHelper
- Defined in:
- app/helpers/kaui/uuid_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.truncate_uuid(uuid) ⇒ Object
5 6 7 8 9 10 |
# File 'app/helpers/kaui/uuid_helper.rb', line 5 def truncate_uuid(uuid) return uuid unless uuid =~ /[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}/ split = uuid.split('-') "#{split[0]}-...-#{split[4]}" end |
Instance Method Details
#object_id_popover(object_id, placement = 'right', title = nil) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/helpers/kaui/uuid_helper.rb', line 13 def object_id_popover(object_id, placement = 'right', title = nil) content_tag(:span, truncate_uuid(object_id), id: "#{object_id}-popover", class: 'object-id-popover', title: title, data: { id: object_id, placement: placement }) end |