Hide Document Templates & UI Tweaks
Flag Document Templates as hidden. UI changes aim to improve visibility of used features in lists.
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
const string pOnGenerateExpression = "ongenerateexpression";
|
||||
const string pOnImportAttachmentExpression = "onimportattachmentexpression";
|
||||
const string pFlattenForm = "flattenform";
|
||||
const string pIsHidden = "ishidden";
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
||||
@@ -63,6 +64,9 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
case pFlattenForm:
|
||||
UpdateFlattenForm(documentTemplate, value);
|
||||
break;
|
||||
case pIsHidden:
|
||||
UpdateIsHidden(documentTemplate, value);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Invalid Update Key");
|
||||
}
|
||||
@@ -190,6 +194,11 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return Update(id, pFlattenForm, FlattenForm, redirect);
|
||||
}
|
||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||
public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false)
|
||||
{
|
||||
return Update(id, pIsHidden, IsHidden, redirect);
|
||||
}
|
||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
|
||||
{
|
||||
return Update(id, pScope, Scope, redirect);
|
||||
@@ -393,6 +402,23 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateIsHidden(DocumentTemplate documentTemplate, string IsHidden)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(IsHidden))
|
||||
{
|
||||
documentTemplate.IsHidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool value = default(bool);
|
||||
if (bool.TryParse(IsHidden, out value))
|
||||
documentTemplate.IsHidden = value;
|
||||
else
|
||||
throw new Exception("Invalid Boolean Format");
|
||||
}
|
||||
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateJobSubTypes(DocumentTemplate documentTemplate, List<string> JobSubTypes)
|
||||
{
|
||||
Database.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
Reference in New Issue
Block a user