Skip to content

Commit

Permalink
Merge pull request #94 from bdecentgmbh/dev
Browse files Browse the repository at this point in the history
Merge dev to main for 1.8 release
  • Loading branch information
stefanscholz authored Jan 17, 2024
2 parents 95f57e3 + 5c6acfc commit b57c74e
Show file tree
Hide file tree
Showing 44 changed files with 1,375 additions and 107 deletions.
2 changes: 1 addition & 1 deletion amd/build/dash_instance.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/dash_instance.min.js.map

Large diffs are not rendered by default.

57 changes: 47 additions & 10 deletions amd/src/dash_instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,54 @@ define(['jquery', 'jqueryui', 'core/log', 'core/ajax', 'core/notification', 'cor
DashInstance.prototype.FILTER_FORM_SELECTOR = '.filter-form';

DashInstance.prototype.init = function() {

Log.debug('Initializing dash instance', this);

// Select datasource for configuration.
if (this.getRoot().find('.dash-configuration-form').length > 0) {

this.getRoot().find('.dash-configuration-form').removeClass('hide');
this.getRoot()
.find('[data-target="subsource-config"] [type=radio], [name="config_data_source_idnumber"]')
.addClass('norefresh');

// Hide the preference link for others.
this.getRoot().find('.dash-edit-preferences').hide();

// Select the parent datasource for the sub config.
this.getRoot().on('change', '[data-target="subsource-config"] [type=radio]', function(e) {
var subConfig;
if (subConfig = e.target.closest('[data-target="subsource-config"]')) {
if (subConfig.parentNode !== null) {
var dataSource = subConfig.parentNode.querySelector('[name="config_data_source_idnumber"]');
dataSource.click(); // = true;
}
}
}.bind(this));

this.getRoot().find('.dash-configuration-form [name="config_data_source_idnumber"]').on('change', function(e) {
console.log(e);
console.log("TEST");
var dataSource = this.getRoot().find('.dash-configuration-form');
var formData = $(dataSource).find('form').serialize();

// Now we can continue...
Ajax.call([{
methodname: 'block_dash_submit_preferences_form',
args: {
contextid: this.blockContextid,
jsonformdata: JSON.stringify(formData)
},
done: function() {
// Hide the preference link for others.
this.getRoot().find('.dash-edit-preferences').show();
this.refresh();
}.bind(this),
}])[0].fail(Notification.exception);
}.bind(this));

}

this.initDatePickers();
this.initSelect2();

Expand All @@ -33,7 +79,7 @@ define(['jquery', 'jqueryui', 'core/log', 'core/ajax', 'core/notification', 'cor
this.refresh();
}.bind(this));
}
this.getRoot().on('change', 'select:not(.norefresh), input:not(.select2-search__field)',
this.getRoot().on('change', 'select:not(.norefresh), input:not(.select2-search__field, .norefresh)',
function(e) {
e.preventDefault();

Expand Down Expand Up @@ -80,15 +126,6 @@ define(['jquery', 'jqueryui', 'core/log', 'core/ajax', 'core/notification', 'cor
// Append the form to the body and submit it
form.appendTo('body').submit();

/* $.ajax({
url: 'http://localhost/moodle/moodle-40/blocks/dash/download.php',
type: 'POST',
data: args,
success: function(data) {
//window.location = 'http://localhost/moodle/moodle-40/blocks/dash/download.php';
console.log(data);
}
}); */
}.bind(this));

// Adding support for tab filters.
Expand Down
Loading

0 comments on commit b57c74e

Please sign in to comment.