Skip to content

Commit

Permalink
No more fibers. Fixes #634
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Apr 27, 2011
1 parent dbc19d7 commit 8df47a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 37 deletions.
26 changes: 1 addition & 25 deletions base/lib/refinerycms-base.rb
Expand Up @@ -37,28 +37,4 @@ class Engine < ::Rails::Engine

end

::Refinery.engines << "base"

# So that we can "use" the Fiber class' basic functionality.
unless defined?(::Fiber)
class Fiber

def initialize(&block)
super
@block = block
self
end

def self.yield(*args)
if args.first.respond_to?(:call)
args.first.call
else
args.first
end
end

def resume
self.class.yield(@block)
end
end
end
::Refinery.engines << "base"
19 changes: 7 additions & 12 deletions core/app/views/shared/_header.html.erb
@@ -1,15 +1,10 @@
<h1 id='logo'>
<%= link_to RefinerySetting.find_or_set(:site_name, "Company Name"), root_path %>
</h1>
<%=
::Fiber.new {
::Fiber.yield(
render(:partial => "/shared/menu", :locals => {
:dom_id => 'menu',
:css => 'menu',
:roots => @menu_pages.where(:parent_id => nil),
:collection => @menu_pages.where(@menu_pages.arel_table[:parent_id].not_eq(nil)),
:selected_item => (@page if defined?(::Page))
})
)
}.resume %>
<%= render(:partial => "/shared/menu", :locals => {
:dom_id => 'menu',
:css => 'menu',
:roots => @menu_pages.where(:parent_id => nil),
:collection => @menu_pages.where(@menu_pages.arel_table[:parent_id].not_eq(nil)),
:selected_item => (@page if defined?(::Page))
}) -%>

0 comments on commit 8df47a1

Please sign in to comment.