The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ModifyVault.cshtml 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. @model Teknik.Areas.Vault.ViewModels.ModifyVaultViewModel
  2. @using Teknik.Areas.Vault.ViewModels
  3. @{
  4. string action = (Model.isEdit) ? "EditVault" : "CreateVault";
  5. string title = (Model.isEdit) ? "Edit Vault" : "Create a New Vault";
  6. }
  7. <script>
  8. var helpURL = '@Url.SubRouteUrl("help", "Help.Markdown")';
  9. var validateItemURL = '@Url.SubRouteUrl(Model.CurrentSub, "Vault.Action", new { action = "ValidateItem" })';
  10. var modifyVaultURL = '@Url.SubRouteUrl(Model.CurrentSub, "Vault.Action", new { action = action })';
  11. var itemCount = @Model.items.Count();
  12. </script>
  13. <bundle src="css/vault.min.css" append-version="true"></bundle>
  14. <div class="container">
  15. @if (Model.Error)
  16. {
  17. <div class="row">
  18. <div class="col-sm-10 col-sm-offset-1 text-center">
  19. <div class="alert alert-danger" role="alert">@Model.ErrorMessage</div>
  20. </div>
  21. </div>
  22. }
  23. <div class="modal fade" id="newItem" tabindex="-1" role="dialog" aria-labelledby="newItemLabel" aria-hidden="true">
  24. <div class="modal-dialog">
  25. <div class="modal-content">
  26. <!form class="form" action="##" method="post" id="addItem" enctype="multipart/form-data">
  27. <div class="modal-header">
  28. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Cancel</span></button>
  29. <h4 class="modal-title" id="newItemLabel">Add an Item</h4>
  30. </div>
  31. <div class="modal-body">
  32. <div class="row" id="item_error" style="display: none;">
  33. <div class="col-sm-10 col-sm-offset-1 text-center">
  34. <div class="alert alert-danger" role="alert" id="item_error_msg"></div>
  35. </div>
  36. </div>
  37. <div class="row">
  38. <div class="form-group col-sm-12">
  39. <label for="item_title"><h4>Title</h4></label>
  40. <input class="form-control" name="item_title" id="item_title" placeholder="Descriptive Title" title="enter a title for the item." type="text" />
  41. </div>
  42. </div>
  43. <div class="row">
  44. <div class="form-group col-sm-12">
  45. <label for="item_description"><h4>Description</h4></label>
  46. <textarea class="form-control wmd-input" name="item_description" id="item_description" placeholder="Optional" title="enter what the item is about." rows="5"></textarea>
  47. </div>
  48. </div>
  49. <div class="row">
  50. <div class="form-group col-sm-12">
  51. <label for="item_type"><h4>Type</h4></label>
  52. <select class="form-control" name="item_type" id="item_type">
  53. <!option>Upload</!option>
  54. <!option>Paste</!option>
  55. </select>
  56. </div>
  57. </div>
  58. <div class="row">
  59. <div class="form-group col-sm-12">
  60. <label for="item_url"><h4>Url or Id</h4></label>
  61. <input class="form-control" name="item_url" id="item_url" placeholder="https://service.teknik.io/XXXXX or XXXXX" title="enter the url id for the item" type="text" />
  62. </div>
  63. </div>
  64. </div>
  65. <div class="modal-footer">
  66. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  67. <button type="button" class="btn btn-primary" id="new_item_submit">Add</button>
  68. </div>
  69. </!form>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="modal fade" id="editItem" tabindex="-1" role="dialog" aria-labelledby="editItemLabel" aria-hidden="true">
  74. <div class="modal-dialog">
  75. <div class="modal-content">
  76. <!form class="form" action="##" method="post" id="editItemForm" enctype="multipart/form-data">
  77. <input type="hidden" value="" id="item_id"/>
  78. <div class="modal-header">
  79. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Cancel</span></button>
  80. <h4 class="modal-title" id="editItemLabel">Edit Item</h4>
  81. </div>
  82. <div class="modal-body">
  83. <div class="row" id="item_error" style="display: none;">
  84. <div class="col-sm-10 col-sm-offset-1 text-center">
  85. <div class="alert alert-danger" role="alert" id="item_error_msg"></div>
  86. </div>
  87. </div>
  88. <div class="row">
  89. <div class="form-group col-sm-12">
  90. <label for="item_title"><h4>Title</h4></label>
  91. <input class="form-control" name="item_title" id="item_title" placeholder="Descriptive Title" title="enter a title for the item." type="text" />
  92. </div>
  93. </div>
  94. <div class="row">
  95. <div class="form-group col-sm-12">
  96. <label for="item_description"><h4>Description</h4></label>
  97. <textarea class="form-control wmd-input" name="item_description" id="item_description" placeholder="Optional" title="enter what the item is about." rows="5"></textarea>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="modal-footer">
  102. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  103. <button type="button" class="btn btn-primary" id="edit_item_submit">Save</button>
  104. </div>
  105. </!form>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="row">
  110. <div class="col-sm-10 col-sm-offset-1 text-center">
  111. <h2>@title</h2>
  112. </div>
  113. </div>
  114. <!form class="form" action="##" method="post" id="vaultForm">
  115. <input type="hidden" id="vaultId" name="vaultId" value="@Model.vaultId" />
  116. <div class="row">
  117. <div class="col-sm-10">
  118. <div class="row">
  119. <div class="form-group col-sm-12">
  120. <label for="title"><h4>Title</h4></label>
  121. <input class="form-control" name="title" id="title" placeholder="Collection of items" title="enter a title for your vault." type="text" value="@Model.title" />
  122. </div>
  123. </div>
  124. <div class="row">
  125. <div class="col-sm-6">
  126. <div class="panel panel-default">
  127. <div class="panel-heading">Description</div>
  128. <div class="panel-body">
  129. <div class="mdd_toolbar"></div>
  130. <textarea class="form-control mdd_editor" name="description" id="description" placeholder="This is a cool collection of uploads and pastes" title="enter the description for this vault" data-provide="markdown" rows="5">@Model.description</textarea>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="col-sm-6">
  135. <div class="panel panel-default">
  136. <div class="panel-heading">Preview</div>
  137. <div class="panel-body">
  138. <div class="mdd_preview"></div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="col-sm-2">
  145. <br />
  146. <br />
  147. <div class="row">
  148. <div class="form-group col-sm-12">
  149. <button type="submit" class="btn btn-primary pull-left" id="submit">Save Vault</button>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. <br />
  155. <div class="col-sm-10">
  156. <div class="row">
  157. <div class="form-group col-sm-10 col-sm-offset-1">
  158. <button type="button" class="btn btn-default pull-right" id="add-item" data-toggle="modal" data-target="#newItem">Add Item</button>
  159. </div>
  160. </div>
  161. </div>
  162. <br />
  163. <div class="row">
  164. <div class="col-sm-10" id="vault-items">
  165. @if (Model.items.Any())
  166. {
  167. foreach (ModifyVaultItemViewModel item in Model.items)
  168. {
  169. @await Html.PartialAsync("~/Areas/Vault/Views/Vault/ModifyVaultItem.cshtml", item)
  170. }
  171. }
  172. </div>
  173. </div>
  174. </!form>
  175. </div>
  176. <div id="templates" style="display: none">
  177. @await Html.PartialAsync("~/Areas/Vault/Views/Vault/ModifyVaultItem.cshtml", new ModifyVaultItemViewModel())
  178. </div>
  179. <bundle src="js/vault.min.js" append-version="true"></bundle>