aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'resources/assets/javascripts')
-rw-r--r--resources/assets/javascripts/bootstrap/dialog.js15
-rw-r--r--resources/assets/javascripts/bootstrap/oer.js92
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 }
- });
- });
- }
-});