index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div class="heroes-page">
  3. <div class="container">
  4. <h1 class="title">Course Heroes</h1>
  5. <portal-target name="modal-view-hero-1" />
  6. <portal-target name="modal-view-hero-2" />
  7. <table class="heroes-table table is-responsive">
  8. <thead>
  9. <tr class="main-table-row">
  10. <th>Image</th>
  11. <th>Title</th>
  12. <th>Subtitle</th>
  13. <th>Status</th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. <tr @click="openModal('1')" class="table-row">
  18. <td>Hero Image</td>
  19. <td>Hero Title</td>
  20. <td>Hero Subtitle</td>
  21. <td>Active/ Inactive</td>
  22. <td class="modal-td" v-show="false">
  23. <portal to="modal-view-hero-1">
  24. <Modal
  25. ref="modal-1"
  26. :showButton="false"
  27. actionTitle="Make Active"
  28. openTitle="Favorite"
  29. title="Make Course Hero">
  30. <div>
  31. <div class="subtitle">
  32. Title: Some Title
  33. </div>
  34. <div class="subtitle">
  35. Subtitle: Some Subtitle
  36. </div>
  37. <figure class="image is-3by1">
  38. <img>
  39. </figure>
  40. </div>
  41. </Modal>
  42. </portal>
  43. </td>
  44. </tr>
  45. <tr @click="openModal('2')" class="table-row">
  46. <td>Hero Image</td>
  47. <td>Hero Title</td>
  48. <td>Hero Subtitle</td>
  49. <td>Active/ Inactive</td>
  50. <td class="modal-td" v-show="false">
  51. <portal to="modal-view-hero-2">
  52. <Modal
  53. ref="modal-2"
  54. :showButton="false"
  55. actionTitle="Make Active"
  56. openTitle="Favorite"
  57. title="Make Course Hero">
  58. <div>
  59. <div class="subtitle">
  60. Title: Some Title 2
  61. </div>
  62. <div class="subtitle">
  63. Subtitle: Some Subtitle 2
  64. </div>
  65. <figure class="image is-3by1">
  66. <img>
  67. </figure>
  68. </div>
  69. </Modal>
  70. </portal>
  71. </td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import Modal from '~/components/shared/Modal'
  80. export default {
  81. middleware: 'admin',
  82. components: {
  83. Modal
  84. },
  85. computed: {
  86. heroes() {
  87. return this.$store.state.instructor.heroes
  88. }
  89. },
  90. async fetch({store}) {
  91. await store.dispatch('instructor/fetchHeroes')
  92. },
  93. methods: {
  94. openModal(modalId) {
  95. this.$refs[`modal-${modalId}`].openModal()
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped lang="scss">
  101. .heroes-page {
  102. max-width: 1000px;
  103. margin: 0 auto 5rem auto;
  104. margin-top: 40px;
  105. }
  106. .title {
  107. font-size: 45px;
  108. font-weight: bold;
  109. }
  110. .isActive {
  111. }
  112. .table-row {
  113. margin: 20px;
  114. &.isActive {
  115. background-color: #dfffe1
  116. }
  117. &:hover {
  118. cursor: pointer;
  119. background-color: #e4e4e4;
  120. }
  121. }
  122. </style>