HelpPages.cshtml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel>
  5. <script src='@Url.Content("~/Scripts/jquery.mCustomScrollbar.concat.min.js")'></script>
  6. <script>
  7. var deleteId;
  8. var saveOperation;
  9. $(document).ready(function () {
  10. setTimeout(function () {
  11. setHelpContentHeight();
  12. @if (ViewData["InitialEditHelpPage"] != null)
  13. {
  14. ViewContext.Writer.Write("editHelpPage(" + (int)ViewData["InitialEditHelpPage"] + ");");
  15. }
  16. }, 500);
  17. });
  18. $(window).resize(function () {
  19. setHelpContentHeight();
  20. });
  21. function setHelpContentHeight() {
  22. var height = $(window).height() - 50;
  23. $("#helpPageNavigation").height(height);
  24. $("#helpPageContent").height(height);
  25. }
  26. function viewHelpPage(id) {
  27. if (!id) return;
  28. $.ajax({
  29. url: '@Url.Action("ViewHelpPage", "Misc")',
  30. data: { Id: id },
  31. success: function (response) {
  32. setTimeout(function () {
  33. $("#helpPageContent").html(response);
  34. }, 200);
  35. },
  36. error: function () {
  37. alert("error occured");
  38. }
  39. });
  40. }
  41. function editHelpPage(id) {
  42. if (!id) return;
  43. $.ajax({
  44. url: '@Url.Action("EditHelpPage", "Misc")',
  45. data: { Id: id },
  46. success: function (response) {
  47. setTimeout(function () {
  48. $("#helpPageContent").html(response);
  49. devHelpPageHtmlContentEditor.SetHeight($(window).height() - 18);
  50. }, 200);
  51. },
  52. error: function () {
  53. alert("error occured");
  54. }
  55. });
  56. }
  57. function saveDataCallback() {
  58. devPopupControlEditHelpPage.Hide();
  59. }
  60. function confirmDelete(id) {
  61. if (!id) return;
  62. deleteId = id;
  63. $.ajax({
  64. type: "GET",
  65. url: '@Url.Action("GetHelpPage", "Misc")',
  66. data: { Id: id },
  67. success: function (response) {
  68. if (response == "notFound") return;
  69. var helpPage = JSON.parse(response);
  70. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteHelpPage);
  71. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{helpPage}", helpPage.Title));
  72. $(".dialogText").text($(".dialogText").text().replace("{helpPage}", helpPage.Title));
  73. popupControl.Show();
  74. }
  75. });
  76. }
  77. function deleteHelpPage() {
  78. $.ajax({
  79. type: "POST",
  80. url: '@Url.Action("DeleteHelpPage", "Misc")',
  81. data: { Id: deleteId },
  82. success: function (response) {
  83. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteHelpPage);
  84. popupControl.Hide();
  85. setTimeout(function () {
  86. window.location = window.location;
  87. }, 200);
  88. },
  89. error: function () {
  90. alert("error occured");
  91. }
  92. });
  93. }
  94. </script>
  95. <link rel="stylesheet" type="text/css" href='@Url.Content("~/Content/jquery.mCustomScrollbar.min.css")' />
  96. <style>
  97. .helpTable {
  98. width: 100%;
  99. }
  100. .helpTable > tbody > tr > td {
  101. vertical-align: top;
  102. }
  103. .helpTable > tbody > tr > td:first-of-type {
  104. padding-right: 12px;
  105. }
  106. .helpTable > tbody > tr > td:last-of-type {
  107. padding-left: 12px;
  108. }
  109. .helpPageMenu {
  110. width: auto;
  111. margin: 0 8px 6px 0;
  112. padding-bottom: 6px;
  113. border-bottom: 1px dashed #009688;
  114. overflow: auto;
  115. }
  116. #helpPageNavigation {
  117. border-right: 1px solid #009688;
  118. }
  119. #helpPageContent {
  120. color: black;
  121. }
  122. </style>
  123. <table class="helpTable">
  124. <tr>
  125. <td style="width: 20%">
  126. <div class="helpPageMenu">
  127. @Html.DevExpress().Button(b =>
  128. {
  129. b.Name = "devButtonNewHelpPage";
  130. b.Text = "Neu";
  131. b.UseSubmitBehavior = false;
  132. b.RenderMode = ButtonRenderMode.Link;
  133. b.ClientSideEvents.Click = "function (s, e) { editHelpPage(-1); }";
  134. }).GetHtml()
  135. </div>
  136. <div id="helpPageNavigation" class="mCustomScrollbar" data-mcs-theme="minimal-dark" style="width: 100%">
  137. @Html.Partial("~/Views/Misc/_HelpPageTreePartial.cshtml", Model)
  138. </div>
  139. </td>
  140. <td style="width: 80%">
  141. <div id="helpPageContent" class="mCustomScrollbar" data-mcs-theme="minimal-dark" style="width: 100%">
  142. </div>
  143. </td>
  144. </tr>
  145. </table>
  146. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  147. {
  148. PopupName = "devPopupControlDeleteHelpPage",
  149. Content = "<div class='dialogText' style='padding: 12px'>Sind Sie sicher, dass Sie die Hilfe-Seite \"{helpPage}\" löschen möchten?</div>",
  150. HeaderText = "\"{helpPage}\" löschen",
  151. YesFunction = "function (s, e) { deleteHelpPage(); }"
  152. })