Permalink
Browse files

first attempt at supressing main

  • Loading branch information...
1 parent 66e05e6 commit e3ca894949372b49e4cd98c5bf28c8fee779a1bf @onkis onkis committed with Charles Jolley Feb 20, 2010
Showing with 30 additions and 2 deletions.
  1. +27 −0 lib/sproutcore/helpers/static_helper.rb
  2. +3 −2 lib/sproutcore/rack/builder.rb
@@ -165,7 +165,34 @@ def inline_javascript(resource_name, opts ={})
ret = entry.stage!.inline_contents*''
return %(<script type="text/javascript">\n#{ret}\n</script>)
end
+
+ # Attempts to include the named javascript entry inline to the file
+ #
+ # === Options
+ # language:: the language to use. defaults to current
+ #
+ def inline_designer_javascript(resource_name, opts ={})
+ resource_name = resource_name.to_s
+
+ # determine which manifest to search. if a language is explicitly
+ # specified, lookup manifest for that language. otherwise use
+ # current manifest.
+ m = self.manifest
+ if opts[:language]
+ m = target.manifest_for(:language => opts[:language]).build!
+ end
+
+ entry = m.find_entry(resource_name, :entry_type => :javascript)
+ if entry.nil?
+ entry = m.find_entry(resource_name, :hidden => true, :entry_type => :javascript)
+ end
+
+ return '' if entry.nil? || !$design_mode
+
+ ret = entry.stage!.inline_contents*''
+ return %(<script type="text/javascript">\n#{ret}\n</script>)
+ end
# Attempts to include the named javascript entry inline to the file
#
# === Options
@@ -95,8 +95,9 @@ def call(env)
url = '/sproutcore/welcome' if url == '/'
#designer mode?
- $design_mode = true if /designMode=YES/ =~ env['QUERY_STRING']
- SC.logger.info $design_mode
+ $design_mode = false
+ $design_mode = ((/designMode=YES/ =~ env['QUERY_STRING']) != nil) ? true : false
+ SC.logger.fatal $design_mode
# look for a matching target
target = target_for(url)
ret = not_found("No matching target") if target.nil?

0 comments on commit e3ca894

Please sign in to comment.