diff --git a/lms/djangoapps/notes/views.py b/lms/djangoapps/notes/views.py index f9a7cc2c17..7d6390baed 100644 --- a/lms/djangoapps/notes/views.py +++ b/lms/djangoapps/notes/views.py @@ -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) diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 1784216d27..9febddc55c 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -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, diff --git a/lms/templates/notes.html b/lms/templates/notes.html index b053698242..efe56cdd8a 100644 --- a/lms/templates/notes.html +++ b/lms/templates/notes.html @@ -4,6 +4,43 @@ <%block name="headextra"> <%static:css group='course'/> <%static:js group='courseware'/> + + <%block name="js_extra"> @@ -16,7 +53,20 @@

My Notes

-
${json_notes}
+ % for note in notes: +
+
${note.quote}
+
${note.text.replace("\n", "
") | n}
+
    + % if note.tags: +
  • Tags: ${note.tags|h}
  • + % endif +
  • Author: ${note.user.username}
  • +
  • Created: ${note.created.strftime('%m/%d/%Y %H:%m')}
  • +
  • Source: ${note.uri}
  • +
+
+ % endfor