Changeset 243
- Timestamp:
- 11/19/08 22:43:30 (2 months ago)
- Files:
-
- branches/ironruby/spark.build (modified) (1 diff)
- branches/ironruby/src/CommonAssemblyInfo.cs (modified) (1 diff)
- branches/ironruby/src/Samples/AspNetMvc/IronRubyViews/IronRubyViews.csproj.user (modified) (1 diff)
- branches/ironruby/src/Samples/AspNetMvc/IronRubyViews/Views/Home/Index.spark (modified) (2 diffs)
- branches/ironruby/src/Spark.IronRuby/Compiler/Ruby/ChunkVisitors/GeneratedCodeVisitor.cs (modified) (2 diffs)
- branches/ironruby/src/Spark.IronRuby/Compiler/Ruby/RubyViewCompiler.cs (modified) (2 diffs)
- branches/ironruby/src/Spark.IronRuby/Symbols.cs (added)
- branches/ironruby/src/Spark.Web.Mvc.Ruby (modified) (1 prop)
- branches/ironruby/src/Spark.Web.Mvc.Ruby.Tests (added)
- branches/ironruby/src/Spark.Web.Mvc.Ruby.Tests/HtmlHelperExtensionsTester.cs (added)
- branches/ironruby/src/Spark.Web.Mvc.Ruby.Tests/Properties (added)
- branches/ironruby/src/Spark.Web.Mvc.Ruby.Tests/Properties/AssemblyInfo.cs (added)
- branches/ironruby/src/Spark.Web.Mvc.Ruby.Tests/Spark.Web.Mvc.Ruby.Tests.csproj (added)
- branches/ironruby/src/Spark.Web.Mvc.Ruby/RubyLanguageFactoryWithExtensions.cs (modified) (4 diffs)
- branches/ironruby/src/Spark.sln (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ironruby/spark.build
r234 r243 157 157 <include name="aspnetmvc/*.*" /> 158 158 <include name="ironpython/*.*" /> 159 <include name="ironruby/*.*" /> 159 160 <include name="mvccontrib/*.*" /> 160 161 <include name="castle/*.*" /> branches/ironruby/src/CommonAssemblyInfo.cs
r234 r243 6 6 // <auto-generated> 7 7 // This code was generated by a tool. 8 // Runtime Version:2.0.50727. 35068 // Runtime Version:2.0.50727.1434 9 9 // 10 10 // Changes to this file may cause incorrect behavior and will be lost if branches/ironruby/src/Samples/AspNetMvc/IronRubyViews/IronRubyViews.csproj.user
r238 r243 1 1 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 2 <PropertyGroup> 3 <ProjectView>ShowAllFiles</ProjectView> 4 </PropertyGroup> 2 5 <ProjectExtensions> 3 6 <VisualStudio> branches/ironruby/src/Samples/AspNetMvc/IronRubyViews/Views/Home/Index.spark
r238 r243 11 11 </p> 12 12 13 #require 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 14 #$htmlExtensionMethods={ 15 #:ActionLink=>System::Web::Mvc::Html::LinkExtensions, 16 #:action_link=>System::Web::Mvc::Html::LinkExtensions, 17 #:RouteLink=>System::Web::Mvc::Html::LinkExtensions, 18 #:route_link=>System::Web::Mvc::Html::LinkExtensions, 19 #:text_box=>System::Web::Mvc::Html::InputExtensions, 20 #:TextBox=>System::Web::Mvc::Html::InputExtensions, 21 #:password=>System::Web::Mvc::Html::InputExtensions, 22 #:Password=>System::Web::Mvc::Html::InputExtensions} 23 #def html.method_missing(name, *parameters) 24 # extensionObject = $htmlExtensionMethods[name] 25 # if (extensionObject != nil) 26 # extensionObject.send(name, self, *parameters) 27 # else 28 # System::Web::Mvc::HtmlHelper.send(name, *parameters) 29 # end 30 #end 31 <!--#def html.action_link(*parameters) 32 # System::Web::Mvc::Html::LinkExtensions.ActionLink(self, *parameters) 33 #end 34 #def html.route_link(*parameters) 35 # System::Web::Mvc::Html::LinkExtensions.RouteLink(self, *parameters) 36 #end--> 37 38 39 #x=url.action("View", "Home") 40 <ol> 41 <li>${url.action('View', 'Home')}</li> 42 <li>${html.ActionLink("hello", '1', '2')}</li> 43 <li>${html.action_link("hello", '1', '2')}</li> 44 <li>${html.ActionLink("world", '3')}</li> 45 <li>${html.TextBox("height", "a billion feet")}</li> 46 <li>${html.text_box("height", "a billion feet")}</li> 47 <li>${html.Password("width", "a hundred miles")}</li> 48 <li>${html.password("width", "a hundred miles")}</li> 49 </ol> 50 51 #le = System::Web::Mvc::Html::LinkExtensions 52 ${le} 53 <ul> 54 <li each="m in le.public_methods">${m}</li> 55 </ul> 56 <p>ActionLink ${le.method_defined?('ActionLink')}</p> 57 <p>action_link ${le.method_defined?('action_link')}</p> 13 58 14 59 <!--#@title = "Products - " + @title--> … … 16 61 <li each="prod in @products" style="background:#ddeeff;?{prodIndex%2==0}"> 17 62 ${prodIndex+1} 18 #x=html.action_link(prod.Name, "View", "Home") 19 ${Html.ActionLink(prod.Name, "View", "Home")} 20 <!--${prodIsFirst?'First':''} 21 ${prodIsLast?'Last':''}--> 63 <a href="${url.action('View', 'Home')}">${h(prod.Name)}</a> 64 ${prodIsFirst && 'First' || ''} 65 ${prodIsLast && 'Last' || ''} 22 66 </li> 23 67 </ul> branches/ironruby/src/Spark.IronRuby/Compiler/Ruby/ChunkVisitors/GeneratedCodeVisitor.cs
r238 r243 38 38 _source.WriteLine("begin"); 39 39 _source.Indent++; 40 _source.Write("output_write_adapter ").WriteLine(chunk.Code);40 _source.Write("output_write_adapter(").Write(chunk.Code).WriteLine(")"); 41 41 _source.Indent--; 42 42 _source.WriteLine("rescue"); … … 44 44 { 45 45 _source.Indent++; 46 _source.Write("output_write_adapter \"${").Write(EscapeStringContents(chunk.Code)).WriteLine(" }\"");46 _source.Write("output_write_adapter \"${").Write(EscapeStringContents(chunk.Code)).WriteLine(" => \"+$!+\"}\""); 47 47 _source.Indent--; 48 48 } branches/ironruby/src/Spark.IronRuby/Compiler/Ruby/RubyViewCompiler.cs
r238 r243 10 10 public class RubyViewCompiler:ViewCompiler 11 11 { 12 public string ScriptHeader { get; set; } 13 14 12 15 public override void CompileView(IEnumerable<IList<Chunk>> viewTemplates, IEnumerable<IList<Chunk>> allResources) 13 16 { … … 23 26 var script = new SourceWriter(); 24 27 var globals = new Dictionary<string, object>(); 28 29 script.WriteLine(ScriptHeader); 25 30 26 31 script.WriteLine("class<<view"); branches/ironruby/src/Spark.Web.Mvc.Ruby
- Property svn:ignore changed from
bin
obj
to
bin
obj
*.user
- Property svn:ignore changed from
branches/ironruby/src/Spark.Web.Mvc.Ruby/RubyLanguageFactoryWithExtensions.cs
r238 r243 3 3 using Spark.Compiler; 4 4 using Spark.IronRuby; 5 using Spark.IronRuby.Compiler.Ruby; 5 6 6 7 [assembly: ExtensionType(typeof(HtmlHelper), typeof(System.Web.Mvc.Html.FormExtensions))] … … 19 20 { 20 21 private bool _initialized; 22 private string _scriptHeader; 21 23 22 24 public override ViewCompiler CreateViewCompiler(ISparkViewEngine engine, SparkViewDescriptor descriptor) 23 25 { 24 26 Initialize(); 25 return base.CreateViewCompiler(engine, descriptor); 27 var viewCompiler = base.CreateViewCompiler(engine, descriptor); 28 if (viewCompiler is RubyViewCompiler) 29 { 30 ((RubyViewCompiler) viewCompiler).ScriptHeader = _scriptHeader; 31 } 32 return viewCompiler; 26 33 } 27 34 … … 36 43 return; 37 44 38 _initialized = true;39 40 45 // need to load the assembly into the runtime domain 41 46 // before any scripts are created in order for the extension … … 43 48 RubyEngineManager.ScriptEngine.Runtime.LoadAssembly( 44 49 typeof (RubyLanguageFactoryWithExtensions).Assembly); 50 51 _scriptHeader = @" 52 view_html = view.html 53 def view_html.method_missing(name, *parameters) 54 extensionObject = $htmlExtensionMethods[name] 55 if (extensionObject != nil) 56 extensionObject.send(name, self, *parameters) 57 else 58 System::Web::Mvc::HtmlHelper.send(name, *parameters) 59 end 60 end"; 61 62 _initialized = true; 45 63 } 46 64 } branches/ironruby/src/Spark.sln
r238 r243 37 37 EndProject 38 38 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spark.Web.Mvc.Ruby", "Spark.Web.Mvc.Ruby\Spark.Web.Mvc.Ruby.csproj", "{92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90}" 39 EndProject 40 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spark.Web.Mvc.Ruby.Tests", "Spark.Web.Mvc.Ruby.Tests\Spark.Web.Mvc.Ruby.Tests.csproj", "{AE1175DE-6388-472B-92EB-907A1C45E541}" 39 41 EndProject 40 42 Global … … 104 106 {92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90}.Release|Any CPU.ActiveCfg = Release|Any CPU 105 107 {92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90}.Release|Any CPU.Build.0 = Release|Any CPU 108 {AE1175DE-6388-472B-92EB-907A1C45E541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 109 {AE1175DE-6388-472B-92EB-907A1C45E541}.Debug|Any CPU.Build.0 = Debug|Any CPU 110 {AE1175DE-6388-472B-92EB-907A1C45E541}.Release|Any CPU.ActiveCfg = Release|Any CPU 111 {AE1175DE-6388-472B-92EB-907A1C45E541}.Release|Any CPU.Build.0 = Release|Any CPU 106 112 EndGlobalSection 107 113 GlobalSection(SolutionProperties) = preSolution … … 124 130 {92156FC5-8ECF-4A52-B4CA-AE060DCAAD18} = {F4E1F2B2-2BA6-4EFC-8082-ADBC14ECC179} 125 131 {92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90} = {F4E1F2B2-2BA6-4EFC-8082-ADBC14ECC179} 132 {AE1175DE-6388-472B-92EB-907A1C45E541} = {F4E1F2B2-2BA6-4EFC-8082-ADBC14ECC179} 126 133 EndGlobalSection 127 134 EndGlobal
