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 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. @model Teknik.Areas.Vault.ViewModels.ModifyVaultViewModel
  2. @using Teknik.Utilities
  3. @using Teknik.Areas.Vault.ViewModels
  4. @Styles.Render("~/Content/vault")
  5. @{
  6. string action = (Model.isEdit) ? "EditVault" : "CreateVault";
  7. string title = (Model.isEdit) ? "Edit Vault" : "Create a New Vault";
  8. }
  9. <script type="text/javascript">
  10. var validateItemURL = '@Url.SubRouteUrl("vault", "Vault.Action", new { action = "ValidateItem" })';
  11. var modifyVaultURL = '@Url.SubRouteUrl("vault", "Vault.Action", new { action = action })';
  12. var itemCount = @Model.items.Count();
  13. </script>
  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-10 col-sm-offset-1">
  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="form-group col-sm-10 col-sm-offset-1">
  126. <label for="article"><h4>Description</h4></label>
  127. <textarea class="form-control" name="description" id="description" placeholder="This is a cool collection of uploads and pastes" title="enter the description for this vault" rows="5">@Model.description</textarea>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="col-sm-2">
  132. <br />
  133. <br />
  134. <div class="row">
  135. <div class="form-group col-sm-12">
  136. <button type="submit" class="btn btn-primary pull-left" id="submit">Save Vault</button>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <br />
  142. <div class="col-sm-10">
  143. <div class="row">
  144. <div class="form-group col-sm-10 col-sm-offset-1">
  145. <button type="button" class="btn btn-default pull-right" id="add-item" data-toggle="modal" data-target="#newItem">Add Item</button>
  146. </div>
  147. </div>
  148. </div>
  149. <br />
  150. <div class="row">
  151. <div class="col-sm-10" id="vault-items">
  152. @if (Model.items.Any())
  153. {
  154. foreach (ModifyVaultItemViewModel item in Model.items)
  155. {
  156. @Html.Partial("~/Areas/Vault/Views/Vault/ModifyVaultItem.cshtml", item)
  157. }
  158. }
  159. </div>
  160. </div>
  161. </form>
  162. </div>
  163. <div id="templates" style="display: none">
  164. @Html.Partial("~/Areas/Vault/Views/Vault/ModifyVaultItem.cshtml", new ModifyVaultItemViewModel())
  165. </div>
  166. @Scripts.Render("~/bundles/vault")