Align template picking more towards the other pickers (#11363)

* Align template picking more towards the other pickers

* style/cleanup - remove unused args, updated openItemPicker function name to openTemplatePicker since that's what we're opening

Co-authored-by: Nathan Woulfe <nathan@nathanw.com.au>
This commit is contained in:
patrickdemooij9
2021-10-21 02:09:08 +02:00
committed by GitHub
parent b13f260341
commit 809671b9ca
7 changed files with 110 additions and 40 deletions

View File

@@ -997,6 +997,15 @@ namespace Umbraco.Web.Editors
case UmbracoEntityTypes.Macro:
case UmbracoEntityTypes.Template:
var template = Services.FileService.GetTemplate(key);
if (template is null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return Mapper.Map<ITemplate, EntityBasic>(template);
default:
throw new NotSupportedException("The " + typeof(EntityController) + " does not currently support data for the type " + entityType);
}
@@ -1029,6 +1038,15 @@ namespace Umbraco.Web.Editors
case UmbracoEntityTypes.Macro:
case UmbracoEntityTypes.Template:
var template = Services.FileService.GetTemplate(id);
if (template is null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return Mapper.Map<ITemplate, EntityBasic>(template);
default:
throw new NotSupportedException("The " + typeof(EntityController) + " does not currently support data for the type " + entityType);
}