99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/cms/behaviors/rendering.rb', line 99
def perform_render(controller)
return "Exception: #{@render_exception}" if @render_exception
unless @controller
prepare_to_render(controller)
end
if self.respond_to?(:deleted) && self.deleted
logger.error "Attempting to render deleted object: #{self.inspect}"
msg = (@mode == 'edit' ? %Q[<div class="error">This #{self.class.name} has been deleted. Please remove this container from the page</div>] : '')
return msg
end
view_class = Class.new(ActionView::Base)
action_view = view_class.new(@controller.view_paths, {}, @controller)
view_class.send(:include, @controller.class.master_helper_module)
if $:.detect{|d| File.exists?(File.join(d, self.class.helper_path))}
view_class.send(:include, self.class.helper_class)
end
def action_view.content_for(name, content=nil, &block)
@controller.instance_variable_get("@template").content_for(name, content, &block)
end
action_view.assigns = assigns_for_view
if respond_to?(:inline_options) && self.inline_options && self.inline_options.has_key?(:inline)
options = {:locals => {}}.merge(self.inline_options)
ActionView::InlineTemplate.new(options[:inline], options[:type]).render(action_view, options[:locals])
else
action_view.render(:file => self.class.template_path)
end
end
|