mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-60046 user: Apply user filters immediately.
This commit is contained in:
parent
b3cfb01316
commit
e39df1faeb
2
user/amd/build/unified_filter.min.js
vendored
2
user/amd/build/unified_filter.min.js
vendored
@ -1 +1 @@
|
||||
define(["jquery","core/form-autocomplete","core/str","core/notification"],function(a,b,c,d){var e={UNIFIED_FILTERS:"#unified-filters"},f=function(){var a=[{key:"userfilterplaceholder",component:"moodle"},{key:"nofiltersapplied",component:"moodle"}];c.get_strings(a).done(function(a){var c=a[0],d=a[1];b.enhance(e.UNIFIED_FILTERS,!0,"core_user/unified_filter_datasource",c,!1,!0,d,!0)}).fail(d.exception)};return{init:function(){f()}}});
|
||||
define(["jquery","core/form-autocomplete","core/str","core/notification"],function(a,b,c,d){var e={UNIFIED_FILTERS:"#unified-filters"},f=function(){var f=[{key:"userfilterplaceholder",component:"moodle"},{key:"nofiltersapplied",component:"moodle"}];c.get_strings(f).done(function(a){var c=a[0],d=a[1];b.enhance(e.UNIFIED_FILTERS,!0,"core_user/unified_filter_datasource",c,!1,!0,d,!0)}).fail(d.exception);var g=a(e.UNIFIED_FILTERS).val();a(e.UNIFIED_FILTERS).on("change",function(){var b=a(this).val();g.join(",")!=b.join(",")&&this.form.submit(),g=b})};return{init:function(){f()}}});
|
@ -51,12 +51,23 @@ define(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'],
|
||||
component: 'moodle'
|
||||
}
|
||||
];
|
||||
|
||||
Str.get_strings(stringkeys).done(function(langstrings) {
|
||||
var placeholder = langstrings[0];
|
||||
var noSelectionString = langstrings[1];
|
||||
Autocomplete.enhance(SELECTORS.UNIFIED_FILTERS, true, 'core_user/unified_filter_datasource', placeholder,
|
||||
false, true, noSelectionString, true);
|
||||
}).fail(Notification.exception);
|
||||
|
||||
var last = $(SELECTORS.UNIFIED_FILTERS).val();
|
||||
$(SELECTORS.UNIFIED_FILTERS).on('change', function() {
|
||||
var current = $(this).val();
|
||||
|
||||
if (last.join(',') != current.join(',')) {
|
||||
this.form.submit();
|
||||
}
|
||||
last = current;
|
||||
});
|
||||
};
|
||||
|
||||
return /** @alias module:core/form-autocomplete */ {
|
||||
|
@ -58,7 +58,6 @@
|
||||
<option value="{{value}}" {{#selected}}selected="selected"{{/selected}}>{{{label}}}</option>
|
||||
{{/filteroptions}}
|
||||
</select>
|
||||
<input type="submit" class="btn btn-primary" id="user-filter-button" value={{#quote}}{{#str}}filter{{/str}}{{/quote}}>
|
||||
</form>
|
||||
{{#js}}
|
||||
require(['core_user/unified_filter'], function(Filter) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user