_HelpPageEditPartial.cshtml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @using GreenTree.Nachtragsmanagement.Web.Extensions
  2. @model GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel
  3. <div class="helpPageEditContainer">
  4. <script>
  5. function onHtmlToolbarCustomCommand(e) {
  6. if (!e) return;
  7. if (e.commandName == "save") {
  8. devPopupControlEditHelpPage.Show();
  9. }
  10. }
  11. function saveHelpPage() {
  12. var form = $("#helpPageEditForm");
  13. $(form).submit(function (e) {
  14. $.ajax({
  15. type: "POST",
  16. url: '@Url.Action("EditHelpPage", "Misc")',
  17. data: form.serialize(),
  18. success: function (response) {
  19. setTimeout(function () {
  20. $(".helpPageEditFormEditContainer").remove();
  21. if (response == "success") {
  22. parent.callCustomEventListener('HelpPageDataCallbackEventReceiver');
  23. } else {
  24. $("body").append(response);
  25. }
  26. }, 200);
  27. }
  28. });
  29. e.preventDefault();
  30. });
  31. form.submit();
  32. }
  33. </script>
  34. @using (Html.BeginForm("EditHelpPage", "Misc", FormMethod.Post, new { id = "helpPageEditForm" }))
  35. {
  36. @Html.Partial("~/Views/Misc/_HelpPageHtmlEditPartial.cshtml", Model)
  37. @Html.DevExpress().PopupControl(s =>
  38. {
  39. s.Name = "devPopupControlEditHelpPage";
  40. if (Model.Id == -1)
  41. s.HeaderText = "Neue Hilfe-Seite erstellen";
  42. else
  43. s.HeaderText = "\"" + Model.Title + "\" bearbeiten";
  44. s.Modal = true;
  45. s.Width = new Unit(250, UnitType.Pixel);
  46. s.CloseAction = CloseAction.CloseButton;
  47. s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
  48. s.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
  49. s.AllowDragging = false;
  50. s.AllowResize = false;
  51. s.ShowFooter = false;
  52. s.ShowOnPageLoad = false;
  53. s.SetContent(() =>
  54. {
  55. ViewContext.Writer.Write("<div class='editFormWrapper'>");
  56. ViewContext.Writer.Write("<input type=\"hidden\" value=\"" + Model.Id + "\" id=\"Id\" name=\"Id\" />");
  57. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Title, "Beschreibung:"));
  58. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Title).ToHtmlString());
  59. Html.DevExpress().TextBoxFor(m => m.Title, t =>
  60. {
  61. t.Width = new Unit(100, UnitType.Percentage);
  62. }).Render();
  63. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Category, "Kategorie:"));
  64. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Category).ToHtmlString());
  65. Html.DevExpress().TextBoxFor(m => m.Category, t =>
  66. {
  67. t.Width = new Unit(100, UnitType.Percentage);
  68. }).Render();
  69. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Subcategory, "Unterkategorie:"));
  70. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Subcategory).ToHtmlString());
  71. Html.DevExpress().TextBoxFor(m => m.Subcategory, t =>
  72. {
  73. t.Width = new Unit(100, UnitType.Percentage);
  74. }).Render();
  75. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.DisplayIndex, "Reihenfolge:"));
  76. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.DisplayIndex).ToHtmlString());
  77. Html.DevExpress().SpinEditFor(m => m.DisplayIndex, t =>
  78. {
  79. t.Width = new Unit(100, UnitType.Percentage);
  80. t.Number = 0;
  81. t.Properties.NumberType = SpinEditNumberType.Integer;
  82. }).Render();
  83. ViewContext.Writer.Write("</div>");
  84. Html.RenderPartial(
  85. "~/Views/Shared/_PopupButtonPanel.cshtml",
  86. new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
  87. {
  88. PopupName = "devPopupControlEditHelpPage",
  89. AcceptFunction = "function (s, e) { saveHelpPage(); }"
  90. }
  91. );
  92. });
  93. s.Styles.Content.Paddings.Padding = new Unit(0);
  94. s.Styles.ModalBackground.Opacity = 0;
  95. }).GetHtml()
  96. }
  97. </div>