Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
735a635a
Commit
735a635a
authored
Feb 27, 2017
by
tasawernawaz
Committed by
Tasawer Nawaz
Feb 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Javascript updated for instructor autocomplete
ECOM-7186
parent
b6188232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
course_discovery/static/js/publisher/publisher.js
+30
-0
No files found.
course_discovery/static/js/publisher/publisher.js
View file @
735a635a
...
...
@@ -94,6 +94,7 @@ $(document).ready(function(){
$
(
'#blog'
).
val
(
''
);
clearModalError
();
closeModal
(
e
,
$
(
'#addInstructorModal'
));
loadInstructor
(
response
[
'uuid'
])
},
error
:
function
(
response
)
{
addModalError
(
gettext
(
"Something went wrong!"
));
...
...
@@ -369,3 +370,32 @@ $(document).on('click', '.btn-edit-preview-url', function (e) {
$
(
'.btn-preview-decline'
).
click
(
function
(
e
){
$
(
'#decline-comment'
).
toggle
();
});
function
loadInstructor
(
uuid
)
{
var
url
=
$
(
'#id_staff'
).
attr
(
'data-autocomplete-light-url'
)
+
'?q='
+
uuid
,
instructor
,
id
,
label
,
image_source
,
name
;
$
.
getJSON
({
url
:
url
,
success
:
function
(
data
)
{
if
(
data
[
'results'
].
length
)
{
// with uuid there will be only one instructor
instructor
=
data
[
'results'
][
0
];
id
=
instructor
.
id
;
label
=
$
.
parseHTML
(
instructor
.
text
);
image_source
=
$
(
label
).
find
(
'img'
).
attr
(
'src'
);
name
=
$
(
label
).
find
(
'b'
).
text
();
$
(
'#id_staff'
).
append
(
$
(
"<option/>"
,
{
value
:
id
,
text
:
name
}).
attr
(
'selected'
,
'selected'
));
renderSelectedInstructor
(
id
,
name
,
image_source
);
}
}
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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