Sha256: 36c72d7b2c05089f13e26f8333d179e3214487eba57f6bc1be234cabc60cf54a
Contents?: true
Size: 1005 Bytes
Versions: 5
Compression:
Stored size: 1005 Bytes
Contents
module LinkHelper def link_to_show(value) link_to( icon(:search), path_from_string_or_object(value), title: t('b.view') ) end def link_to_edit(value) link_to( icon(:pencil_square_o), path_from_string_or_object(value, 'edit_'), title: t('b.edit') ) end def link_to_edit_translation(object, locale = Udongo.config.i18n.app.default_locale) str = "edit_translation_#{Udongo::ObjectPath.find(object)}" url = send(str, *Udongo::ObjectPath.remove_symbols(object), locale) link_to_edit(url) end def link_to_delete(value) link_to( icon(:trash), path_from_string_or_object(value), method: :delete, data: { confirm: t('b.msg.confirm') }, title: t('b.delete') ) end private def path_from_string_or_object(value, prefix = nil) return value if value.is_a?(String) str = "#{prefix}#{Udongo::ObjectPath.find(value)}" send(str, *Udongo::ObjectPath.remove_symbols(value)) end end
Version data entries
5 entries across 5 versions & 1 rubygems