Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for VB.NET projects #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/cs/IMailerMethodTemplate.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="vb" #>

MailMessage <#= Model.MethodName #>();

17 changes: 17 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/cs/IMailerTemplate.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="vb" #>
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports Mvc.Mailer
Imports System.Net.Mail

Namespace <#= Model.Namespace #>.Mailers

Public Interface I<#= Model.MailerName #>
<# foreach(var mailerMethod in Model.MailerMethods) {#>
Function <#= mailerMethod #>() As MailMessage
<# } #>
End Interface

End Namespace
17 changes: 17 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/cs/MailerMethodTemplate.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="vb" #>

Public Overridable Function <#= mailerMethod #>() As MailMessage<# if( Model.Interface) { #> Implements I<#= Model.MailerName #>.<#= mailerMethod #>
<# } else { #>

<# } #>
Dim mailMessage = New MailMessage() With {
.Subject = "<#= mailerMethod #>"
}

'mailMessage.To.Add("[email protected]")
'ViewBag.data = someObject
PopulateBody(mailMessage, viewName:="<#= mailerMethod #>")

Return mailMessage
End Function
41 changes: 41 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/cs/MailerTemplate.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="vb" #>
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports Mvc.Mailer
Imports System.Net.Mail

Namespace <#= Model.Namespace #>.Mailers

Public Class <#= Model.MailerName #>
Inherits MailerBase
<# if( Model.Interface) { #>
Implements I<#= Model.MailerName #>
<# } #>

Public Sub New()
MyBase.New()
MasterName = "_Layout"
End Sub

<# foreach(var mailerMethod in Model.MailerMethods) {#>
Public Overridable Function <#= mailerMethod #>() As MailMessage<# if( Model.Interface) { #> Implements I<#= Model.MailerName #>.<#= mailerMethod #>
<# } else { #>

<# } #>
Dim mailMessage = New MailMessage() With {
.Subject = "<#= mailerMethod #>"
}

'mailMessage.To.Add("[email protected]")
'ViewBag.data = someObject
PopulateBody(mailMessage, viewName:="<#= mailerMethod #>")

Return mailMessage
End Function
<# } #>

End Class

End Namespace
17 changes: 17 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/view/aspx/Layout.Master.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="Master" #>
<%@ Master Language="VB" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
</head>
<body>
<div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="text.Master" #>
<%@ Master Language="VB" Inherits="System.Web.Mvc.ViewMasterPage" %>

<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
11 changes: 11 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.aspx.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="aspx" #>

<%@ Page Title="" Language="VB" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
HTML View for <#= Model.MailerName #>#<#= Model.ViewName #>
</asp:Content>
8 changes: 8 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/view/aspx/Mail.text.aspx.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="text.aspx" #>

<%@ Page Title="" Language="VB" MasterPageFile="~/Views/<#= Model.MailerName #>/_Layout.text.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
TEXT View for <#= Model.MailerName #>#<#= Model.ViewName #>
</asp:Content>
8 changes: 8 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/view/razor/Layout.cshtml.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="vbhtml" #>
<html>
<head></head>
<body>
@RenderBody()
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="text.vbhtml" #>

@RenderBody()
4 changes: 4 additions & 0 deletions Mvc.Mailer/NuGet/input/tools/view/razor/Mail.cshtml.vb.t4
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="vbhtml" #>

HTML View for <#= Model.MailerName #>#<#= Model.ViewName #>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output Extension="text.vbhtml" #>

Text View for <#= Model.MailerName #>#<#= Model.ViewName #>