Sha256: 00ddbc443b2cd9ab13533911c55c4f17f80a5067ca10eb1d33f8b7103815877b
Contents?: true
Size: 733 Bytes
Versions: 2
Compression:
Stored size: 733 Bytes
Contents
module Trestle module UrlHelper def admin_link_to(content, instance=nil, options={}, &block) if block_given? instance, options = content, instance || {} content = capture(&block) end if options.key?(:admin) admin = Trestle.lookup(options.delete(:admin)) else admin = admin_for(instance) || self.admin end if admin link_to(content, admin_url_for(instance, admin), options) else content end end def admin_url_for(instance, admin=self.admin) admin.path(:show, id: admin.to_param(instance)) if admin end def admin_for(instance) Trestle.admins[instance.class.name.underscore.pluralize] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.2 | app/helpers/trestle/url_helper.rb |
trestle-0.8.0 | app/helpers/trestle/url_helper.rb |