EditNews.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <modal title='Edit News'>
  3. <div slot='body'>
  4. <label class='label'>Title</label>
  5. <p class='control'>
  6. <input class='input' type='text' placeholder='News Title' v-model='$parent.editing.title' autofocus>
  7. </p>
  8. <label class='label'>Description</label>
  9. <p class='control'>
  10. <input class='input' type='text' placeholder='News Description' v-model='$parent.editing.description'>
  11. </p>
  12. <div class="columns">
  13. <div class="column">
  14. <label class='label'>Bugs</label>
  15. <p class='control has-addons'>
  16. <input class='input' id='edit-bugs' type='text' placeholder='Bug' v-on:keyup.enter='addChange("bugs")'>
  17. <a class='button is-info' href='#' @click='addChange("bugs")'>Add</a>
  18. </p>
  19. <span class='tag is-info' v-for='(index, bug) in $parent.editing.bugs' track-by='$index'>
  20. {{ bug }}
  21. <button class='delete is-info' @click='removeChange("bugs", index)'></button>
  22. </span>
  23. </div>
  24. <div class="column">
  25. <label class='label'>Features</label>
  26. <p class='control has-addons'>
  27. <input class='input' id='edit-features' type='text' placeholder='Feature' v-on:keyup.enter='addChange("features")'>
  28. <a class='button is-info' href='#' @click='addChange("features")'>Add</a>
  29. </p>
  30. <span class='tag is-info' v-for='(index, feature) in $parent.editing.features' track-by='$index'>
  31. {{ feature }}
  32. <button class='delete is-info' @click='removeChange("features", index)'></button>
  33. </span>
  34. </div>
  35. </div>
  36. <div class="columns">
  37. <div class="column">
  38. <label class='label'>Improvements</label>
  39. <p class='control has-addons'>
  40. <input class='input' id='edit-improvements' type='text' placeholder='Improvement' v-on:keyup.enter='addChange("improvements")'>
  41. <a class='button is-info' href='#' @click='addChange("improvements")'>Add</a>
  42. </p>
  43. <span class='tag is-info' v-for='(index, improvement) in $parent.editing.improvements' track-by='$index'>
  44. {{ improvement }}
  45. <button class='delete is-info' @click='removeChange("improvements", index)'></button>
  46. </span>
  47. </div>
  48. <div class="column">
  49. <label class='label'>Upcoming</label>
  50. <p class='control has-addons'>
  51. <input class='input' id='edit-upcoming' type='text' placeholder='Upcoming' v-on:keyup.enter='addChange("upcoming")'>
  52. <a class='button is-info' href='#' @click='addChange("upcoming")'>Add</a>
  53. </p>
  54. <span class='tag is-info' v-for='(index, upcoming) in $parent.editing.upcoming' track-by='$index'>
  55. {{ upcoming }}
  56. <button class='delete is-info' @click='removeChange("upcoming", index)'></button>
  57. </span>
  58. </div>
  59. </div>
  60. </div>
  61. <div slot='footer'>
  62. <button class='button is-success' @click='$parent.updateNews(false)'>
  63. <i class='material-icons save-changes'>done</i>
  64. <span>&nbsp;Save</span>
  65. </button>
  66. <button class='button is-success' @click='$parent.updateNews(true)'>
  67. <i class='material-icons save-changes'>done</i>
  68. <span>&nbsp;Save and close</span>
  69. </button>
  70. <button class='button is-danger' @click='$parent.toggleModal()'>
  71. <span>&nbsp;Close</span>
  72. </button>
  73. </div>
  74. </modal>
  75. </template>
  76. <script>
  77. import { Toast } from 'vue-roaster';
  78. import Modal from './Modal.vue';
  79. export default {
  80. components: { Modal },
  81. methods: {
  82. addChange: function (type) {
  83. let change = $(`#edit-${type}`).val().trim();
  84. if (this.$parent.editing[type].indexOf(change) !== -1) return Toast.methods.addToast(`Tag already exists`, 3000);
  85. if (change) this.$parent.editing[type].push(change);
  86. else Toast.methods.addToast(`${type} cannot be empty`, 3000);
  87. },
  88. removeChange: function (type, index) {
  89. this.$parent.editing[type].splice(index, 1);
  90. },
  91. },
  92. events: {
  93. closeModal: function() {
  94. this.$parent.toggleModal();
  95. }
  96. }
  97. }
  98. </script>
  99. <style type='scss' scoped>
  100. input[type=range] {
  101. -webkit-appearance: none;
  102. width: 100%;
  103. margin: 7.3px 0;
  104. }
  105. input[type=range]:focus {
  106. outline: none;
  107. }
  108. input[type=range]::-webkit-slider-runnable-track {
  109. width: 100%;
  110. height: 5.2px;
  111. cursor: pointer;
  112. box-shadow: 0;
  113. background: #c2c0c2;
  114. border-radius: 0;
  115. border: 0;
  116. }
  117. input[type=range]::-webkit-slider-thumb {
  118. box-shadow: 0;
  119. border: 0;
  120. height: 19px;
  121. width: 19px;
  122. border-radius: 15px;
  123. background: #03a9f4;
  124. cursor: pointer;
  125. -webkit-appearance: none;
  126. margin-top: -6.5px;
  127. }
  128. input[type=range]::-moz-range-track {
  129. width: 100%;
  130. height: 5.2px;
  131. cursor: pointer;
  132. box-shadow: 0;
  133. background: #c2c0c2;
  134. border-radius: 0;
  135. border: 0;
  136. }
  137. input[type=range]::-moz-range-thumb {
  138. box-shadow: 0;
  139. border: 0;
  140. height: 19px;
  141. width: 19px;
  142. border-radius: 15px;
  143. background: #03a9f4;
  144. cursor: pointer;
  145. -webkit-appearance: none;
  146. margin-top: -6.5px;
  147. }
  148. input[type=range]::-ms-track {
  149. width: 100%;
  150. height: 5.2px;
  151. cursor: pointer;
  152. box-shadow: 0;
  153. background: #c2c0c2;
  154. border-radius: 1.3px;
  155. }
  156. input[type=range]::-ms-fill-lower {
  157. background: #c2c0c2;
  158. border: 0;
  159. border-radius: 0;
  160. box-shadow: 0;
  161. }
  162. input[type=range]::-ms-fill-upper {
  163. background: #c2c0c2;
  164. border: 0;
  165. border-radius: 0;
  166. box-shadow: 0;
  167. }
  168. input[type=range]::-ms-thumb {
  169. box-shadow: 0;
  170. border: 0;
  171. height: 15px;
  172. width: 15px;
  173. border-radius: 15px;
  174. background: #03a9f4;
  175. cursor: pointer;
  176. -webkit-appearance: none;
  177. margin-top: 1.5px;
  178. }
  179. .controls {
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. }
  184. .artist-genres {
  185. display: flex;
  186. justify-content: space-between;
  187. }
  188. #volumeSlider { margin-bottom: 15px; }
  189. .has-text-centered { padding: 10px; }
  190. .thumbnail-preview {
  191. display: flex;
  192. margin: 0 auto 25px auto;
  193. max-width: 200px;
  194. width: 100%;
  195. }
  196. .modal-card-body, .modal-card-foot { border-top: 0; }
  197. .label, .checkbox, h5 {
  198. font-weight: normal;
  199. }
  200. .video-container {
  201. display: flex;
  202. flex-direction: column;
  203. align-items: center;
  204. padding: 10px;
  205. iframe { pointer-events: none; }
  206. }
  207. .save-changes { color: #fff; }
  208. .tag:not(:last-child) { margin-right: 5px; }
  209. </style>