pakyow-presenter/lib/presenter/view.rb in pakyow-presenter-0.7.0 vs pakyow-presenter/lib/presenter/view.rb in pakyow-presenter-0.7.1
- old
+ new
@@ -83,11 +83,11 @@
return group
end
def in_context(&block)
- ViewContext.new(self).instance_eval(&block)
+ ViewContext.new(self).instance_exec(self, &block)
end
def bind(object, opts = {})
bind_as = opts[:to] ? opts[:to].to_s : StringUtils.underscore(object.class.name.split('::').last)
@@ -120,11 +120,11 @@
def repeat_for(objects, opts = {}, &block)
if o = @doc
objects.each do |object|
view = View.new(self)
view.bind(object, opts)
- ViewContext.new(view).instance_exec(object, &block) if block_given?
+ ViewContext.new(view).instance_exec(object, view, &block) if block_given?
o.add_previous_sibling(view.doc)
end
o.remove
@@ -217,13 +217,12 @@
end
alias :html :content
def content=(content)
- return unless content
self.doc.inner_html = Nokogiri::HTML.fragment(content.to_s)
end
-
+
alias :html= :content=
def append(content)
self.doc.add_child(Nokogiri::HTML.fragment(content.to_s))
end