User: SimonCropp
Date: 2010/02/10 08:51 PM

Added:
 /viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/
  ComponentData.cs, HtmlHelper.cs

Modified:
 /viewengines/nhaml/trunk/src/
  SharedAssemblyInfo.cs
 /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/
  Web.config
 /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Home/
  Index.haml
 /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Products/
  List.haml, _Product.haml
 /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/layouts/
  Application.haml, Products.haml
 /viewengines/nhaml/trunk/src/NHaml.Web.MonoRail.Tests/
  TestFixtureBase.cs
 /viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/
  NHaml.Web.MonoRail.csproj, NHamlMonoRailView.cs, NHamlMonoRailViewEngine.cs

Log:
 update to latest castle and nhaml

File Changes:

Directory: /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Home/
==========================================================================

File [modified]: Index.haml
Delta lines: +1 -1
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Products/List.haml 
2010-01-10 17:52:36 UTC (rev 709)
+++ viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Products/List.haml 
2010-02-11 03:51:12 UTC (rev 710)
@@ -4,4 +4,4 @@
 %ul
   - foreach (var product in category.Products)
     _ Product
-= Html.LinkTo("Add New Product", "Products", "New")
\ No newline at end of file
+= Url.LinkTo("Add New Product", "Products", "New")

Directory: /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/
===============================================================

File [modified]: Web.config
Delta lines: +39 -0
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/ComponentData.cs             
                (rev 0)
+++ viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/ComponentData.cs     
2010-02-11 03:51:12 UTC (rev 710)
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace NHaml.Web.MonoRail
+{
+    public class ComponentData
+    {
+        public NHamlMonoRailView View { get; set; }
+        public string Name { get; set; }
+        public IDictionary<string, object> Parameters { get; set; }
+        public Dictionary<string, Action<TextWriter>> Sections{ get; set;}
+
+        public ComponentData(NHamlMonoRailView view, string name, 
IDictionary<string, object> parameters):this(view,name, parameters, null)
+        {
+        }
+        public ComponentData(NHamlMonoRailView view, string name, 
IDictionary<string, object> parameters, Action<TextWriter> action)
+        {
+            Body = action;
+            View = view;
+            Name = name;
+            Parameters = parameters;
+            Sections = new Dictionary<string, Action<TextWriter>>();
+        }
+
+        public Action<TextWriter> Body { get; set; }
+
+        public ComponentData AddSection(string sectionName, Action<TextWriter> 
action)
+        {
+            Sections.Add(sectionName,action);
+            return this;
+        }
+
+        public void Render()
+        {
+            View.RenderComponent(this);
+        }
+    }
+}

Directory: /viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/
===========================================================

File [added]: ComponentData.cs
Delta lines: +26 -0
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/HtmlHelper.cs                
                (rev 0)
+++ viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/HtmlHelper.cs        
2010-02-11 03:51:12 UTC (rev 710)
@@ -0,0 +1,26 @@
+using Castle.MonoRail.Framework.Helpers;
+
+namespace NHaml.Web.MonoRail
+{
+    public static class UrlHelperExtensions 
+    {
+        public static string LinkTo(this UrlHelper urlHelper, string name, 
string action)
+        {
+            var str = urlHelper.For(DictHelper.Create(new[] { "action=" + 
action }));
+            return string.Format("<a href=\"{0}\">{1}</a>", str, name);
+        }
+
+        public static string LinkTo(this UrlHelper urlHelper, string name, 
string controller, string action)
+        {
+            var str = urlHelper.For(DictHelper.Create(new[] { "controller=" + 
controller, "action=" + action }));
+            return string.Format("<a href=\"{0}\">{1}</a>", str, name);
+        }
+
+        public static string LinkTo(this UrlHelper urlHelper, string name, 
string controller, string action, object id)
+        {
+            var str = urlHelper.For(DictHelper.Create(new[] { "controller=" + 
controller, "action=" + action }));
+            return string.Format("<a href=\"{0}?id={1}\">{2}</a>", str, id, 
name);
+        }
+
+    }
+}

