postal icon indicating copy to clipboard operation
postal copied to clipboard

Basic support for layouts outside MVC.

Open tystol opened this issue 9 years ago • 8 comments

This is a very quick spike to get layouts working via the RazorEngine.

The layout name must be the path to the layout file, relative from the root path specified when constructing the FileSystemRazorViewEngine. (e.g. asp.net style Layout = "~\Views\EmailLayout.cshtml" is not supported).

I can put some more time into this, but before proceeding wanted to check if it's ok to upgrade the RazorEngine version used. It currently uses 3.4.1, and 3.5 introduced quite a few API changes, so I'd rather upgrade to that before writing too much code against the old API.

tystol avatar May 09 '15 09:05 tystol

Hey thanks for picking this up. It's a frequently requested feature.

I've not looked at RazorEngine 3.5, but I assume we should be OK to upgrade.

andrewdavey avatar May 10 '15 13:05 andrewdavey

Can this be merged please?

ajbeaven avatar Aug 25 '15 23:08 ajbeaven

Must have

quedicesebas avatar Oct 28 '15 01:10 quedicesebas

We really need this.

bcronje avatar Oct 30 '15 23:10 bcronje

Sorry everyone, I haven't had any spare time to work on this. Probably won't for a while either. Someone else feel free to pick it up.

This PR does work as is though, with the limitations mentioned above. Or you can plug it into the current Nuget version of Postal. I'm doing it like this currently:

https://gist.github.com/tystol/9fd4db5e42d5d1943e60

Working well for me so far.

tystol avatar Oct 31 '15 00:10 tystol

Thanks @tystol , I actually just upgraded your code to use the latest API from RazorEngine and so far it seems to do the trick.

bcronje avatar Oct 31 '15 00:10 bcronje

For anyone else dealing with this issue here's the upgrade of the gist @tystol posted for the newest version of RazorEngine https://gist.github.com/mbcrawfo/2269f5a1a402792ff2d8

mbcrawfo avatar Dec 18 '15 04:12 mbcrawfo

+1 for merging this

vip32 avatar Feb 12 '16 20:02 vip32