Skip to content

Commit

Permalink
Prefill template name when creating a template. (#15145)
Browse files Browse the repository at this point in the history
  • Loading branch information
microposmp authored and hishamco committed Feb 1, 2024
1 parent 60bd629 commit 1c68bfc
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public ActionResult IndexFilterPOST(TemplateIndexViewModel model)
{ _optionsSearch, model.Options.Search }
});

public async Task<IActionResult> Create(bool adminTemplates = false, string returnUrl = null)
public async Task<IActionResult> Create(string name = null, bool adminTemplates = false, string returnUrl = null)
{
if (!adminTemplates && !await _authorizationService.AuthorizeAsync(User, Permissions.ManageTemplates))
{
Expand All @@ -140,8 +140,14 @@ public async Task<IActionResult> Create(bool adminTemplates = false, string retu
return Forbid();
}

var model = new TemplateViewModel
{
AdminTemplates = adminTemplates,
Name = name
};

ViewData["ReturnUrl"] = returnUrl;
return View(new TemplateViewModel() { AdminTemplates = adminTemplates });
return View(model);
}

[HttpPost, ActionName(nameof(Create))]
Expand Down

0 comments on commit 1c68bfc

Please sign in to comment.