File [added]: HtmlHelper.cs
Delta lines: +10 -0
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/NHaml.Web.MonoRail.csproj    
2010-01-10 17:52:36 UTC (rev 709)
+++ viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/NHaml.Web.MonoRail.csproj    
2010-02-11 03:51:12 UTC (rev 710)
@@ -34,6 +34,10 @@
     <DocumentationFile>bin\Release\NHaml.Web.MonoRail.xml</DocumentationFile>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="Castle.Components.Common.EmailSender, Version=1.1.0.0, 
Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\lib\Castle.Components.Common.EmailSender.dll</HintPath>
+    </Reference>
     <Reference Include="Castle.Components.DictionaryAdapter, Version=1.0.3.0, 
Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\lib\Castle.Components.DictionaryAdapter.dll</HintPath>
@@ -46,6 +50,10 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\lib\Castle.MonoRail.Framework.dll</HintPath>
     </Reference>
+    <Reference Include="Castle.Windsor, Version=2.1.0.0, Culture=neutral, 
PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\lib\Castle.Windsor.dll</HintPath>
+    </Reference>
     <Reference Include="NHaml, Version=1.5.0.2, Culture=neutral, 
PublicKeyToken=d603208bac452365, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\lib\NHaml.dll</HintPath>
@@ -67,8 +75,10 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ComponentData.cs" />
     <Compile Include="ComponentMarkupRule.cs" />
     <Compile Include="ComponentSectionMarkupRule.cs" />
+    <Compile Include="HtmlHelper.cs" />
     <Compile Include="NHamlMonoRailView.cs" />
     <Compile Include="NHamlMonoRailViewEngine.cs" />

File [modified]: NHaml.Web.MonoRail.csproj
Delta lines: +8 -44
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/NHamlMonoRailView.cs 
2010-01-10 17:52:36 UTC (rev 709)
+++ viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/NHamlMonoRailView.cs 
2010-02-11 03:51:12 UTC (rev 710)
@@ -2,6 +2,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.IO;
+using System.Linq;
 using System.Security.Permissions;
 using System.Web;
 using Castle.MonoRail.Framework;
@@ -22,12 +23,7 @@
 
         public static IDictionary<string,object> 
GetDictionaryFromKeyValue(params KeyValuePair<string, object>[] keyValuePairs)
         {
-            var dictionary = new Dictionary<string, object>();
-            foreach (var keyValuePair in keyValuePairs)
-            {
-                dictionary.Add(keyValuePair.Key, keyValuePair.Value);
-            }
-            return dictionary;
+            return keyValuePairs.ToDictionary(keyValuePair => 
keyValuePair.Key, keyValuePair => keyValuePair.Value);
         }
 
    
@@ -176,12 +172,11 @@
                 subView.PropertyBag[entry.Key] = entry.Value;
             }
             subView.Render(writer);
-            foreach (DictionaryEntry entry in subView.PropertyBag)
+            foreach (var entry in subView
+                .PropertyBag
+                .Cast<DictionaryEntry>()
+                .Where(entry => subView.PropertyBag.Contains(entry.Key + 
"....@bubbleup")))
             {
-                if (!subView.PropertyBag.Contains(entry.Key + "....@bubbleup"))
-                {
-                    continue;
-                }
                 PropertyBag[entry.Key] = entry.Value;
                 PropertyBag[entry.Key + "....@bubbleup"] = true;
             }
@@ -205,46 +200,15 @@
         {
             //absolute path from Views directory
             if (subviewName[0] == '/')
+            {
                 return subviewName.Substring(1) + ViewEngine.ViewFileExtension;
+            }
             return Path.Combine(ViewEngine.ViewRootDir, subviewName) + 
ViewEngine.ViewFileExtension;
         }
 
 
     
     }
-
-    public class ComponentData
-    {
-        public NHamlMonoRailView View { get; set; }
-        public string Name { get; set; }
-        public IDictionary<string, object> Parameters { get; set; }
-        public Dictionary<string, Action<TextWriter>> Sections{ get; set;}
-
-        public ComponentData(NHamlMonoRailView view, string name, 
IDictionary<string, object> parameters):this(view,name, parameters, null)
-        {
-        }
-        public ComponentData(NHamlMonoRailView view, string name, 
IDictionary<string, object> parameters, Action<TextWriter> action)
-        {
-            Body = action;
-            View = view;
-            Name = name;
-            Parameters = parameters;
-            Sections = new Dictionary<string, Action<TextWriter>>();
-        }
-
-        public Action<TextWriter> Body { get; set; }
-
-        public ComponentData AddSection(string sectionName, Action<TextWriter> 
action)
-        {
-            Sections.Add(sectionName,action);
-            return this;
-        }
-
-        public void Render()
-        {
-            View.RenderComponent(this);
-        }
-    }
 }
 

