Module: Biovision::Components::Base::EntityLinks
- Included in:
- Biovision::Components::BaseComponent
- Defined in:
- app/lib/biovision/components/base/entity_links.rb
Overview
Links for entities in context of current user
Instance Method Summary collapse
Instance Method Details
#entity_link(entity, scope = '') ⇒ Object
15 16 17 18 19 20 |
# File 'app/lib/biovision/components/base/entity_links.rb', line 15 def entity_link(entity, scope = '') default = "#{scope}/#{entity.class.table_name}/#{entity.id}" prefix = %i[admin my].include?(scope.to_sym) ? scope : 'world' = "#{prefix}_url".to_sym entity.respond_to?() ? entity.send() : "/#{default}" end |
#text_for_link(entity) ⇒ Object
9 10 11 |
# File 'app/lib/biovision/components/base/entity_links.rb', line 9 def text_for_link(entity) entity.respond_to?(:text_for_link) ? entity.text_for_link : entity.id end |