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
7784a29e
Commit
7784a29e
authored
Mar 26, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add simple notes view
parent
d636f4fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
16 deletions
+54
-16
lms/djangoapps/notes/views.py
+3
-13
lms/djangoapps/staticbook/views.py
+0
-2
lms/templates/notes.html
+51
-1
No files found.
lms/djangoapps/notes/views.py
View file @
7784a29e
...
...
@@ -7,21 +7,11 @@ import logging
log
=
logging
.
getLogger
(
__name__
)
def
notes
(
request
,
course_id
):
''' Displays a student's notes in a course.
$('body').annotator()
.annotator('addPlugin', 'Tags')
.annotator('addPlugin', 'Store', {
'prefix': /^(
\
/courses
\
/[^/]+
\
/[^/]+
\
/[^/]+)/.exec(window.location.href.toString().split(window.location.host)[1]
'annotationData': {
'uri': window.location.href.toString().split(window.location.host)[1]
}
});
'''
''' Displays a student's notes in a course. '''
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
notes
=
Note
.
objects
.
filter
(
user_id
=
request
.
user
.
id
)
notes
=
Note
.
objects
.
filter
(
course_id
=
course_id
,
user
=
request
.
user
)
.
order_by
(
'-created'
,
'uri'
)
prettyprint
=
{
'sort_keys'
:
True
,
'indent'
:
2
,
'separators'
:(
','
,
': '
)}
json_notes
=
json
.
dumps
([
n
.
as_dict
()
for
n
in
notes
],
**
prettyprint
)
...
...
lms/djangoapps/staticbook/views.py
View file @
7784a29e
...
...
@@ -28,7 +28,6 @@ def index(request, course_id, book_index, page=None):
{
'book_index'
:
book_index
,
'page'
:
int
(
page
),
'course'
:
course
,
'book_url'
:
textbook
.
book_url
,
'notes_api_url'
:
reverse
(
'notes_api_root'
,
{
'course_id'
:
course_id
}),
'table_of_contents'
:
table_of_contents
,
'start_page'
:
textbook
.
start_page
,
'end_page'
:
textbook
.
end_page
,
...
...
@@ -105,7 +104,6 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None):
return
render_to_response
(
'static_htmlbook.html'
,
{
'book_index'
:
book_index
,
'course'
:
course
,
'notes_api_url'
:
reverse
(
'notes_api_root'
,
kwargs
=
{
'course_id'
:
course_id
}),
'textbook'
:
textbook
,
'chapter'
:
chapter
,
'anchor_id'
:
anchor_id
,
...
...
lms/templates/notes.html
View file @
7784a29e
...
...
@@ -4,6 +4,43 @@
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
static:js
group=
'courseware'
/>
<style
type=
"text/css"
>
blockquote
{
background
:
#f9f9f9
;
border-left
:
10px
solid
#ccc
;
margin
:
1.5em
10px
;
padding
:
.5em
10px
;
}
blockquote
:before
{
color
:
#ccc
;
content
:
'“'
;
font-size
:
4em
;
line-height
:
.1em
;
margin-right
:
.25em
;
vertical-align
:
-.4em
;
}
blockquote
p
{
display
:
inline
;
}
.notes-wrapper
{
padding
:
32px
40px
;
}
.note
{
border-bottom
:
1px
solid
#ccc
;
padding
:
0
0
1em
0
;
}
.note
.text
{
margin-bottom
:
1em
;
}
.note
ul
.meta
{
margin
:
.5em
0
;
}
.note
ul
.meta
li
{
font-size
:
.9em
;
margin-bottom
:
.5em
;
}
</style>
</
%
block>
<
%
block
name=
"js_extra"
>
...
...
@@ -16,7 +53,20 @@
<section
class=
"container"
>
<div
class=
"notes-wrapper"
>
<h2>
My Notes
</h2>
<pre>
${json_notes}
</pre>
% for note in notes:
<div
class=
"note"
>
<blockquote>
${note.quote}
</blockquote>
<div
class=
"text"
>
${note.text.replace("\n", "
<br
/>
") | n}
</div>
<ul
class=
"meta"
>
% if note.tags:
<li
class=
"tags"
>
Tags: ${note.tags|h}
</li>
% endif
<li
class=
"user"
>
Author: ${note.user.username}
</li>
<li
class=
"time"
>
Created: ${note.created.strftime('%m/%d/%Y %H:%m')}
</li>
<li
class=
"uri"
>
Source:
<a
href=
"${note.uri}"
>
${note.uri}
</a></li>
</ul>
</div>
% endfor
</div>
</section>
...
...
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