_HelpPageEditPartial.cshtml 3.3 KB

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