Forum: Radiant CMS Question about Virtual Domain extension

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Thijs J. (Guest)
on 2007-04-22 15:46
(Received via mailing list)
I was excited to see the Virtual Domain extension working again
(version 1.2.1), but when using Radiant CMS with multiple domains it
renders the tag <r:breadcrumbs /> pretty useless, since it will
always display the Root page in the crumb.

Any way to have <r:breadcrumbs /> skip the Root page? Or anyway at
all to offset the crumbs?

Thanks, WKR> Thijs J.
keita (Guest)
on 2007-04-23 17:51
(Received via mailing list)
Hi,

I made a patch. This works fine in my environment.

diff -urN -x .svn -x '*~'
virtual_domain-1.2.1.orig/lib/virtual_domain_tags.rb
virtual_domain/lib/virtual_domain_tags.rb
--- virtual_domain-1.2.1.orig/lib/virtual_domain_tags.rb  1970-01-01
09:00:00.000000000 +0900
+++ virtual_domain/lib/virtual_domain_tags.rb  2007-04-23
22:38:50.000000000 +0900
@@ -0,0 +1,16 @@
+module VirtualDomainTags
+
+  include Radiant::Taggable
+
+  def self.breadcrumbs
+    Proc.new do |tag|
+      page = tag.locals.page
+      breadcrumbs = [page.breadcrumb]
+      page.ancestors[0..-2].each do |ancestor|
+        breadcrumbs.unshift %{<a
href="#{ancestor.url}">#{ancestor.breadcrumb}</a>}
+      end
+      separator = tag.attr['separator'] || ' &gt; '
+      breadcrumbs.join(separator)
+    end
+  end
+end
diff -urN -x .svn -x '*~'
virtual_domain-1.2.1.orig/virtual_domain_extension.rb
virtual_domain/virtual_domain_extension.rb
--- virtual_domain-1.2.1.orig/virtual_domain_extension.rb  2007-04-23
22:38:06.000000000 +0900
+++ virtual_domain/virtual_domain_extension.rb  2007-04-23
22:38:50.000000000 +0900
@@ -14,11 +14,15 @@
     SiteController.send :remove_method, :show_page
     SiteController.send :remove_method, :show_uncached_page
     SiteController.send :include, CacheByDomain
+    StandardTags.send :alias_method, :tag_breadcrumbs_orig,
:'tag:breadcrumbs'
+    StandardTags.send :remove_method, :'tag:breadcrumbs'
+    Page.send :define_method, :'tag:breadcrumbs',
VirtualDomainTags.breadcrumbs
     VirtualDomainPage
   end

   def deactivate
     SiteController.send :alias_method, :show_page, :show_page_orig
     SiteController.send :alias_method, :show_uncached_page,
:show_uncached_page_orig
+    StandardTags.send :alias_method, :'tag:breadcrumbs',
:tag_breadcrumbs_orig
   end
 end

-----
Keita Y.


2007/4/22, Thijs J. <removed_email_address@domain.invalid>:
Thijs J. (Guest)
on 2007-04-24 08:19
(Received via mailing list)
_______________________________________________
Radiant mailing list
Post:   removed_email_address@domain.invalid
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
This topic is locked and can not be replied to.