Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plugins bot
moodle-plugins-snapshots
Commits
36102596
Commit
36102596
authored
Jan 18, 2017
by
Eloy Lafuente
Browse files
Merge branch 'MDL-57604-master' of
git://github.com/danpoltawski/moodle
parents
2156bb45
76bab368
Changes
2
Hide whitespace changes
Inline
Side-by-side
mod/assign/amd/build/participant_selector.min.js
View file @
36102596
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
mod/assign/amd/src/participant_selector.js
View file @
36102596
...
...
@@ -35,12 +35,7 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
* @return {Array}
*/
processResults
:
function
(
selector
,
data
)
{
var
results
=
[];
var
i
=
0
;
for
(
i
=
0
;
i
<
data
.
length
;
i
++
)
{
results
[
i
]
=
{
value
:
data
[
i
].
id
,
label
:
data
[
i
].
label
};
}
return
results
;
return
data
;
},
/**
...
...
@@ -62,12 +57,10 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
filterstrings
[
$
(
element
).
attr
(
'
name
'
)]
=
$
(
element
).
prop
(
'
checked
'
);
});
var
promise
=
ajax
.
call
([{
ajax
.
call
([{
methodname
:
'
mod_assign_list_participants
'
,
args
:
{
assignid
:
assignmentid
,
groupid
:
groupid
,
filter
:
query
,
limit
:
30
,
includeenrolments
:
false
}
}]);
promise
[
0
].
then
(
function
(
results
)
{
}])[
0
].
then
(
function
(
results
)
{
var
promises
=
[];
var
identityfields
=
$
(
'
[data-showuseridentity]
'
).
data
(
'
showuseridentity
'
).
split
(
'
,
'
);
...
...
@@ -94,23 +87,18 @@ define(['core/ajax', 'jquery', 'core/templates'], function(ajax, $, templates) {
}
});
ctx
.
identity
=
identity
.
join
(
'
,
'
);
promises
.
push
(
templates
.
render
(
'
mod_assign/list_participant_user_summary
'
,
ctx
));
promises
.
push
(
templates
.
render
(
'
mod_assign/list_participant_user_summary
'
,
ctx
).
then
(
function
(
html
)
{
return
{
value
:
user
.
id
,
label
:
html
};
}));
}
});
// When all the templates have been rendered, call the success handler.
$
.
when
.
apply
(
$
.
when
,
promises
).
then
(
function
()
{
var
args
=
arguments
,
i
=
0
;
$
.
each
(
results
,
function
(
index
,
user
)
{
user
.
label
=
args
[
i
];
i
++
;
});
success
(
results
);
});
},
failure
);
// Do the dance for $.when()
return
$
.
when
.
apply
(
$
,
promises
);
}).
then
(
function
()
{
// Undo the $.when() dance from arguments object into an array..
var
users
=
Array
.
prototype
.
slice
.
call
(
arguments
);
success
(
users
);
}).
catch
(
failure
);
}
};
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment