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
42b3ed3c
Commit
42b3ed3c
authored
Oct 11, 2017
by
attiyaishaque
Committed by
Attiya Ishaque
Oct 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix instructor bio editing capability for all internal users.
parent
295fa22d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
11 deletions
+23
-11
course_discovery/apps/course_metadata/lookups.py
+2
-1
course_discovery/apps/publisher/forms.py
+1
-0
course_discovery/apps/publisher/templates/publisher/_personFieldLabel.html
+1
-1
course_discovery/apps/publisher/templates/publisher/_personLookup.html
+1
-1
course_discovery/static/js/publisher/instructors.js
+18
-8
No files found.
course_discovery/apps/course_metadata/lookups.py
View file @
42b3ed3c
...
@@ -72,7 +72,8 @@ class PersonAutocomplete(LoginRequiredMixin, autocomplete.Select2QuerySetView):
...
@@ -72,7 +72,8 @@ class PersonAutocomplete(LoginRequiredMixin, autocomplete.Select2QuerySetView):
'profile_image'
:
result
.
get_profile_image_url
,
'profile_image'
:
result
.
get_profile_image_url
,
'full_name'
:
result
.
full_name
,
'full_name'
:
result
.
full_name
,
'position'
:
result
.
position
if
hasattr
(
result
,
'position'
)
else
None
,
'position'
:
result
.
position
if
hasattr
(
result
,
'position'
)
else
None
,
'organization_id'
:
result
.
position
.
organization_id
if
hasattr
(
result
,
'position'
)
else
None
'organization_id'
:
result
.
position
.
organization_id
if
hasattr
(
result
,
'position'
)
else
None
,
'can_edit_instructor'
:
not
result
.
profile_image_url
,
}
}
...
...
course_discovery/apps/publisher/forms.py
View file @
42b3ed3c
...
@@ -29,6 +29,7 @@ class PersonModelMultipleChoice(forms.ModelMultipleChoiceField):
...
@@ -29,6 +29,7 @@ class PersonModelMultipleChoice(forms.ModelMultipleChoiceField):
context
=
{
context
=
{
'profile_image'
:
obj
.
get_profile_image_url
,
'profile_image'
:
obj
.
get_profile_image_url
,
'full_name'
:
obj
.
full_name
,
'full_name'
:
obj
.
full_name
,
'can_edit_instructor'
:
not
obj
.
profile_image_url
,
'uuid'
:
obj
.
uuid
,
'uuid'
:
obj
.
uuid
,
'organization_id'
:
obj
.
position
.
organization_id
if
hasattr
(
obj
,
'position'
)
else
None
'organization_id'
:
obj
.
position
.
organization_id
if
hasattr
(
obj
,
'position'
)
else
None
}
}
...
...
course_discovery/apps/publisher/templates/publisher/_personFieldLabel.html
View file @
42b3ed3c
<img
src=
"{{ profile_image }}"
/><span
{%
if
uuid
%}
data-uuid=
"{{ uuid }}"
{%
endif
%}
>
{{ full_name }}
</span>
{% if organization_id %}
<span>
{{ organization_id }}
</span>
{% endif %}
<img
src=
"{{ profile_image }}"
/><span
{%
if
can_edit_instructor
%}
data-can-edit=
"{{ can_edit_instructor }}"
{%
endif
%}
data-uuid=
"{{ uuid }}"
>
{{ full_name }}
</span>
{% if organization_id %}
<span>
{{ organization_id }}
</span>
{% endif %}
course_discovery/apps/publisher/templates/publisher/_personLookup.html
View file @
42b3ed3c
<table
class=
"instructor-option"
id=
"{{ uuid }}"
>
<table
class=
"instructor-option"
id=
"{{ uuid }}"
{%
if
can_edit_instructor
%}
data-can-edit=
"{{ can_edit_instructor }}"
{%
endif
%}
>
<tr>
<tr>
<td><img
src=
"{{ profile_image }}"
alt=
"profile image"
/></td>
<td><img
src=
"{{ profile_image }}"
alt=
"profile image"
/></td>
<td>
<td>
...
...
course_discovery/static/js/publisher/instructors.js
View file @
42b3ed3c
...
@@ -6,8 +6,9 @@ $(document).ready(function(){
...
@@ -6,8 +6,9 @@ $(document).ready(function(){
image_source
=
$
(
label
[
0
]).
attr
(
'src'
),
image_source
=
$
(
label
[
0
]).
attr
(
'src'
),
name
=
$
(
label
[
1
]).
text
(),
name
=
$
(
label
[
1
]).
text
(),
uuid
=
$
(
label
[
1
]).
data
(
'uuid'
),
uuid
=
$
(
label
[
1
]).
data
(
'uuid'
),
organization_id
=
$
(
label
[
2
]).
text
();
organization_id
=
$
(
label
[
2
]).
text
(),
renderSelectedInstructor
(
id
,
name
,
image_source
,
uuid
,
organization_id
);
edit_instructor
=
$
(
label
[
1
]).
data
(
'can-edit'
);
renderSelectedInstructor
(
id
,
name
,
image_source
,
uuid
,
organization_id
,
edit_instructor
);
});
});
$
(
"#id_staff"
).
on
(
"select2:select"
,
function
(
e
)
{
$
(
"#id_staff"
).
on
(
"select2:select"
,
function
(
e
)
{
...
@@ -17,8 +18,9 @@ $(document).ready(function(){
...
@@ -17,8 +18,9 @@ $(document).ready(function(){
image_source
=
$
(
selectedInstructorData
).
find
(
'img'
).
attr
(
'src'
),
image_source
=
$
(
selectedInstructorData
).
find
(
'img'
).
attr
(
'src'
),
name
=
$
(
selectedInstructorData
).
find
(
'b'
).
text
(),
name
=
$
(
selectedInstructorData
).
find
(
'b'
).
text
(),
uuid
=
$
(
selectedInstructorData
)[
0
].
id
,
uuid
=
$
(
selectedInstructorData
)[
0
].
id
,
organization_id
=
$
(
selectedInstructorData
).
find
(
'span'
).
text
();
organization_id
=
$
(
selectedInstructorData
).
find
(
'span'
).
text
(),
renderSelectedInstructor
(
id
,
name
,
image_source
,
uuid
,
organization_id
);
edit_instructor
=
$
(
selectedInstructorData
).
data
(
'can-edit'
);
renderSelectedInstructor
(
id
,
name
,
image_source
,
uuid
,
organization_id
,
edit_instructor
);
});
});
...
@@ -139,7 +141,7 @@ $(document).on('click', '.selected-instructor a.delete', function (e) {
...
@@ -139,7 +141,7 @@ $(document).on('click', '.selected-instructor a.delete', function (e) {
$
(
'.instructor-select'
).
find
(
'.select2-selection__choice'
).
remove
();
$
(
'.instructor-select'
).
find
(
'.select2-selection__choice'
).
remove
();
});
});
function
renderSelectedInstructor
(
id
,
name
,
image
,
uuid
,
organization_id
)
{
function
renderSelectedInstructor
(
id
,
name
,
image
,
uuid
,
organization_id
,
edit_instructor
)
{
var
user_organizations_ids
=
$
(
'#user_organizations_ids'
).
text
(),
var
user_organizations_ids
=
$
(
'#user_organizations_ids'
).
text
(),
course_user_role
=
$
(
'#course_user_role'
).
text
(),
course_user_role
=
$
(
'#course_user_role'
).
text
(),
instructorHtmlStart
=
'<div class="instructor" id= "instructor_'
+
id
+
'"><div><img src="'
+
image
+
'"></div><div>'
,
instructorHtmlStart
=
'<div class="instructor" id= "instructor_'
+
id
+
'"><div><img src="'
+
image
+
'"></div><div>'
,
...
@@ -152,6 +154,11 @@ function renderSelectedInstructor(id, name, image, uuid, organization_id) {
...
@@ -152,6 +154,11 @@ function renderSelectedInstructor(id, name, image, uuid, organization_id) {
controlOptions
+=
'<a class="edit" id="'
+
uuid
+
'"href="#"><i class="fa fa-pencil-square-o fa-fw"></i></a>'
;
controlOptions
+=
'<a class="edit" id="'
+
uuid
+
'"href="#"><i class="fa fa-pencil-square-o fa-fw"></i></a>'
;
}
}
}
}
else
{
if
(
edit_instructor
){
controlOptions
+=
'<a class="edit" id="'
+
uuid
+
'"href="#"><i class="fa fa-pencil-square-o fa-fw"></i></a>'
;
}
}
$
(
'.selected-instructor'
).
append
(
instructorHtmlStart
+
controlOptions
+
instructorHtmlEnd
);
$
(
'.selected-instructor'
).
append
(
instructorHtmlStart
+
controlOptions
+
instructorHtmlEnd
);
}
}
...
@@ -182,7 +189,9 @@ function loadInstructor(uuid, editMode) {
...
@@ -182,7 +189,9 @@ function loadInstructor(uuid, editMode) {
label
,
label
,
image_source
,
image_source
,
name
,
name
,
instructor_id
;
instructor_id
,
organization_id
,
edit_instructor
;
$
.
getJSON
({
$
.
getJSON
({
url
:
url
,
url
:
url
,
...
@@ -198,7 +207,8 @@ function loadInstructor(uuid, editMode) {
...
@@ -198,7 +207,8 @@ function loadInstructor(uuid, editMode) {
value
:
id
,
value
:
id
,
text
:
name
text
:
name
}).
attr
(
'selected'
,
'selected'
));
}).
attr
(
'selected'
,
'selected'
));
organization_id
=
$
(
label
).
find
(
'span'
).
text
()
organization_id
=
$
(
label
).
find
(
'span'
).
text
();
edit_instructor
=
$
(
label
).
data
(
'can-edit'
);
if
(
editMode
)
{
if
(
editMode
)
{
// Updating the existing instructor
// Updating the existing instructor
...
@@ -207,7 +217,7 @@ function loadInstructor(uuid, editMode) {
...
@@ -207,7 +217,7 @@ function loadInstructor(uuid, editMode) {
instructor_id
.
find
(
'b'
).
text
(
name
);
instructor_id
.
find
(
'b'
).
text
(
name
);
}
}
else
{
else
{
renderSelectedInstructor
(
id
,
name
,
image_source
,
uuid
,
organization_id
);
renderSelectedInstructor
(
id
,
name
,
image_source
,
uuid
,
organization_id
,
edit_instructor
);
}
}
}
}
...
...
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