Skip to content

Commit

Permalink
Initial check in
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryEfimenko committed May 22, 2013
0 parents commit c33062d
Show file tree
Hide file tree
Showing 121 changed files with 7,336 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
31 changes: 31 additions & 0 deletions .gitignore
@@ -0,0 +1,31 @@

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
#Ignore misc files
*.nupkg
20 changes: 20 additions & 0 deletions TwitterBootstrapMVC.sln
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwitterBootstrapMVC", "TwitterBootstrapMVC\TwitterBootstrapMVC.csproj", "{B8962907-267A-4010-9606-DD3440055E0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B8962907-267A-4010-9606-DD3440055E0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8962907-267A-4010-9606-DD3440055E0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8962907-267A-4010-9606-DD3440055E0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8962907-267A-4010-9606-DD3440055E0A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
18 changes: 18 additions & 0 deletions TwitterBootstrapMVC/BootstrapHtmlExtension.cs
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using TwitterBootstrapMVC.BootstrapMethods;

namespace TwitterBootstrapMVC
{
public static class BootstrapHtmlExtension
{
public static Bootstrap<TModel> Bootstrap<TModel>(this HtmlHelper<TModel> helper)
{
return new Bootstrap<TModel>(helper);
}
}
}
48 changes: 48 additions & 0 deletions TwitterBootstrapMVC/BootstrapMethods/Bootstrap.ActionLinkButton.cs
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using TwitterBootstrapMVC.Controls;

namespace TwitterBootstrapMVC.BootstrapMethods
{
public partial class Bootstrap<TModel>
{
public BootstrapActionLinkButton ActionLinkButton(string linkText, ActionResult result)
{
return new BootstrapActionLinkButton(Html, linkText, result);
}

public BootstrapActionLinkButton ActionLinkButton(string linkText, string actionName)
{
return new BootstrapActionLinkButton(Html, linkText, actionName);
}

public BootstrapActionLinkButton ActionLinkButton(string linkText, string actionName, object routeValues)
{
return new BootstrapActionLinkButton(Html, linkText, actionName, routeValues);
}

public BootstrapActionLinkButton ActionLinkButton(string linkText, string actionName, string controllerName)
{
return new BootstrapActionLinkButton(Html, linkText, actionName, controllerName);
}

public BootstrapActionLinkButton ActionLinkButton(string linkText, string actionName, string controllerName, object routeValues)
{
return new BootstrapActionLinkButton(Html, linkText, actionName, controllerName, routeValues);
}

public BootstrapActionLinkButton ActionLinkButton(string linkText, ActionResult result, string protocol = null, string hostName = null, string fragment = null)
{
return new BootstrapActionLinkButton(Html, linkText, null, protocol ?? result.GetT4MVCResult().Protocol, hostName, fragment, result.GetRouteValueDictionary());
}

public BootstrapActionLinkButton ActionLinkButton(string linkText, string actionName, string controllerName, string protocol, string hostName, string fragment, object routeValues)
{
return new BootstrapActionLinkButton(Html, linkText, actionName, controllerName, protocol, hostName, fragment, routeValues);
}
}
}
229 changes: 229 additions & 0 deletions TwitterBootstrapMVC/BootstrapMethods/Bootstrap.Common.cs
@@ -0,0 +1,229 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web.Mvc;
using TwitterBootstrapMVC.Controls;
using TwitterBootstrapMVC.Infrastructure.Enums;

namespace TwitterBootstrapMVC.BootstrapMethods
{
public partial class Bootstrap<TModel>
{
public BootstrapLabel Label(string htmlFieldName)
{
return new BootstrapLabel(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapLabel LabelFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapLabel(Html, ExpressionHelper.GetExpressionText(expression), ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapTextBox TextBox(string htmlFieldName)
{
return new BootstrapTextBox(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapTextBox TextBoxFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapTextBox(Html, ExpressionHelper.GetExpressionText(expression), ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapPassword Password(string htmlFieldName)
{
return new BootstrapPassword(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapPassword PasswordFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapPassword(Html, ExpressionHelper.GetExpressionText(expression), ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapCheckBox CheckBox(string htmlFieldName)
{
return new BootstrapCheckBox(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapCheckBox CheckBoxFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapCheckBox(Html, ExpressionHelper.GetExpressionText(expression), ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapCheckBox CheckBoxSingleInput(string htmlFieldName, object value)
{
return new BootstrapCheckBox(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData), value, true);
}

public BootstrapRadioButton RadioButton(string htmlFieldName, object value)
{
return new BootstrapRadioButton(Html, htmlFieldName, value, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapRadioButton RadioButtonFor<TValue>(Expression<Func<TModel, TValue>> expression, object value)
{
return new BootstrapRadioButton(Html, ExpressionHelper.GetExpressionText(expression), value, ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapDropDownList DropDownList(string htmlFieldName, IEnumerable<SelectListItem> selectList)
{
return new BootstrapDropDownList(Html, htmlFieldName, selectList, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapDropDownList DropDownListFor<TValue>(Expression<Func<TModel, TValue>> expression, IEnumerable<SelectListItem> selectList)
{
return new BootstrapDropDownList(Html, ExpressionHelper.GetExpressionText(expression), selectList, ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapTextArea TextArea(string htmlFieldName)
{
return new BootstrapTextArea(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapTextArea TextAreaFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapTextArea(Html, ExpressionHelper.GetExpressionText(expression), ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapFile File(string htmlFieldName)
{
return new BootstrapFile(Html, htmlFieldName, ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData));
}

public BootstrapFile FileFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapFile(Html, ExpressionHelper.GetExpressionText(expression), ModelMetadata.FromLambdaExpression(expression, Html.ViewData));
}

public BootstrapButton SubmitButton()
{
return new BootstrapButton("submit");
}

public BootstrapButton Button()
{
return new BootstrapButton("button");
}

public BootstrapInputList<TModel, TSource, SValue, SText> CheckBoxList<TSource, SValue, SText>(
string htmlFieldName,
Expression<Func<TModel, IEnumerable<TSource>>> sourceDataExpression,
Expression<Func<TSource, SValue>> valueExpression,
Expression<Func<TSource, SText>> textExpression)
{
return new BootstrapInputList<TModel, TSource, SValue, SText>(
Html,
htmlFieldName,
ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData),
sourceDataExpression,
valueExpression,
textExpression,
BootstrapInputType.CheckBoxList);
}

public BootstrapInputList<TModel, TSource, SValue, SText> CheckBoxListFor<TValue, TSource, SValue, SText>(
Expression<Func<TModel, TValue>> expression,
Expression<Func<TModel, IEnumerable<TSource>>> sourceDataExpression,
Expression<Func<TSource, SValue>> valueExpression,
Expression<Func<TSource, SText>> textExpression)
{
return new BootstrapInputList<TModel, TSource, SValue, SText>(
Html,
ExpressionHelper.GetExpressionText(expression),
ModelMetadata.FromLambdaExpression(expression, Html.ViewData),
sourceDataExpression,
valueExpression,
textExpression,
BootstrapInputType.CheckBoxList);
}

public BootstrapInputList<TModel, TSource, SValue, SText> RadioButtonList<TSource, SValue, SText>(
string htmlFieldName,
Expression<Func<TModel, IEnumerable<TSource>>> sourceDataExpression,
Expression<Func<TSource, SValue>> valueExpression,
Expression<Func<TSource, SText>> textExpression)
{
return new BootstrapInputList<TModel, TSource, SValue, SText>(
Html,
htmlFieldName,
ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData),
sourceDataExpression,
valueExpression,
textExpression,
BootstrapInputType.RadioList);
}

public BootstrapInputList<TModel, TSource, SValue, SText> RadioButtonListFor<TValue, TSource, SValue, SText>(
Expression<Func<TModel, TValue>> expression,
Expression<Func<TModel, IEnumerable<TSource>>> sourceDataExpression,
Expression<Func<TSource, SValue>> valueExpression,
Expression<Func<TSource, SText>> textExpression)
{
return new BootstrapInputList<TModel, TSource, SValue, SText>(
Html,
ExpressionHelper.GetExpressionText(expression),
ModelMetadata.FromLambdaExpression(expression, Html.ViewData),
sourceDataExpression,
valueExpression,
textExpression,
BootstrapInputType.RadioList);
}

public BootstrapInputListFromEnum RadioButtonsFromEnum(string htmlFieldName)
{
return new BootstrapInputListFromEnum(
Html,
htmlFieldName,
ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData),
BootstrapInputType.RadioList);
}

public BootstrapInputListFromEnum RadioButtonsFromEnumFor<TValue>(Expression<Func<TModel, TValue>> expression)
{

return new BootstrapInputListFromEnum(
Html,
ExpressionHelper.GetExpressionText(expression),
ModelMetadata.FromLambdaExpression(expression, Html.ViewData),
BootstrapInputType.RadioList);
}

public BootstrapInputListFromEnum CheckBoxesFromEnum(string htmlFieldName)
{
return new BootstrapInputListFromEnum(
Html,
htmlFieldName,
ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData),
BootstrapInputType.CheckBoxList);
}

public BootstrapInputListFromEnum CheckBoxesFromEnumFor<TValue>(Expression<Func<TModel, TValue>> expression)
{
return new BootstrapInputListFromEnum(
Html,
ExpressionHelper.GetExpressionText(expression),
ModelMetadata.FromLambdaExpression(expression, Html.ViewData),
BootstrapInputType.CheckBoxList);
}

public BootstrapRadioButtonTrueFalse RadioButtonTrueFalse(string htmlFieldName)
{
return new BootstrapRadioButtonTrueFalse(
Html,
htmlFieldName,
ModelMetadata.FromStringExpression(htmlFieldName, Html.ViewData)
);
}

public BootstrapRadioButtonTrueFalse RadioButtonTrueFalseFor<TValue>(
Expression<Func<TModel, TValue>> expression)
{
return new BootstrapRadioButtonTrueFalse(
Html,
ExpressionHelper.GetExpressionText(expression),
ModelMetadata.FromLambdaExpression(expression, Html.ViewData)
);
}
}
}

0 comments on commit c33062d

Please sign in to comment.