EditSong.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class='modal is-active'>
  3. <div class='modal-background'></div>
  4. <div class='modal-card'>
  5. <section class='modal-card-body'>
  6. <h5 class='has-text-centered'>Video Preview</h5>
  7. <div class='video-container'>
  8. <div id='player'></div>
  9. <div class="controls">
  10. <form action="#" class="column is-7-desktop is-4-mobile">
  11. <p style="margin-top: 0; position: relative;">
  12. <input type="range" id="volumeSlider" min="0" max="100" class="active" v-on:change="$parent.changeVolume()" v-on:input="$parent.changeVolume()">
  13. </p>
  14. </form>
  15. <p class='control has-addons'>
  16. <a class='button' @click='$parent.video.settings("pause")' v-if='!$parent.video.paused' href='#'>
  17. <i class='material-icons'>pause</i>
  18. </a>
  19. <a class='button' @click='$parent.video.settings("play")' v-if='$parent.video.paused' href='#'>
  20. <i class='material-icons'>play_arrow</i>
  21. </a>
  22. <a class='button' @click='$parent.video.settings("stop")' href='#'>
  23. <i class='material-icons'>stop</i>
  24. </a>
  25. <a class='button' @click='$parent.video.settings("skipToLast10Secs")' href='#'>
  26. <i class='material-icons'>fast_forward</i>
  27. </a>
  28. </p>
  29. </div>
  30. </div>
  31. <h5 class='has-text-centered'>Thumbnail Preview</h5>
  32. <img class='thumbnail-preview' :src='$parent.editing.song.thumbnail' onerror="this.src='/assets/notes-transparent.png'">
  33. <label class='label'>Thumbnail URL</label>
  34. <p class='control'>
  35. <input class='input' type='text' v-model='$parent.editing.song.thumbnail'>
  36. </p>
  37. <h5 class='has-text-centered'>Edit Info</h5>
  38. <p class='control'>
  39. <label class='checkbox'>
  40. <input type='checkbox' v-model='$parent.editing.song.explicit'>
  41. Explicit
  42. </label>
  43. </p>
  44. <label class='label'>Song ID</label>
  45. <p class='control'>
  46. <input class='input' type='text' v-model='$parent.editing.song._id'>
  47. </p>
  48. <label class='label'>Song Title</label>
  49. <p class='control'>
  50. <input class='input' type='text' v-model='$parent.editing.song.title'>
  51. </p>
  52. <div class='control is-horizontal'>
  53. <div class='control is-grouped'>
  54. <div>
  55. <p class='control has-addons'>
  56. <input class='input' id='new-artist' type='text' placeholder='Artist'>
  57. <a class='button is-info' @click='$parent.addTag("artists")' href='#'>Add Artist</a>
  58. </p>
  59. <span class='tag is-info' v-for='(index, artist) in $parent.editing.song.artists' track-by='$index'>
  60. {{ artist }}
  61. <button class='delete is-info' @click='$parent.$parent.removeTag("artists", index)'></button>
  62. </span>
  63. </div>
  64. <div>
  65. <p class='control has-addons'>
  66. <input class='input' id='new-genre' type='text' placeholder='Genre'>
  67. <a class='button is-info' @click='$parent.addTag("genres")' href='#'>Add Genre</a>
  68. </p>
  69. <span class='tag is-info' v-for='(index, genre) in $parent.editing.song.genres' track-by='$index'>
  70. {{ genre }}
  71. <button class='delete is-info' @click='$parent.$parent.removeTag("genres", index)'></button>
  72. </span>
  73. </div>
  74. </div>
  75. </div>
  76. <label class='label'>Song Duration</label>
  77. <p class='control'>
  78. <input class='input' type='text' v-model='$parent.editing.song.duration'>
  79. </p>
  80. <label class='label'>Skip Duration</label>
  81. <p class='control'>
  82. <input class='input' type='text' v-model='$parent.editing.song.skipDuration'>
  83. </p>
  84. </section>
  85. <footer class='modal-card-foot'>
  86. <a class='button is-success' @click='$parent.save($parent.editing.song)' href='#'>
  87. <i class='material-icons save-changes'>done</i>
  88. <span>&nbsp;Save</span>
  89. </a>
  90. <a class='button is-danger' @click='$parent.toggleModal()' href='#'>
  91. <span>&nbsp;Cancel</span>
  92. </a>
  93. </footer>
  94. </div>
  95. </div>
  96. </template>
  97. <script>
  98. export default {
  99. methods: {
  100. toggleModal: function () {
  101. this.$dispatch('toggleModal', 'login');
  102. },
  103. submitModal: function () {
  104. this.$dispatch('login');
  105. this.toggleModal();
  106. }
  107. },
  108. events: {
  109. closeModal: function() {
  110. this.$parent.toggleModal()
  111. }
  112. }
  113. }
  114. </script>
  115. <style type='scss' scoped>
  116. input[type=range] {
  117. -webkit-appearance: none;
  118. width: 100%;
  119. margin: 7.3px 0;
  120. }
  121. input[type=range]:focus {
  122. outline: none;
  123. }
  124. input[type=range]::-webkit-slider-runnable-track {
  125. width: 100%;
  126. height: 5.2px;
  127. cursor: pointer;
  128. box-shadow: 0;
  129. background: #c2c0c2;
  130. border-radius: 0;
  131. border: 0;
  132. }
  133. input[type=range]::-webkit-slider-thumb {
  134. box-shadow: 0;
  135. border: 0;
  136. height: 19px;
  137. width: 19px;
  138. border-radius: 15px;
  139. background: #03a9f4;
  140. cursor: pointer;
  141. -webkit-appearance: none;
  142. margin-top: -6.5px;
  143. }
  144. input[type=range]::-moz-range-track {
  145. width: 100%;
  146. height: 5.2px;
  147. cursor: pointer;
  148. box-shadow: 0;
  149. background: #c2c0c2;
  150. border-radius: 0;
  151. border: 0;
  152. }
  153. input[type=range]::-moz-range-thumb {
  154. box-shadow: 0;
  155. border: 0;
  156. height: 19px;
  157. width: 19px;
  158. border-radius: 15px;
  159. background: #03a9f4;
  160. cursor: pointer;
  161. -webkit-appearance: none;
  162. margin-top: -6.5px;
  163. }
  164. input[type=range]::-ms-track {
  165. width: 100%;
  166. height: 5.2px;
  167. cursor: pointer;
  168. box-shadow: 0;
  169. background: #c2c0c2;
  170. border-radius: 1.3px;
  171. }
  172. input[type=range]::-ms-fill-lower {
  173. background: #c2c0c2;
  174. border: 0;
  175. border-radius: 0;
  176. box-shadow: 0;
  177. }
  178. input[type=range]::-ms-fill-upper {
  179. background: #c2c0c2;
  180. border: 0;
  181. border-radius: 0;
  182. box-shadow: 0;
  183. }
  184. input[type=range]::-ms-thumb {
  185. box-shadow: 0;
  186. border: 0;
  187. height: 15px;
  188. width: 15px;
  189. border-radius: 15px;
  190. background: #03a9f4;
  191. cursor: pointer;
  192. -webkit-appearance: none;
  193. margin-top: 1.5px;
  194. }
  195. .controls {
  196. display: flex;
  197. flex-direction: column;
  198. align-items: center;
  199. }
  200. #volumeSlider { margin-bottom: 15px; }
  201. .has-text-centered { padding: 10px; }
  202. .thumbnail-preview {
  203. display: flex;
  204. margin: 0 auto;
  205. max-width: 200px;
  206. width: 100%;
  207. }
  208. .modal-card-body, .modal-card-foot { border-top: 0; }
  209. .label, .checkbox, h5 {
  210. font-weight: normal;
  211. }
  212. .video-container {
  213. display: flex;
  214. flex-direction: column;
  215. align-items: center;
  216. padding: 10px;
  217. iframe { pointer-events: none; }
  218. }
  219. .save-changes { color: #fff; }
  220. .tag:not(:last-child) { margin-right: 5px; }
  221. </style>