Browse Source

Add basic Visual Basic details view T4 template for ASP.NET MVC.

pull/18/head
Matt Ward 14 years ago
parent
commit
c04a7d3232
  1. 6
      src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj
  2. 66
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Details.tt
  3. 62
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Details.tt

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

@ -252,6 +252,9 @@
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\AspxVisualBasic\Create.tt"> <None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\AspxVisualBasic\Create.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\AspxVisualBasic\Details.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\AspxVisualBasic\Empty.tt"> <None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\AspxVisualBasic\Empty.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@ -260,6 +263,9 @@
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Create.tt"> <None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Create.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Details.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Empty.tt"> <None Include="ItemTemplates\VisualBasic\CodeTemplates\AddView\VBHTML\Empty.tt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>

66
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Details.tt

@ -0,0 +1,66 @@
<#@ template language="VB" HostSpecific="true" #>
<#@ import namespace="ICSharpCode.AspNet.Mvc" #>
<#@ import namespace="Microsoft.VisualBasic.Constants" #>
<# If MvcHost.IsPartialView Then #>
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl<#= GetViewPageType() #>" %>
<# ElseIf MvcHost.IsContentPage Then #>
<%@ Page Language="VB" MasterPageFile="<#= MvcHost.MasterPageFile #>" Inherits="System.Web.Mvc.ViewPage<#= GetViewPageType() #>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Title" runat="server">
<#= MvcHost.ViewName #>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="<#= MvcHost.PrimaryContentPlaceHolderID #>" runat="server">
<#
PushIndent(vbTab)
Else
#>
<%@ Page Language="VB" Inherits="System.Web.Mvc.ViewPage<#= GetViewPageType() #>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title><#= MvcHost.ViewName #></title>
</head>
<body>
<#
PushIndent(vbTab & vbTab)
End If
#>
<fieldset>
<legend><#= MvcHost.ViewDataType.Name #></legend>
</fieldset>
<p>
<%: Html.ActionLink("Edit", "Edit") %> |
<%: Html.ActionLink("Back", "Index") %>
</p>
<#
If MvcHost.IsPartialView Then
' Do nothing.
ElseIf MvcHost.IsContentPage Then
PopIndent()
#>
</asp:Content>
<#
Else
PopIndent()
#>
</body>
</html>
<# End If #>
<#+
ReadOnly Property MvcHost As MvcTextTemplateHost
Get
Return DirectCast(Host, MvcTextTemplateHost)
End Get
End Property
Public Function GetViewPageType() As String
Dim viewDataTypeName As String = MvcHost.ViewDataTypeName
If Not String.IsNullOrEmpty(viewDataTypeName) Then
Return String.Format("(Of {0})", viewDataTypeName)
End If
Return String.Empty
End Function
#>

62
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Details.tt

@ -0,0 +1,62 @@
<#@ 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
#>
<fieldset>
<legend><#= MvcHost.ViewDataType.Name #></legend>
</fieldset>
<p>
@Html.ActionLink("Edit", "Edit") |
@Html.ActionLink("Back", "Index")
</p>
<#
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