fix issue in theme creator

This commit is contained in:
Shaun Walker
2021-06-01 15:49:06 -04:00
parent 3c48657e73
commit 8dfe8eba27
8 changed files with 22 additions and 11 deletions

View File

@ -169,9 +169,12 @@ namespace Oqtane.Controllers
string templatePath = Utilities.PathCombine(_environment.WebRootPath, "Modules", "Templates", Path.DirectorySeparatorChar.ToString());
foreach (string directory in Directory.GetDirectories(templatePath))
{
string name = directory.Replace(templatePath, "");
if (System.IO.File.Exists(Path.Combine(directory, "template.json")))
{
var template = JsonSerializer.Deserialize<Template>(System.IO.File.ReadAllText(Path.Combine(directory, "template.json")));
template.Name = name;
template.Location = "";
if (template.Type.ToLower() != "internal")
{
template.Location = Utilities.PathCombine(root.Parent.ToString(), Path.DirectorySeparatorChar.ToString());
@ -180,7 +183,7 @@ namespace Oqtane.Controllers
}
else
{
templates.Add(new Template { Name = directory.Replace(templatePath, ""), Type = "External", Version = "", Location = Utilities.PathCombine(root.Parent.ToString(), Path.DirectorySeparatorChar.ToString()) });
templates.Add(new Template { Name = name, Title = name, Type = "External", Version = "", Location = Utilities.PathCombine(root.Parent.ToString(), Path.DirectorySeparatorChar.ToString()) });
}
}
return templates;