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.

102 lines
3.1 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <app-buckets>
  2. <div class="buckets">
  3. <div class="grid">
  4. <div class="col-12 col-md-4 col-xlg-3" each={ bucket in state.buckets }>
  5. <article class="panel buckets__item">
  6. <div class="bar">
  7. <div class="bar__end w-100">
  8. <button class="button button--transparent" onclick={ (event) => { handleDelete(event, bucket) } }>
  9. <svg class="icon fill-text-contrast" aria-hidden="true">
  10. <use xlink:href="/symbol-defs.svg#icon-delete"></use>
  11. </svg>
  12. </button>
  13. </div>
  14. </div>
  15. <div class="panel__body">
  16. <a href="/bucket/{ bucket._id }">
  17. <h3 class="buckets__title">
  18. { bucket.title }
  19. </h3>
  20. <div class="content">
  21. <p>
  22. { bucket.description }
  23. </p>
  24. </div>
  25. </a>
  26. </div>
  27. </article>
  28. </div>
  29. </div>
  30. <div class="grid">
  31. <div class="col-12">
  32. <div class="buckets__more">
  33. <button type="button" class="button" onclick={ handleClick }>
  34. More
  35. <svg class="icon" aria-hidden="true">
  36. <use xlink:href="/symbol-defs.svg#icon-arrow-down"></use>
  37. </svg>
  38. </button>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <script>
  44. import axios from 'axios'
  45. import remove from 'lodash.remove'
  46. /**
  47. *
  48. *
  49. *
  50. * @author Björn Hase
  51. *
  52. */
  53. export default {
  54. state: {
  55. buckets: []
  56. },
  57. onBeforeMount() {
  58. this.fetch()
  59. },
  60. handleClick() {
  61. },
  62. handleDelete(event, bucket) {
  63. event.preventDefault()
  64. axios.delete('/api/bucket/' + bucket._id)
  65. .then((response) => {
  66. // removing from buckets
  67. remove(this.state.buckets, function(b) {
  68. return b._id === bucket._id
  69. })
  70. this.update()
  71. })
  72. },
  73. /**
  74. * getting all buckets
  75. *
  76. *
  77. */
  78. fetch() {
  79. axios.get('/api/bucket/', {
  80. params: {
  81. visiblity: this.props.visiblity
  82. }
  83. }).then((response) => {
  84. this.state.buckets = response.data.data
  85. this.update()
  86. })
  87. }
  88. }
  89. </script>
  90. </app-buckets>