Guest User

Untitled

a guest
Jan 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.39 KB | None | 0 0
  1. @using Sentric.Admin.Models
  2. @using Sentric.Admin.Extensions
  3. @model EmailTemplateUpdateModel
  4.  
  5. @{
  6. Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_SentricLayout.cshtml";
  7.  
  8. var emailTypeToDisplay = Model.TemplateType.GetEnumDescription();
  9. ViewBag.Title = "Update '" + emailTypeToDisplay + "'";
  10. }
  11.  
  12. @section scripts {
  13. @Scripts.Render("~/bundles/jqueryajaxval")
  14. @Scripts.Render("~/bundles/jqueryval")
  15. @Scripts.Render("~/bundles/summernote")
  16.  
  17. **<script language="javascript" type="text/javascript">
  18. $(function () {
  19. $('.summernote').summernote({
  20. placeholder: 'Content...',
  21. height: 255, //set editable area's height
  22. focus: false, //set focus editable area after Initialize summernote
  23. oninit: function () { },
  24. onChange: function (contents, $editable) { }
  25. });**
  26.  
  27. $(document).on("click", "#CancelForm", function (e) {
  28. var uri = '@Html.Raw(Url.Action("EmailTemplateList", "EmailManagement", new
  29. {
  30. page = Model.PagingInfo.Page,
  31. take = Model.PagingInfo.Take,
  32. sortBy = Model.PagingInfo.SortPropertyName,
  33. sortAsc = Model.PagingInfo.SortAscending
  34. }))';
  35.  
  36. window.location = uri;
  37. e.preventDefault();
  38. });
  39.  
  40. $(document).on("click", "#UpdateForm", function (e) {
  41. // check if in code view mode, as update when in code view mode will
  42. // by default loose the markup changes
  43. var isCodeViewMode = $("button[data-event='codeview']").hasClass('active');
  44. if (isCodeViewMode) {
  45. // copy markup change to the content field
  46. var htmlContent = $('.summernote').code();
  47. $("#Content").val(htmlContent);
  48. }
  49. else {
  50. var content = $(".note-editor .note-editable").html();
  51. $("#Content").val(content);
  52. }
  53. });
  54.  
  55. $(document).on("click", ".titleInfoButton", function (e) {
  56. e.preventDefault();
  57.  
  58. $.magnificPopup.open({
  59. removalDelay: 500, //delay removal by X to allow out-animation,
  60. items: {
  61. src: $('#legendPopup')
  62. },
  63. callbacks: {
  64. beforeOpen: function (e) {
  65. this.st.mainClass = 'mfp-slideUp';
  66. }
  67. },
  68. midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
  69. });
  70. });
  71.  
  72. $(document).on("click", ".ClosePopup", function () {
  73. var magnificPopup = $.magnificPopup.instance;
  74. magnificPopup.close();
  75. });
  76.  
  77. // Copy buttons and copy functionality
  78. var copySupported = document.queryCommandSupported("copy");
  79. if (!copySupported) {
  80. $('.copyButton').addClass('hide');
  81. }
  82.  
  83. $('.copyButton').click(function (e) {
  84. e.preventDefault();
  85.  
  86. if (copySupported) {
  87. var text = $(this).parents('tr').find('.placeholderText').text();
  88. $('.placeholderCopyTarget').val(text);
  89. $(".placeholderCopyTarget").toggleClass('hidden');
  90. $('.placeholderCopyTarget').select();
  91. document.execCommand("copy");
  92. $(".placeholderCopyTarget").toggleClass('hidden');
  93.  
  94. $(this).text('Copied!');
  95. $(this).parents('tr').effect('highlight');
  96. }
  97. else {
  98. // Copy not supported in this browser
  99. }
  100. });
  101.  
  102. $('.copyButton').mouseout(function (e) {
  103. $(this).text('Copy');
  104. });
  105.  
  106. // template types and placeholders
  107. // on load
  108. var hiddenTemplateType = $('form#updateEmailTemplate').find('input[name=TemplateType]');
  109. var tempType = parseInt(hiddenTemplateType.val());
  110. showHideEmailTemplatePlaceholders(tempType);
  111. });
  112. </script>
  113. }
  114.  
  115. @section additionalStyles {
  116. @Styles.Render("~/Content/summernote")
  117. }
  118.  
  119. <article class="row">
  120. <h1 class="pageTitle artistHeader fw200 mb20 mt10">@ViewBag.Title</h1>
  121.  
  122. <div class="col-md-1"></div>
  123. <div id="emailTemplateResults" class="col-md-10">
  124. @using (Html.BeginForm("UpdateEmailTemplate",
  125. "EmailManagement", FormMethod.Post,
  126. new { id = "updateEmailTemplate", role = "form", @class = "theme-primary form-horizontal" }))
  127. {
  128. @Html.AntiForgeryToken()
  129.  
  130. @* None Editable fields *@
  131. @Html.HiddenFor(m => m.ID)
  132. @Html.HiddenFor(m => m.IsDeleted)
  133. @Html.HiddenFor(m => m.RowVersion)
  134. @Html.HiddenFor(m => m.TenantId)
  135. @Html.Hidden("TemplateType", (int)Model.TemplateType)
  136.  
  137. @* Pagination/ Sorting *@
  138. @Html.HiddenFor(m => m.PagingInfo.Page)
  139. @Html.HiddenFor(m => m.PagingInfo.Take)
  140. @Html.HiddenFor(m => m.PagingInfo.SortPropertyName)
  141. @Html.HiddenFor(m => m.PagingInfo.SortAscending)
  142.  
  143. <div class="panel">
  144. <div class="panel-heading">
  145. <span class="panel-title">
  146. <i class="glyphicon glyphicon-pencil"></i>&nbsp; Details Of '@emailTypeToDisplay'
  147. <a href="#" class="titleInfoButton"><i class="glyphicon glyphicon-info-sign"></i></a>
  148. </span>
  149. </div>
  150.  
  151. <fieldset>
  152. <legend style="display: none">Update Email Template Form</legend>
  153. <div class="panel-body p25 fill bt0">
  154. @Html.ValidationSummary(true, "Another user has updated this record while you've been editing. Please reload the record again.", new { @class = "text-danger" })
  155.  
  156. <div class="form-group">
  157. @Html.LabelFor(m => m.TemplateType, new { @class = "control-label col-lg-2" })
  158. <div class="col-lg-8">
  159. <p class="form-control-static text-muted">@emailTypeToDisplay</p>
  160. </div>
  161. </div>
  162.  
  163. <div class="form-group">
  164. @Html.LabelFor(m => m.Subject, new { @class = "control-label col-lg-2" })
  165. <div class="col-lg-8">
  166. @Html.TextBoxFor(m => m.Subject, new { @class = "form-control", id = "Subject", placeholder = "Subject..." })
  167. @Html.ValidationMessageFor(m => m.Subject, string.Empty, new { @class = "text-danger" })
  168. </div>
  169. </div>
  170.  
  171. <div class="section row">
  172. <div class="col-md-12">
  173. <div class="message-reply">
  174. <div class="summernote">@Html.Raw(Model.Content)</div>
  175. @Html.ValidationMessageFor(m => m.Content, string.Empty, new { @class = "text-danger" })
  176. </div>
  177. <div class="hidden">
  178. @Html.TextAreaFor(m => m.Content, new { @class = "form-control gui-input", id = "Content", placeholder = "Content..." })
  179. </div>
  180. </div>
  181. </div>
  182.  
  183. </div>
  184.  
  185. <div class="panel-footer">
  186. <div class="text-center">
  187. <input type="button" class="btn btn-primary" id="CancelForm" value="Cancel" />
  188. <input type="submit" class="btn btn-primary" id="UpdateForm" value="Update" />
  189. </div>
  190. </div>
  191.  
  192. </fieldset>
  193.  
  194. </div>
  195.  
  196. }
  197.  
  198. </div>
  199. <div class="col-md-1"></div>
  200.  
  201. </article>
  202.  
  203. @section modal {
  204. <div class="legend hidden">
  205. @Html.Partial("_PlaceholdersLegend")
  206. </div>
  207. }
Add Comment
Please, Sign In to add comment