Merge pull request #1431 from sbwalker/dev

fix issue in theme creator
This commit is contained in:
Shaun Walker
2021-06-01 15:45:09 -04:00
committed by GitHub
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;

View File

@ -96,9 +96,12 @@ namespace Oqtane.Controllers
string templatePath = Utilities.PathCombine(_environment.WebRootPath, "Themes", "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());
@ -107,7 +110,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;

View File

@ -1,5 +1,5 @@
{
"Name": "Default Module Template",
"Title": "Default Module Template",
"Type": "External",
"Version": "2.1.0"
}

View File

@ -1,5 +1,5 @@
{
"Name": "Default Theme Template",
"Title": "Default Theme Template",
"Type": "External",
"Version": "2.1.0"
}