diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-07-08 15:50:03 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-07-08 16:24:10 +0200 |
| commit | 58ec440501ee821931706fd12dbd9331b0eaca50 (patch) | |
| tree | 26fbd06d9f3775b16a5f01b549b22a97a454258c /resources/assets/javascripts/bootstrap | |
| parent | 471197f7abc27b0fdc65e453587a74906922f9d5 (diff) | |
convert oersearch to sfc, re #4302tic-4302
Diffstat (limited to 'resources/assets/javascripts/bootstrap')
| -rw-r--r-- | resources/assets/javascripts/bootstrap/dialog.js | 15 | ||||
| -rw-r--r-- | resources/assets/javascripts/bootstrap/oer.js | 92 |
2 files changed, 11 insertions, 96 deletions
diff --git a/resources/assets/javascripts/bootstrap/dialog.js b/resources/assets/javascripts/bootstrap/dialog.js index 58d01fd..58857cb 100644 --- a/resources/assets/javascripts/bootstrap/dialog.js +++ b/resources/assets/javascripts/bootstrap/dialog.js @@ -2,7 +2,14 @@ STUDIP.domReady(function () { STUDIP.Dialog.initialize(); }); -$(document).on('click', '[data-vue-app] [data-dialog-button] .cancel.button', () => { - STUDIP.Dialog.close(); - return false; -}); +document.addEventListener( + 'click', + (event) => { + if (event.target.matches('.studip-dialog [data-vue-app] [data-dialog-button] .cancel.button')) { + STUDIP.Dialog.close(); + event.preventDefault(); + event.stopPropagation(); + } + }, + true +); diff --git a/resources/assets/javascripts/bootstrap/oer.js b/resources/assets/javascripts/bootstrap/oer.js index 3adecbc..ed472b5 100644 --- a/resources/assets/javascripts/bootstrap/oer.js +++ b/resources/assets/javascripts/bootstrap/oer.js @@ -47,95 +47,3 @@ STUDIP.domReady(() => { }); }); - -STUDIP.ready(() => { - if ($('.oercampus_editmaterial').length) { - - STUDIP.Vue.load().then(({createApp}) => { - STUDIP.OER.EditApp = createApp({ - el: '.oercampus_editmaterial', - data() { - return { - name: $('.oercampus_editmaterial input.oername').val(), - logo_url: $('.oercampus_editmaterial .logo_file').data("oldurl"), - customlogo: $('.oercampus_editmaterial .logo_file').data("customlogo"), - filename: $('.oercampus_editmaterial .file.drag-and-drop').data("filename"), - filesize: $('.oercampus_editmaterial .file.drag-and-drop').data("filesize"), - tags: $('.oercampus_editmaterial .oer_tags').data("defaulttags"), - minimumTags: 5 - }; - }, - mounted: function () { - jQuery("#difficulty_slider_edit").slider({ - range: true, - min: 1, - max: 12, - values: [jQuery("#difficulty_start").val(), jQuery("#difficulty_end").val()], - change: function (event, ui) { - jQuery("#difficulty_start").val(ui.values[0]); - jQuery("#difficulty_end").val(ui.values[1]); - } - }); - jQuery('.oercampus_editmaterial').find(':focusable').first().focus(); - }, - methods: { - editName: function () { - this.name = $('.oername').val(); - }, - editImage: function (event) { - let reader = new FileReader(); - let vue = this; - reader.addEventListener("load", function () { - vue.logo_url = reader.result; - vue.customlogo = true; - }, false); - reader.readAsDataURL( - event.target.files.length > 0 - ? event.target.files[0] - : event.dataTransfer.files[0] - ); - }, - dropImage: function (event) { - window.document.getElementById("oer_logo_uploader").files = event.dataTransfer.files; - this.editImage(event); - }, - editFile: function (event) { - this.filename = event.target.files[0].name; - this.filesize = event.target.files[0].size; - if (!this.name) { - this.name = this.filename; - $('.oername').val(this.name); - } - }, - dropFile: function (event) { - window.document.getElementById("oer_file").files = event.dataTransfer.files; - this.editFile(event); - }, - addTag: function () { - if (this.minimumTags < this.tags.length) { - this.minimumTags = this.tags.length + 1; - } else { - this.minimumTags++; - } - }, - removeTag: function (i) { - this.$delete(this.tags, i); - if ((this.minimumTags > this.tags.length) && (this.minimumTags > 5)) { - this.minimumTags--; - } - } - }, - computed: { - displayTags () { - const result = this.tags.concat([]); - while (result.length < this.minimumTags) { - result.push(''); - } - return result; - } - }, - components: { Quicksearch } - }); - }); - } -}); |
