Ingen beskrivning

course.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. // import {MDCDataTable} from '@material/data-table';
  2. // const dataTable = new MDCDataTable(document.querySelector('.mdc-data-table'));
  3. $(document).ready(function() {
  4. // $('#course-table').DataTable({
  5. // paging: true,
  6. // pagingType: 'simple',
  7. // searching: false,
  8. // scrollCollapse: false,
  9. // columnDefs: [
  10. // {targets: [0,1], orderable: true},
  11. // {targets: '_all', orderable: false}
  12. // ]
  13. // });
  14. $(function () {
  15. $('[data-toggle="tooltip"]').tooltip();
  16. });
  17. $('#modal-syllabus').on('show.bs.modal', function (event) {
  18. var button = $(event.relatedTarget);
  19. var courseID = button.data('course-id');
  20. $(this).find('#modal-syllabus-form').attr('action', `/course/${courseID}`);
  21. });
  22. $('#modal-section-edit').on('show.bs.modal', function (event) {
  23. var button = $(event.relatedTarget);
  24. var sectionID = button.data('section-id');
  25. $(this).find('#modal-section-edit-form').attr('action', `/section/${sectionID}`);
  26. });
  27. });
  28. function addSection (courseID, semCode) {
  29. var modal = $('#modal-section-create');
  30. modal.modal('toggle');
  31. modal.find('#modal-section-create-course_id').val(courseID);
  32. modal.find('#modal-section-create-semester_code').val(semCode);
  33. }