Removing MacroType enum as we only have one type - PartialView. Refactoring all its references and fixing tests

This commit is contained in:
elitsa
2020-02-25 13:38:36 +01:00
parent c3d3e6e27d
commit 0a130d6bbd
16 changed files with 36 additions and 92 deletions

View File

@@ -0,0 +1,57 @@
using System.Collections.Generic;
using Umbraco.Core.Models;
namespace Umbraco.Web.Macros
{
public class MacroModel
{
/// <summary>
/// The Macro Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// The Macro Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// The Macro Alias
/// </summary>
public string Alias { get; set; }
public string MacroSource { get; set; }
public int CacheDuration { get; set; }
public bool CacheByPage { get; set; }
public bool CacheByMember { get; set; }
public bool RenderInEditor { get; set; }
public string CacheIdentifier { get; set; }
public List<MacroPropertyModel> Properties { get; } = new List<MacroPropertyModel>();
public MacroModel()
{ }
public MacroModel(IMacro macro)
{
if (macro == null) return;
Id = macro.Id;
Name = macro.Name;
Alias = macro.Alias;
MacroSource = macro.MacroSource;
CacheDuration = macro.CacheDuration;
CacheByPage = macro.CacheByPage;
CacheByMember = macro.CacheByMember;
RenderInEditor = macro.UseInEditor;
foreach (var prop in macro.Properties)
Properties.Add(new MacroPropertyModel(prop.Alias, string.Empty, prop.EditorAlias));
}
}
}