TargetStudents.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <div class="card manage-card">
  3. <header class="card-header card-section">
  4. <p class="card-header-title">Target your Students</p>
  5. </header>
  6. <div class="card-content card-section">
  7. <form>
  8. <multi-line-text-input
  9. @valueUpdated="updateLine($event, 'wsl')"
  10. @addClicked="addLine('wsl')"
  11. @removeClicked="removeLine($event, 'wsl')"
  12. :lines="course.wsl"
  13. label="What will students learn"
  14. />
  15. <multi-line-text-input
  16. @valueUpdated="updateLine($event, 'requirements')"
  17. @addClicked="addLine('requirements')"
  18. @removeClicked="removeLine($event, 'requirements')"
  19. :lines="course.requirements"
  20. label="What are the requirements"
  21. />
  22. </form>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import MultiLineTextInput from "~/components/form/MultiLineTextInput";
  28. export default {
  29. components : {
  30. MultiLineTextInput
  31. },
  32. props :{
  33. course: {
  34. type: Object,
  35. required: true
  36. }
  37. },
  38. methods: {
  39. addLine(field) {
  40. // Dispatch action to add line
  41. console.log('Adding line for: ', field)
  42. this.$store.commit('instructor/course/addLine', field)
  43. },
  44. removeLine(index, field) {
  45. // Dispatch action to remove line line
  46. console.log('Removing line of index:', index)
  47. console.log('Removing line for:', field)
  48. this.$store.commit('instructor/course/removeLine', {field, index})
  49. },
  50. updateLine({value, index}, field) {
  51. this.$store.dispatch('instructor/course/updateLine', {field, value, index})
  52. }
  53. }
  54. }
  55. </script>