Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
bdab9019
Commit
bdab9019
authored
Aug 01, 2012
by
Brittany Cheng
Browse files
Options
Browse Files
Download
Plain Diff
trying to fix merge conflicts
parents
01623ddb
f204e988
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
85 additions
and
14 deletions
+85
-14
lms/djangoapps/courseware/module_render.py
+1
-1
lms/djangoapps/courseware/views.py
+3
-0
lms/djangoapps/django_comment_client/base/views.py
+6
-2
lms/djangoapps/django_comment_client/forum/views.py
+16
-8
lms/static/coffee/src/discussion.coffee
+12
-0
lms/static/sass/_discussion.scss
+6
-0
lms/templates/discussion/_accordion.html
+0
-0
lms/templates/discussion/_discussion_module.html
+0
-0
lms/templates/discussion/_forum.html
+1
-1
lms/templates/discussion/_inline.html
+25
-0
lms/templates/discussion/_search_bar.html
+0
-0
lms/templates/discussion/_single_thread.html
+1
-1
lms/templates/discussion/_thread.html
+12
-0
lms/templates/profile.html
+2
-1
No files found.
lms/djangoapps/courseware/module_render.py
View file @
bdab9019
...
@@ -184,7 +184,7 @@ def get_module(user, request, location, student_module_cache, position=None):
...
@@ -184,7 +184,7 @@ def get_module(user, request, location, student_module_cache, position=None):
)
)
if
settings
.
MITX_FEATURES
.
get
(
'DISPLAY_HISTOGRAMS_TO_STAFF'
)
and
user
.
is_staff
:
if
settings
.
MITX_FEATURES
.
get
(
'DISPLAY_HISTOGRAMS_TO_STAFF'
)
and
user
.
is_staff
:
module
.
get_html
=
add_histogram
(
module
.
get_html
)
module
.
get_html
=
add_histogram
(
module
.
get_html
,
module
)
# If StudentModule for this instance wasn't already in the database,
# If StudentModule for this instance wasn't already in the database,
# and this isn't a guest user, create it.
# and this isn't a guest user, create it.
...
...
lms/djangoapps/courseware/views.py
View file @
bdab9019
...
@@ -23,8 +23,11 @@ from django.views.decorators.cache import cache_control
...
@@ -23,8 +23,11 @@ from django.views.decorators.cache import cache_control
from
module_render
import
toc_for_course
,
get_module
,
get_section
from
module_render
import
toc_for_course
,
get_module
,
get_section
from
models
import
StudentModuleCache
from
models
import
StudentModuleCache
from
student.models
import
UserProfile
from
student.models
import
UserProfile
<<<<<<<
HEAD
from
multicourse
import
multicourse_settings
from
multicourse
import
multicourse_settings
=======
>>>>>>>
38
dd8f18984df3ab14f5715891af7f984c7f14a7
from
django_comment_client.utils
import
get_discussion_title
from
django_comment_client.utils
import
get_discussion_title
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
bdab9019
...
@@ -38,7 +38,12 @@ def comment_author_only(fn):
...
@@ -38,7 +38,12 @@ def comment_author_only(fn):
return
verified_fn
return
verified_fn
def
instructor_only
(
fn
):
#TODO add instructor verification
def
instructor_only
(
fn
):
#TODO add instructor verification
return
fn
def
verified_fn
(
request
,
*
args
,
**
kwargs
):
if
not
request
.
user
.
is_staff
:
return
JsonError
(
"unauthorized"
)
else
:
return
fn
(
request
,
*
args
,
**
kwargs
)
return
verified_fn
def
extract
(
dic
,
keys
):
def
extract
(
dic
,
keys
):
return
{
k
:
dic
[
k
]
for
k
in
keys
}
return
{
k
:
dic
[
k
]
for
k
in
keys
}
...
@@ -70,7 +75,6 @@ def create_comment(request, course_id, thread_id):
...
@@ -70,7 +75,6 @@ def create_comment(request, course_id, thread_id):
attributes
=
extract
(
request
.
POST
,
[
'body'
])
attributes
=
extract
(
request
.
POST
,
[
'body'
])
attributes
[
'user_id'
]
=
request
.
user
.
id
attributes
[
'user_id'
]
=
request
.
user
.
id
attributes
[
'course_id'
]
=
course_id
attributes
[
'course_id'
]
=
course_id
print
request
.
POST
if
request
.
POST
.
get
(
'anonymous'
,
'false'
)
.
lower
()
==
'true'
:
if
request
.
POST
.
get
(
'anonymous'
,
'false'
)
.
lower
()
==
'true'
:
attributes
[
'anonymous'
]
=
True
attributes
[
'anonymous'
]
=
True
if
request
.
POST
.
get
(
'autowatch'
,
'false'
)
.
lower
()
==
'true'
:
if
request
.
POST
.
get
(
'autowatch'
,
'false'
)
.
lower
()
==
'true'
:
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
bdab9019
...
@@ -27,9 +27,9 @@ def render_accordion(request, course, discussion_id):
...
@@ -27,9 +27,9 @@ def render_accordion(request, course, discussion_id):
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
}
}
return
render_to_string
(
'discussion/accordion.html'
,
context
)
return
render_to_string
(
'discussion/
_
accordion.html'
,
context
)
def
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
None
,
with_search_bar
=
True
,
search_text
=
''
):
def
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
None
,
with_search_bar
=
True
,
search_text
=
''
,
template
=
'discussion/_inline.html'
):
context
=
{
context
=
{
'threads'
:
threads
,
'threads'
:
threads
,
'discussion_id'
:
discussion_id
,
'discussion_id'
:
discussion_id
,
...
@@ -38,12 +38,19 @@ def render_discussion(request, course_id, threads, discussion_id=None, with_sear
...
@@ -38,12 +38,19 @@ def render_discussion(request, course_id, threads, discussion_id=None, with_sear
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
course_id
,
'course_id'
:
course_id
,
'request'
:
request
,
}
}
return
render_to_string
(
'discussion/inline.html'
,
context
)
return
render_to_string
(
template
,
context
)
def
render_inline_discussion
(
*
args
,
**
kwargs
):
return
render_discussion
(
template
=
'discussion/_inline.html'
,
*
args
,
**
kwargs
)
def
render_forum_discussion
(
*
args
,
**
kwargs
):
return
render_discussion
(
template
=
'discussion/_forum.html'
,
*
args
,
**
kwargs
)
def
inline_discussion
(
request
,
course_id
,
discussion_id
):
def
inline_discussion
(
request
,
course_id
,
discussion_id
):
threads
=
comment_client
.
get_threads
(
discussion_id
,
recursive
=
False
)
threads
=
comment_client
.
get_threads
(
discussion_id
,
recursive
=
False
)
html
=
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
)
html
=
render_
inline_
discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
)
return
HttpResponse
(
html
,
content_type
=
"text/plain"
)
return
HttpResponse
(
html
,
content_type
=
"text/plain"
)
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
...
@@ -54,7 +61,7 @@ def render_search_bar(request, course_id, discussion_id=None, text=''):
...
@@ -54,7 +61,7 @@ def render_search_bar(request, course_id, discussion_id=None, text=''):
'text'
:
text
,
'text'
:
text
,
'course_id'
:
course_id
,
'course_id'
:
course_id
,
}
}
return
render_to_string
(
'discussion/search_bar.html'
,
context
)
return
render_to_string
(
'discussion/
_
search_bar.html'
,
context
)
def
forum_form_discussion
(
request
,
course_id
,
discussion_id
):
def
forum_form_discussion
(
request
,
course_id
,
discussion_id
):
...
@@ -70,7 +77,7 @@ def forum_form_discussion(request, course_id, discussion_id):
...
@@ -70,7 +77,7 @@ def forum_form_discussion(request, course_id, discussion_id):
context
=
{
context
=
{
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'course'
:
course
,
'course'
:
course
,
'content'
:
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
,
search_text
=
search_text
),
'content'
:
render_
forum_
discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
,
search_text
=
search_text
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
}
}
...
@@ -97,8 +104,9 @@ def render_single_thread(request, course_id, thread_id):
...
@@ -97,8 +104,9 @@ def render_single_thread(request, course_id, thread_id):
'annotated_content_info'
:
json
.
dumps
(
get_annotated_content_info
(
thread
=
thread
,
user_id
=
request
.
user
.
id
)),
'annotated_content_info'
:
json
.
dumps
(
get_annotated_content_info
(
thread
=
thread
,
user_id
=
request
.
user
.
id
)),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
course_id
,
'course_id'
:
course_id
,
'request'
:
request
,
}
}
return
render_to_string
(
'discussion/single_thread.html'
,
context
)
return
render_to_string
(
'discussion/
_
single_thread.html'
,
context
)
def
single_thread
(
request
,
course_id
,
discussion_id
,
thread_id
):
def
single_thread
(
request
,
course_id
,
discussion_id
,
thread_id
):
...
@@ -131,7 +139,7 @@ def search(request, course_id):
...
@@ -131,7 +139,7 @@ def search(request, course_id):
context
=
{
context
=
{
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'init'
:
''
,
'content'
:
render_discussion
(
request
,
course_id
,
threads
,
search_text
=
text
),
'content'
:
render_
forum_
discussion
(
request
,
course_id
,
threads
,
search_text
=
text
),
'accordion'
:
''
,
'accordion'
:
''
,
'course'
:
course
,
'course'
:
course
,
}
}
...
...
lms/static/coffee/src/discussion.coffee
View file @
bdab9019
...
@@ -373,6 +373,15 @@ Discussion =
...
@@ -373,6 +373,15 @@ Discussion =
Discussion
.
handleAnchorAndReload
(
response
)
Discussion
.
handleAnchorAndReload
(
response
)
,
'json'
,
'json'
handleEndorse
=
(
elem
)
->
url
=
Discussion
.
urlFor
(
'endorse_comment'
,
id
)
endorsed
=
$local
(
".discussion-endorse"
).
is
(
":checked"
)
$
.
post
url
,
{
endorsed
:
endorsed
},
(
response
,
textStatus
)
->
# TODO error handling
Discussion
.
handleAnchorAndReload
(
response
)
,
'json'
$local
(
".discussion-reply"
).
click
->
$local
(
".discussion-reply"
).
click
->
handleReply
(
this
)
handleReply
(
this
)
...
@@ -385,6 +394,9 @@ Discussion =
...
@@ -385,6 +394,9 @@ Discussion =
$local
(
".discussion-vote-down"
).
click
->
$local
(
".discussion-vote-down"
).
click
->
handleVote
(
this
,
"down"
)
handleVote
(
this
,
"down"
)
$local
(
".discussion-endorse"
).
click
->
handleEndorse
(
this
)
$local
(
".discussion-edit"
).
click
->
$local
(
".discussion-edit"
).
click
->
if
$content
.
hasClass
(
"thread"
)
if
$content
.
hasClass
(
"thread"
)
handleEditThread
(
this
)
handleEditThread
(
this
)
...
...
lms/static/sass/_discussion.scss
View file @
bdab9019
...
@@ -267,6 +267,12 @@ $discussion_input_width: 90%;
...
@@ -267,6 +267,12 @@ $discussion_input_width: 90%;
display
:
block
;
display
:
block
;
color
:
black
;
color
:
black
;
}
}
&
.endorsed
{
>
.discussion-content
{
background-color
:
lightyellow
;
}
}
}
}
}
}
}
}
...
...
lms/templates/discussion/accordion.html
→
lms/templates/discussion/
_
accordion.html
View file @
bdab9019
File moved
lms/templates/discussion/_
show_discussion
.html
→
lms/templates/discussion/_
discussion_module
.html
View file @
bdab9019
File moved
lms/templates/discussion/
inline
.html
→
lms/templates/discussion/
_forum
.html
View file @
bdab9019
<
%
namespace
name=
"renderer"
file=
"thread.html"
/>
<
%
namespace
name=
"renderer"
file=
"
_
thread.html"
/>
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<div
class=
"discussion-non-content"
>
<div
class=
"discussion-non-content"
>
...
...
lms/templates/discussion/_inline.html
0 → 100644
View file @
bdab9019
<
%
namespace
name=
"renderer"
file=
"_thread.html"
/>
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<div
class=
"discussion-non-content"
>
<div
class=
"discussion-title-wrapper"
>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
</div>
${search_bar}
<div
class=
"discussion-new-post control-button"
href=
"javascript:void(0)"
>
New Post
</div>
</div>
% for thread in threads:
${renderer.render_thread(course_id, thread, edit_thread=False, show_comments=False)}
% endfor
</section>
<
%!
def
escape_quotes
(
text
)
:
return
text
.
replace
('\"',
'\\\"').
replace
("\'",
"\\\'")
%
>
<script
type=
"text/javascript"
>
var
$$user_info
=
JSON
.
parse
(
'${user_info | escape_quotes}'
);
var
$$course_id
=
"${course_id}"
;
var
$$tags
=
JSON
.
parse
(
"${tags | escape_quotes}"
);
</script>
lms/templates/discussion/search_bar.html
→
lms/templates/discussion/
_
search_bar.html
View file @
bdab9019
File moved
lms/templates/discussion/single_thread.html
→
lms/templates/discussion/
_
single_thread.html
View file @
bdab9019
<
%
namespace
name=
"renderer"
file=
"thread.html"
/>
<
%
namespace
name=
"renderer"
file=
"
_
thread.html"
/>
<section
class=
"discussion"
>
<section
class=
"discussion"
>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
...
...
lms/templates/discussion/thread.html
→
lms/templates/discussion/
_
thread.html
View file @
bdab9019
...
@@ -15,7 +15,11 @@
...
@@ -15,7 +15,11 @@
<
%
def
name=
"render_comments(comments)"
>
<
%
def
name=
"render_comments(comments)"
>
<div
class=
"comments"
>
<div
class=
"comments"
>
% for comment in comments:
% for comment in comments:
% if comment['endorsed']:
<div
class=
"comment endorsed"
_id=
"${comment['id']}"
>
% else:
<div
class=
"comment"
_id=
"${comment['id']}"
>
<div
class=
"comment"
_id=
"${comment['id']}"
>
% endif
${render_content(comment, "comment")}
${render_content(comment, "comment")}
<div
class=
"comments"
>
<div
class=
"comments"
>
${render_comments(comment['children'])}
${render_comments(comment['children'])}
...
@@ -76,6 +80,14 @@
...
@@ -76,6 +80,14 @@
% if type == "thread" and kwargs['edit_thread'] or type == "comment":
% if type == "thread" and kwargs['edit_thread'] or type == "comment":
${render_link("discussion-link discussion-reply", "Reply")}
${render_link("discussion-link discussion-reply", "Reply")}
${render_link("discussion-link discussion-edit", "Edit")}
${render_link("discussion-link discussion-edit", "Edit")}
% if type == "comment" and request.user.is_staff:
% if content['endorsed']:
<input
type=
"checkbox"
checked=
"checked"
class=
"discussion-link discussion-endorse"
id=
"discussion-endorse-${content['id']}"
>
% else:
<input
type=
"checkbox"
class=
"discussion-link discussion-endorse"
id=
"discussion-endorse-${content['id']}"
>
% endif
<label
class=
"discussion-link"
for=
"discussion-endorse-${content['id']}"
>
Endorsed
</label>
% endif
% endif
% endif
</div>
</div>
</
%
def>
</
%
def>
...
...
lms/templates/profile.html
View file @
bdab9019
...
@@ -137,8 +137,9 @@ $(function() {
...
@@ -137,8 +137,9 @@ $(function() {
total =
section['section_total'].possible
total =
section['section_total'].possible
percentageString =
"{0:.0%}"
.
format
(
float
(
earned
)/
total
)
if
earned
>
0 and total > 0 else ""
percentageString =
"{0:.0%}"
.
format
(
float
(
earned
)/
total
)
if
earned
>
0 and total > 0 else ""
%>
%>
<h3><a
href=
"${reverse('courseware_section', kwargs={'course_id' : course.id, 'chapter' : chapter['chapter'], 'section' : section['section']})}"
>
<h3><a
href=
"${reverse('courseware_section', kwargs={'course_id' : course.id, 'chapter' : chapter['chapter'], 'section' : section['section']})}"
>
>>>>>>> 7f2f47597fd50acbab49be5173b76b026ff4378d
${ section['section'] }
</a>
${"({0:.3n}/{1:.3n}) {2}".format( float(earned), float(total), percentageString )}
</h3>
${ section['section'] }
</a>
${"({0:.3n}/{1:.3n}) {2}".format( float(earned), float(total), percentageString )}
</h3>
${section['format']}
${section['format']}
%if 'due' in section and section['due']!="":
%if 'due' in section and section['due']!="":
...
...
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