lib/ice/eco_template/base.rb in ice-0.4.0 vs lib/ice/eco_template/base.rb in ice-0.4.1
- old
+ new
@@ -1,17 +1,26 @@
-require "ice/eco_template/context"
+require "ice/eco_template/generated_helpers"
require 'eco'
require 'v8'
module Ice
module EcoTemplate
+
def self.convert_template(template_text, vars = {})
- env = Context.new vars
context = V8::Context.new
- context.eval(Eco::Source.combined_contents)
+ context.eval(open "#{File.dirname(__FILE__)}/../../../js/lib/path-helper.js")
+ IceJavascriptHelpers.each do |helper|
+ context.eval(helper)
+ end
+ IceCoffeescriptHelpers.each do |helper|
+ context.eval CoffeeScript.compile(helper, :bare => true)
+ end
+
+ context.eval CoffeeScript.compile(GeneratedHelpers.get_routes, :bare => true)
+ context.eval(Eco::Source.combined_contents)
template = context["eco"]["compile"].call(template_text)
- # Render the template
- template.call(env)
+
+ template.call(vars.to_ice)
end
end
end
\ No newline at end of file