File [modified]: NHamlMonoRailView.cs
Delta lines: +5 -4
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/NHamlMonoRailViewEngine.cs   
2010-01-10 17:52:36 UTC (rev 709)
+++ viewengines/nhaml/trunk/src/NHaml.Web.MonoRail/NHamlMonoRailViewEngine.cs   
2010-02-11 03:51:12 UTC (rev 710)
@@ -49,7 +49,7 @@
 
 
             
options.AddReference(typeof(IServiceEnabledComponent).Assembly.Location);
-            options.AddReference( typeof( HtmlHelper ).Assembly.Location );
+            options.AddReference( typeof( FormHelper ).Assembly.Location );
             options.AddReference( typeof( NHamlMonoRailViewEngine 
).Assembly.Location );
             options.AddReference( typeof( DataContext ).Assembly.Location );
             options.AddReference( typeof( Action ).Assembly.Location );
@@ -113,6 +113,7 @@
             foreach (var key in controllerContext.Helpers.Keys)
             {
                 templateBuilderContext.Helpers.Add((string) key, 
controllerContext.Helpers[key].GetType());
+                Debug.WriteLine(key);
        }
             var compiledTemplate = 
TemplateEngine.Compile(TemplateEngine.Options.TemplateBaseType, 
TemplateEngine.ConvertPathsToViewSources(sources), templateBuilderContext);
             var template = (NHamlMonoRailView) 
compiledTemplate.CreateInstance();
@@ -121,7 +122,8 @@
             foreach (var key in controllerContext.Helpers.Keys)
             {
                 var property = tempalteType.GetField((string) key);
-                property.SetValue(template, controllerContext.Helpers[key]);
+                var value = controllerContext.Helpers[key];
+                property.SetValue(template, value);
             }
             return template;
         }
