Skip to content

Commit f10e48a

Browse files
committed
Show form title on browser title
1 parent 65c136d commit f10e48a

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

Controllers/HomeController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public IActionResult FormResponse(string formName, string id)
2929
}
3030
public IActionResult EditForm(string formName, bool isAdmin = false)
3131
{
32-
return View(new EditFormModel() { FormName = formName, IsAdmin = isAdmin });
32+
string formTitle = DomainModelList.GetTitleByFormName(formName);
33+
return View(new EditFormModel() { FormTitle = formTitle, IsAdmin = isAdmin });
3334
}
3435

3536
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]

Data/patient-assessment.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,7 @@
644644
]
645645
}
646646
],
647-
"showProgressBar": "top",
648-
"progressBarType": "buttons",
647+
"showTOC": true,
649648
"completeText": "Submit",
650649
"showPreviewBeforeComplete": "showAllQuestions",
651650
"showQuestionNumbers": false,

DomainModels/DomainModelList.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public static Type GetTypeByFormName(string name)
6262
domains.TryGetValue(name, out res);
6363
return res != null ? res.Type : null;
6464
}
65+
public static string GetTitleByFormName(string name)
66+
{
67+
DomainModelInfo res;
68+
domains.TryGetValue(name, out res);
69+
return res != null ? res.Title : name;
70+
}
6571
public static IList<DomainModelInfo> GetAllForms()
6672
{
6773
var list = new List<DomainModelInfo>();

Models/EditFormModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace SurveyJSAsFormLibrary.Models
44
{
55
public class EditFormModel
66
{
7-
public string FormName { get; set; }
7+
public string FormTitle { get; set; }
88
public bool IsAdmin { get; set; }
99
}
1010
}

Views/Home/EditForm.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
<script src="~/js/creatorjs.js" asp-append-version="true"></script>
1313
<script src="~/js/codegenerator.js" asp-append-version="true"></script>
1414
@{
15-
ViewData["Title"] = "Edit Form as " + (Model.IsAdmin ? "Administrator: " : "Content Manager: ") + Model.FormName;
15+
ViewData["Title"] = "Edit Form as " + (Model.IsAdmin ? "Administrator: " : "Content Manager: ") + Model.FormTitle;
1616
}
1717
<div id="surveyCreatorContainer" style="height: 100vh;"></div>
1818
<script>
1919
const creator = new SurveyCreator.SurveyCreator(getCreatorOptions(false));
20-
setupCreator(creator, "@Model.FormName", "@Model.IsAdmin" === "True");
20+
setupCreator(creator, "@Model.FormTitle", "@Model.IsAdmin" === "True");
2121
creator.render("surveyCreatorContainer");
2222
</script>

0 commit comments

Comments
 (0)