Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added form helper and input elements helper

  • Loading branch information...
commit c6cb7e7638856f377d91abdbd6b07ca467372337 1 parent 9aab80d
@casualjim casualjim authored
View
94 IronRubyMvc/Helpers/RubyFormHelper.cs
@@ -0,0 +1,94 @@
+#region Usings
+
+using System.Web.Mvc.Html;
+using System.Web.Mvc.IronRuby.Extensions;
+using IronRuby.Builtins;
+
+#endregion
+
+namespace System.Web.Mvc.IronRuby.Helpers
+{
+ public partial class RubyHtmlHelper
+ {
+ public MvcForm BeginForm()
+ {
+ return _helper.BeginForm();
+ }
+
+ public MvcForm BeginForm(Hash routeValues)
+ {
+ return _helper.BeginForm(routeValues.ToRouteDictionary());
+ }
+
+
+ public MvcForm BeginForm(string actionName, string controllerName)
+ {
+ return _helper.BeginForm(actionName, controllerName);
+ }
+
+ public MvcForm BeginForm(string actionName, string controllerName, Hash routeValues)
+ {
+ return _helper.BeginForm(actionName, controllerName, routeValues.ToRouteDictionary());
+ }
+
+ public MvcForm BeginForm(string actionName, string controllerName, FormMethod method)
+ {
+ return _helper.BeginForm(actionName, controllerName, method);
+ }
+
+ public MvcForm BeginForm(string actionName, string controllerName, Hash routeValues, FormMethod method)
+ {
+ return _helper.BeginForm(actionName, controllerName, routeValues.ToRouteDictionary(), method);
+ }
+
+ public MvcForm BeginForm(string actionName, string controllerName, FormMethod method, Hash htmlAttributes)
+ {
+ return _helper.BeginForm(actionName, controllerName, method, htmlAttributes.ToDictionary());
+ }
+
+ public MvcForm BeginForm(string actionName, string controllerName, Hash routeValues, FormMethod method, Hash htmlAttributes)
+ {
+ return _helper.BeginForm(actionName, controllerName, routeValues.ToRouteDictionary(), method, htmlAttributes.ToDictionary());
+ }
+
+ public MvcForm BeginRouteForm(Hash routeValues)
+ {
+ return _helper.BeginRouteForm(routeValues.ToRouteDictionary());
+ }
+
+ public MvcForm BeginRouteForm(string routeName)
+ {
+ return _helper.BeginRouteForm(routeName);
+ }
+
+ public MvcForm BeginRouteForm(string routeName, Hash routeValues)
+ {
+ return _helper.BeginRouteForm(routeName, routeValues.ToRouteDictionary());
+ }
+
+ public MvcForm BeginRouteForm(string routeName, FormMethod method)
+ {
+ return _helper.BeginRouteForm(routeName, method);
+ }
+
+ public MvcForm BeginRouteForm(string routeName, Hash routeValues, FormMethod method)
+ {
+ return _helper.BeginRouteForm(routeName, routeValues.ToRouteDictionary(), method);
+ }
+
+ public MvcForm BeginRouteForm(string routeName, FormMethod method, Hash htmlAttributes)
+ {
+ return _helper.BeginRouteForm(routeName, method, htmlAttributes.ToDictionary());
+ }
+
+ public MvcForm BeginRouteForm(string routeName, Hash routeValues, FormMethod method, Hash htmlAttributes)
+ {
+ return _helper.BeginRouteForm(routeName, routeValues.ToRouteDictionary(), method, htmlAttributes.ToDictionary());
+ }
+
+ public void EndForm()
+ {
+ _helper.EndForm();
+ }
+ }
+}
View
46 IronRubyMvc/Helpers/RubyHtmlHelper.cs
@@ -18,25 +18,7 @@ public RubyHtmlHelper(ViewContext context, IViewDataContainer viewDataContainer)
_helper = new HtmlHelper(context, viewDataContainer);
}
- public string ActionLink(string linkText, Hash values)
- {
- return _helper.RouteLink(linkText, values.ToRouteDictionary());
- }
-
- public string ActionLink(string linkText, string actionName, Hash values)
- {
- return _helper.ActionLink(linkText, actionName, values.ToRouteDictionary());
- }
-
- public string ActionLink(string linkText, string actionName, string controllerName)
- {
- return _helper.ActionLink(linkText, actionName, controllerName);
- }
-
- public string ActionLink(string linkText, string actionName)
- {
- return _helper.ActionLink(linkText, actionName);
- }
+
public void RenderPartial(string partialViewName)
{
@@ -58,30 +40,6 @@ public void RenderPartial(string partialViewName, object model, Hash viewData)
_helper.RenderPartial(partialViewName, model, viewData.ToViewDataDictionary());
}
- public string TextBox(string name)
- {
- //Yeah, I know this is sooo wrong, but still.
- name = name.Replace("_", "");
- return _helper.TextBox(name);
- }
-
- public string TextBox(string name, object value)
- {
- //Yeah, I know this is sooo wrong, but still.
- name = name.Replace("_", "");
- return _helper.TextBox(name, value.ToString());
- }
-
- public string Hidden(string name, object value)
- {
- return _helper.Hidden(name, value.ToString());
- }
-
- public string ValidationSummary()
- {
- return _helper.ValidationSummary();
- }
-
- public string Validation
+
}
}
View
101 IronRubyMvc/Helpers/RubyInputHelper.cs
@@ -0,0 +1,101 @@
+using System.Web.Mvc.Html;
+using System.Web.Mvc.IronRuby.Extensions;
+using IronRuby.Builtins;
+
+namespace System.Web.Mvc.IronRuby.Helpers
+{
+ public partial class RubyHtmlHelper
+ {
+ public string CheckBox(string name)
+ {
+ return _helper.CheckBox(name, (object)null /* htmlAttributes */);
+ }
+
+ public string CheckBox(string name, bool isChecked)
+ {
+ return _helper.CheckBox(name, isChecked, (object)null /* htmlAttributes */);
+ }
+
+ public string CheckBox(string name, bool isChecked, Hash htmlAttributes)
+ {
+ return _helper.CheckBox(name, isChecked, htmlAttributes.ToDictionary());
+ }
+
+ public string CheckBox(string name, Hash htmlAttributes)
+ {
+ return _helper.CheckBox(name, htmlAttributes.ToDictionary());
+ }
+
+ public string Hidden(string name)
+ {
+ return _helper.Hidden(name, null /* value */);
+ }
+
+ public string Hidden(string name, object value)
+ {
+ return _helper.Hidden(name, value, (object)null /* hmtlAttributes */);
+ }
+
+ public string Hidden(string name, object value, Hash htmlAttributes)
+ {
+ return _helper.Hidden(name, value, htmlAttributes.ToDictionary());
+ }
+
+ public string Password(string name)
+ {
+ return _helper.Password(name, null /* value */);
+ }
+
+ public string Password(string name, object value)
+ {
+ return _helper.Password(name, value, (object)null /* htmlAttributes */);
+ }
+
+ public string Password(string name, object value, Hash htmlAttributes)
+ {
+ return _helper.Password(name, value, htmlAttributes.ToDictionary());
+ }
+
+ public string RadioButton(string name, object value)
+ {
+ return _helper.RadioButton(name, value, (object)null /* htmlAttributes */);
+ }
+
+ public string RadioButton(string name, object value, Hash htmlAttributes)
+ {
+ return _helper.RadioButton(name, value, htmlAttributes.ToDictionary());
+ }
+
+ public string RadioButton(string name, object value, bool isChecked)
+ {
+ return _helper.RadioButton(name, value, isChecked, (object)null /* htmlAttributes */);
+ }
+
+ public string RadioButton(string name, object value, bool isChecked, Hash htmlAttributes)
+ {
+ return _helper.RadioButton(name, value, isChecked, htmlAttributes.ToDictionary());
+ }
+
+
+ public string TextBox(string name, object value, Hash htmlAttributes)
+ {
+ return _helper.TextBox(name, value, htmlAttributes.ToDictionary());
+ }
+
+ public string TextBox(string name)
+ {
+ //Yeah, I know this is sooo wrong, but still.
+ name = name.Replace("_", "");
+ return _helper.TextBox(name);
+ }
+
+ public string TextBox(string name, object value)
+ {
+ //Yeah, I know this is sooo wrong, but still.
+ name = name.Replace("_", "");
+ return _helper.TextBox(name, value.ToString());
+ }
+
+
+ }
+}
View
4 IronRubyMvc/Helpers/RubyLinkHelper.cs
@@ -1,9 +1,13 @@
+#region Usings
+
using System.Collections.Generic;
using System.Web.Mvc.Html;
using System.Web.Mvc.IronRuby.Extensions;
using System.Web.Routing;
using IronRuby.Builtins;
+#endregion
+
namespace System.Web.Mvc.IronRuby.Helpers
{
public partial class RubyHtmlHelper
Please sign in to comment.
Something went wrong with that request. Please try again.