Browse Source

Add basic Razor VB.NET Create view T4 template.

pull/18/head
Matt Ward 14 years ago
parent
commit
f71cd538b1
  1. 3
      src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj
  2. 68
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Create.tt

3
src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj

@ -233,6 +233,9 @@ @@ -233,6 +233,9 @@
</None>
<EmbeddedResource Include="Resources\CSharpRazor.xshd" />
<EmbeddedResource Include="Resources\VisualBasicRazor.xshd" />
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Create.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Empty.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

68
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Create.tt

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
<#@ template language="VB" HostSpecific="true" #>
<#@ import namespace="ICSharpCode.AspNet.Mvc" #>
<#@ import namespace="Microsoft.VisualBasic.Constants" #>
<#@ output extension=".vbhtml" #>
<#= GetModelDirective() #>
<#
If MvcHost.IsPartialView Then
' Do nothing.
ElseIf MvcHost.IsContentPage Then
#>
@Code
ViewData("Title") = "<#= MvcHost.ViewName #>"
Layout = "<#= MvcHost.MasterPageFile #>"
End Code
<h2><#= MvcHost.ViewName #></h2>
<#
Else
#>
<!DOCTYPE html>
<html>
<head runat="server">
<title><#= MvcHost.ViewName #></title>
</head>
<body>
<#
PushIndent(vbTab & vbTab)
End If
#>
@Using Html.BeginForm()
@Html.ValidationSummary(True)
@<fieldset>
<legend><#= MvcHost.ViewDataType.Name #></legend>
<p>
<input type="submit" value="Create"/>
</p>
</fieldset>
End Using
<div>
@Html.ActionLink("Back", "Index")
</div>
<#
If MvcHost.IsPartialView Then
' Do nothing.
ElseIf Not MvcHost.IsContentPage Then
PopIndent()
#>
</body>
</html>
<# End If #>
<#+
ReadOnly Property MvcHost As MvcTextTemplateHost
Get
Return DirectCast(Host, MvcTextTemplateHost)
End Get
End Property
Function GetModelDirective() As String
Dim viewDataTypeName As String = MvcHost.ViewDataTypeName
If Not String.IsNullOrEmpty(viewDataTypeName) Then
Return String.Format("@ModelType {0}", viewDataTypeName)
End If
Return String.Empty
End Function
#>
Loading…
Cancel
Save