module SidebarHelper
  def render_sidebars
    this_blog.sidebars.inject('') do |acc, sb|
      @sidebar = sb
      sb.parse_request(contents, params)
      controller.response.lifetime = sb.lifetime if sb.lifetime
      acc + render_sidebar(sb)
    end
  end

  def render_sidebar(sidebar)
    if sidebar.view_root
      render_to_string(:file => "#{sidebar.view_root}/content.rhtml",
                       :locals => sidebar.to_locals_hash)
    else
      render_to_string(:partial => sidebar.content_partial,
                       :locals => sidebar.to_locals_hash)
    end
  end

end

module SidebarHelper
  def render_sidebars
    this_blog.sidebars.inject('') do |acc, sb|
      @sidebar = sb
      sb.parse_request(contents, params)
      controller.response.lifetime = sb.lifetime if sb.lifetime
      acc + render_sidebar(sb)
    end
  end

  def render_sidebar(sidebar)
    if sidebar.view_root
      # Allow themes to override sidebar views
      view_root = File.expand_path(sidebar.view_root)
      rails_root = File.expand_path(RAILS_ROOT)
      if view_root =~ /^#{Regexp.escape(rails_root)}/
        new_root = view_root[rails_root.size..-1]
        new_root.sub! %r{^/?vendor/}, ""
        new_root.sub! %r{/views}, ""
        new_root = File.join(this_blog.current_theme.path, "views", new_root)
        view_root = new_root if File.exists?(File.join(new_root, "content.rhtml"))
      end
      render_to_string(:file => "#{view_root}/content.rhtml",
                       :locals => sidebar.to_locals_hash)
    else
      render_to_string(:partial => sidebar.content_partial,
                       :locals => sidebar.to_locals_hash)
    end
  end

end

Allow themes to once again override views for sidebars. Note that the themes need to be updated. Instead of views/plugins/sidebars/archives/content.rhtml, use views/plugins/archives_sidebar/content.rhtml. The contents of the views may also need updating for sidebars
Allow themes to once again override views for sidebars.
Note that the themes need to be updated. Instead of views/plugins/sidebars/archives/content.rhtml, use views/plugins/archives_sidebar/content.rhtml. The contents of the views may also need updating for sidebars

git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@1263 820eb932-12ee-0310-9ca8-eeb645f39767
