* Add migration that adds BlockGrid files to disk * Add partial views to disk when creating sample * Refactor upgrade to use IPartialViewPopulator * Add blockgrid default rendering partial views when creating a new project from template * Remove views from static assets Co-authored-by: Elitsa Marinovska <elm@umbraco.dk>
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using Umbraco.Cms.Infrastructure.Templates.PartialViews;
|
|
|
|
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_10_3_0;
|
|
|
|
public class AddBlockGridPartialViews : MigrationBase
|
|
{
|
|
private readonly IPartialViewPopulator _partialViewPopulator;
|
|
private const string FolderPath = "/Views/Partials/blockgrid";
|
|
private static readonly string[] _filesToAdd =
|
|
{
|
|
"areas.cshtml",
|
|
"default.cshtml",
|
|
"items.cshtml",
|
|
};
|
|
|
|
public AddBlockGridPartialViews(IMigrationContext context, IPartialViewPopulator partialViewPopulator) : base(context)
|
|
=> _partialViewPopulator = partialViewPopulator;
|
|
|
|
protected override void Migrate()
|
|
{
|
|
var embeddedBasePath = _partialViewPopulator.CoreEmbeddedPath + ".BlockGrid";
|
|
|
|
foreach (var fileName in _filesToAdd)
|
|
{
|
|
_partialViewPopulator.CopyPartialViewIfNotExists(
|
|
_partialViewPopulator.GetCoreAssembly(),
|
|
$"{embeddedBasePath}.{fileName}",
|
|
$"{FolderPath}/{fileName}");
|
|
}
|
|
}
|
|
}
|