@@ -193,9 +195,8 @@
             var list = new List<string>();
             if (controllerContext.LayoutNames != null && 
controllerContext.LayoutNames.Length != 0)
             {
-                for (var index = 0; index < 
controllerContext.LayoutNames.Length; index++)
+                foreach (var layoutName in controllerContext.LayoutNames)
                 {
-                    var layoutName = controllerContext.LayoutNames[index];
                     var layoutTemplate = layoutName;
                     if (!layoutTemplate.StartsWith("/"))

File [modified]: NHamlMonoRailViewEngine.cs
Delta lines: +1 -1
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Web.MonoRail.Tests/TestFixtureBase.cs     
2010-01-10 17:52:36 UTC (rev 709)
+++ viewengines/nhaml/trunk/src/NHaml.Web.MonoRail.Tests/TestFixtureBase.cs     
2010-02-11 03:51:12 UTC (rev 710)
@@ -66,7 +66,7 @@
 
 
             Helpers["urlhelper"] = Helpers["url"] = new 
UrlHelper(StubEngineContext);
-            Helpers["htmlhelper"] = Helpers["html"] = new 
HtmlHelper(StubEngineContext);
+            Helpers["formhelper"] = Helpers["form"] = new 
FormHelper(StubEngineContext);
             Helpers["dicthelper"] = Helpers["dict"] = new 
DictHelper(StubEngineContext);
             Helpers["DateFormatHelper"] = Helpers["DateFormat"] = new 
DateFormatHelper(StubEngineContext);

Directory: /viewengines/nhaml/trunk/src/NHaml.Web.MonoRail.Tests/
=================================================================

File [modified]: TestFixtureBase.cs
Delta lines: +2 -2
===================================================================

--- viewengines/nhaml/trunk/src/SharedAssemblyInfo.cs   2010-01-10 17:52:36 UTC 
(rev 709)
+++ viewengines/nhaml/trunk/src/SharedAssemblyInfo.cs   2010-02-11 03:51:12 UTC 
(rev 710)
@@ -10,8 +10,8 @@
 [assembly: AssemblyProduct("NHaml")]
 [assembly: AssemblyCopyright("MIT License")]
 [assembly: ComVisible(false)]
-[assembly: AssemblyVersion("1.5.0.2")]
-[assembly: AssemblyFileVersion("1.5.0.2")]
+[assembly: AssemblyVersion("1.5.0.3")]
+[assembly: AssemblyFileVersion("1.5.0.3")]
 [assembly: NeutralResourcesLanguage("")]
 [assembly: AllowPartiallyTrustedCallers]

Directory: /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Products/
==============================================================================

File [modified]: List.haml
Delta lines: +1 -1
===================================================================

--- 
viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Products/_Product.haml 
    2010-01-10 17:52:36 UTC (rev 709)
+++ 
viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/Products/_Product.haml 
    2010-02-11 03:51:12 UTC (rev 710)
@@ -1,4 +1,4 @@
 %li
   = product.ProductName 
   %span.editlink
-    = Html.LinkTo("Edit", "Products", "Edit", product.ProductID )
\ No newline at end of file
+    = Url.LinkTo("Edit", "Products", "Edit", product.ProductID )

File [modified]: _Product.haml
Delta lines: +2 -2
===================================================================

--- 
viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/layouts/Application.haml
   2010-01-10 17:52:36 UTC (rev 709)
+++ 
viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/layouts/Application.haml
   2010-02-11 03:51:12 UTC (rev 710)
@@ -12,8 +12,8 @@
           %li
             %a{href="/"} Home
           %li
-            = Html.LinkTo("About Us", "Home", "About")
+            = Url.LinkTo("About Us", "Home", "About")
           %li
-            = Html.LinkTo("Products", "Products", "Category", 1)
+            = Url.LinkTo("Products", "Products", "Category", 1)
       #maincontent
         _

Directory: /viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/layouts/
=============================================================================

File [modified]: Application.haml
Delta lines: +2 -2
===================================================================

--- 
viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/layouts/Products.haml  
    2010-01-10 17:52:36 UTC (rev 709)
+++ 
viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Views/layouts/Products.haml  
    2010-02-11 03:51:12 UTC (rev 710)
@@ -12,8 +12,8 @@
           %li
             %a{href="/"} Home
           %li
-            = Html.LinkTo("About Us", "About", "Home")
+            = Url.LinkTo("About Us", "About", "Home")
           %li
-            = Html.LinkTo("Products", "Category", "Products", 1)
+            = Url.LinkTo("Products", "Category", "Products", 1)
       #maincontent
         _

File [modified]: Products.haml
Delta lines: +2 -2
===================================================================

--- viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Web.config       
2010-01-10 17:52:36 UTC (rev 709)
+++ viewengines/nhaml/trunk/src/NHaml.Samples.MonoRail/Web.config       
2010-02-11 03:51:12 UTC (rev 710)
@@ -27,7 +27,7 @@
          providerName="System.Data.SqlClient"/>
   </connectionStrings>
 
-  <monorail smtpHost="yoursmtphost" useWindsorIntegration="false">
+  <monorail useWindsorIntegration="false" >
     <controllers>
       <assembly>NHaml.Samples.MonoRail</assembly>
     </controllers>
@@ -35,7 +35,7 @@
       <add xhtml="false" type="NHaml.Web.MonoRail.NHamlMonoRailViewEngine, 
NHaml.Web.MonoRail"/>
     </viewEngines>
   </monorail>
-  <nhaml autoRecompile="true"  
templateBaseType="NHaml.Samples.MonoRail.CustomView, NHaml.Samples.MonoRail" >
+  <nhaml autoRecompile="true" outputDebugFiles="true" 
templateBaseType="NHaml.Samples.MonoRail.CustomView, NHaml.Samples.MonoRail" >
     <assemblies>
       <add assembly="NHaml.Samples.MonoRail"/>

Directory: /viewengines/nhaml/trunk/src/
========================================

File [modified]: SharedAssemblyInfo.cs
Delta lines: +0 -0
===================================================================

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-commits?hl=en.

Reply via email to