From 444d4b1054e93b0309ef8b93b32e9fc211ec2206 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sat, 13 Oct 2012 22:19:48 -0400 Subject: [PATCH 01/11] fix exception in LMS when rendering newly create multiple choice problems. The capa module is barfing on the HTML comment which was in there and the XML parser couldn't handle it. --- .../lib/xmodule/xmodule/templates/problem/multiplechoice.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml index cc2502a855..1ae05e04b3 100644 --- a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml @@ -8,7 +8,7 @@ data: |

A multiple choice response problem presents radio buttons for student - input. One or more of the choice may be correct.--> Correctness of + input. Correctness of input is evaluated based on expected answers specified within each "choice" stanza.

From 8f1336d87a28f9bf8a3bd698cdcc187632c2cb23 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sat, 13 Oct 2012 23:27:37 -0400 Subject: [PATCH 02/11] remove HTML comment from schematiceditor template --- .../lib/xmodule/xmodule/templates/problem/circuitschematic.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml index 224227aa5e..e4cfcd2849 100644 --- a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml @@ -7,7 +7,6 @@ data: | Your goal for this lab is to design a circuit that implements a - 3-input logic gate that implements \(Z = \lnot{(C(A+B))}\) where the \(\lnot\) symbol stands for logical negation. This function is enumerated in the following truth table: From d34075ff893967aa1421f4f4af0f0071940b2b7f Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 14 Oct 2012 15:43:16 -0400 Subject: [PATCH 03/11] remove the — from the HTML, this apparently is causing the CAS and LMS to barf on staging, but strangly not on dev --- common/lib/xmodule/xmodule/templates/html/announcement.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/templates/html/announcement.yaml b/common/lib/xmodule/xmodule/templates/html/announcement.yaml index ae89c3890e..82fe8fbc03 100644 --- a/common/lib/xmodule/xmodule/templates/html/announcement.yaml +++ b/common/lib/xmodule/xmodule/templates/html/announcement.yaml @@ -9,7 +9,7 @@ data: |

Words of encouragement! This is a short note that most students will read.

-

— Anant Agarwal (6.002x Principle Instructor)

+

Anant Agarwal (6.002x Principle Instructor)

Primary versus Secondary Updates:

Unfortunately, the internet throws a lot of text at students, and they do not read everything that they are given. However, many students do read all that they are From 4ac1a7411713e4850fcd52679ec9f575ebac1c63 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 14 Oct 2012 21:29:00 -0400 Subject: [PATCH 04/11] when calling jump_to when location= then Position is being computed as None. The redirect then yields a 404. Force Position to be 0 when Position=None --- lms/djangoapps/courseware/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index b8c8f5e912..e12c5bf93d 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -325,6 +325,11 @@ def jump_to(request, course_id, location): except NoPathToItem: raise Http404("This location is not in any class: {0}".format(location)) + if position is None: + return redirect('courseware_section', course_id=course_id, + chapter=chapter, + section=section) + # Rely on index to do all error handling and access control. return redirect('courseware_position', course_id=course_id, From a47b2be8dffef9190d9db9f68fec7dde5051af01 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 14 Oct 2012 21:31:45 -0400 Subject: [PATCH 05/11] set position=0 when position=None. Discuss with Dave O. --- lms/djangoapps/courseware/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index e12c5bf93d..3dc2c4996a 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -325,10 +325,11 @@ def jump_to(request, course_id, location): except NoPathToItem: raise Http404("This location is not in any class: {0}".format(location)) + # cdodge: the CAS is generating a link to the LMS for 'subsections' (aka sequentials) + # and there is no associated 'Position' for this. The above Path_to_location is returning None for Position + # however, this ends up producing a 404 on the redirect if position is None: - return redirect('courseware_section', course_id=course_id, - chapter=chapter, - section=section) + position = 0 # Rely on index to do all error handling and access control. return redirect('courseware_position', From 6fc07ab45e067a156de474bafa323d4e7663b145 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 14 Oct 2012 22:42:36 -0400 Subject: [PATCH 06/11] always hide the pages button. We don't want it appearing in case someone types a 'w' --- cms/templates/widgets/header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 6e56c4f591..2b9b2c7884 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -10,7 +10,7 @@ ${context_course.display_name}
  • Courseware
  • -
  • Pages
  • +
  • Assets
  • Users
  • Import
  • From eab5bd4c3ee6231a03a0efe4a8355504635caf2d Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 14 Oct 2012 23:38:43 -0400 Subject: [PATCH 07/11] fix preview draft link. We need to generate the link target url directly rather than using jump_to. I think jump_to is not properly finding the draft objects and needs more investigation --- cms/djangoapps/contentstore/views.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 93f867549c..dbdc97210e 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -272,6 +272,26 @@ def edit_unit(request, location): containing_section_locs = modulestore().get_parent_locations(containing_subsection.location) containing_section = modulestore().get_item(containing_section_locs[0]) + # cdodge hack. We're having trouble previewing drafts via jump_to redirect + # so let's generate the link url here + + # need to figure out where this item is in the list of children as the preview will need this + index =1 + for child in containing_subsection.get_children(): + if child.location == item.location: + break + index = index + 1 + + preview_lms_link = '//{preview}{lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'.format( + preview='preview.', + lms_base=settings.LMS_BASE, + org=course.location.org, + course=course.location.course, + course_name=course.location.name, + section=containing_section.location.name, + subsection=containing_subsection.location.name, + index=index) + unit_state = compute_unit_state(item) try: From 168fccf7aef966415082e30de579b93b9a52110f Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Mon, 15 Oct 2012 10:21:39 -0400 Subject: [PATCH 08/11] polished new course form --- cms/djangoapps/contentstore/views.py | 2 +- cms/static/js/base.js | 10 ++++-- cms/static/sass/_dashboard.scss | 53 ++++++++++++++++++++++++++++ cms/templates/index.html | 33 +++++++++++------ 4 files changed, 84 insertions(+), 14 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index dbdc97210e..3eda483d3f 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -109,7 +109,7 @@ def index(request): courses = modulestore().get_items(['i4x', None, None, 'course', None]) # filter out courses that we don't have access to - courses = filter(lambda course: has_access(request.user, course.location) and course.location.course != 'templates', courses) + courses = filter(lambda course: has_access(request.user, course.location) and course.location.course != 'templates' and course.location.org!='' and course.location.course!='' and course.location.name!='', courses) return render_to_response('index.html', { 'new_course_template' : Location('i4x', 'edx', 'templates', 'course', 'Empty'), diff --git a/cms/static/js/base.js b/cms/static/js/base.js index b0cb73cb50..fa813a125f 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -491,11 +491,15 @@ function addNewCourse(e) { function saveNewCourse(e) { e.preventDefault(); + var $newCourse = $(this).closest('.new-course'); + template = $(this).data('template'); - org = $(this).prevAll('.new-course-org').val(); - number = $(this).prevAll('.new-course-number').val(); - display_name = $(this).prevAll('.new-course-name').val(); + org = $newCourse.find('.new-course-org').val(); + number = $newCourse.find('.new-course-number').val(); + display_name = $newCourse.find('.new-course-name').val(); + + console.log(org); if (org == '' || number == '' || display_name == ''){ alert('You must specify all fields in order to create a new course.') diff --git a/cms/static/sass/_dashboard.scss b/cms/static/sass/_dashboard.scss index 652d7f9d66..8763927bdb 100644 --- a/cms/static/sass/_dashboard.scss +++ b/cms/static/sass/_dashboard.scss @@ -41,4 +41,57 @@ display: block; padding: 20px; text-align: center; +} + +.new-course { + padding: 15px 25px; + margin-top: 20px; + border-radius: 3px; + border: 1px solid $darkGrey; + background: #fff; + box-shadow: 0 1px 2px rgba(0, 0, 0, .1); + @include clearfix; + + .row { + margin-bottom: 15px; + @include clearfix; + } + + .column { + float: left; + width: 48%; + } + + .column:first-child { + margin-right: 4%; + } + + .course-info { + width: 600px; + } + + label { + display: block; + font-size: 13px; + font-weight: 700; + } + + .new-course-org, + .new-course-number, + .new-course-name { + width: 100%; + } + + .new-course-name { + font-size: 19px; + font-weight: 300; + } + + .new-course-save { + @include blue-button; + } + + .new-course-cancel { + @include white-button; + } } \ No newline at end of file diff --git a/cms/templates/index.html b/cms/templates/index.html index 69058e4db3..bceaa71e7c 100644 --- a/cms/templates/index.html +++ b/cms/templates/index.html @@ -4,16 +4,29 @@ <%block name="header_extras"> From 44283497a8d29cf92fb391ffefc3f9feef8250d7 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Mon, 15 Oct 2012 10:30:00 -0400 Subject: [PATCH 09/11] removed log --- cms/static/js/base.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/cms/static/js/base.js b/cms/static/js/base.js index fa813a125f..b49ffa6630 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -499,8 +499,6 @@ function saveNewCourse(e) { number = $newCourse.find('.new-course-number').val(); display_name = $newCourse.find('.new-course-name').val(); - console.log(org); - if (org == '' || number == '' || display_name == ''){ alert('You must specify all fields in order to create a new course.') } From 1cfde391ffb439c4e975e899b091c9a4fbf83c57 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Mon, 15 Oct 2012 10:54:58 -0400 Subject: [PATCH 10/11] changed save unit alerts to toast --- cms/static/coffee/src/views/module_edit.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 85c099ab9a..c39c908b47 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -57,12 +57,12 @@ class CMS.Views.ModuleEdit extends Backbone.View data = @module.save() data.metadata = @metadata() @model.save(data).done( => - alert("Your changes have been saved.") + showToastMessage("Your changes have been saved.", null, 3) @module = null @render() @$el.removeClass('editing') ).fail( -> - alert("There was an error saving your changes. Please try again.") + showToastMessage("There was an error saving your changes. Please try again.", null, 3) ) clickCancelButton: (event) -> From 500738d189b09afa4fedb6fd7c327a8002f68605 Mon Sep 17 00:00:00 2001 From: Tom Giannattasio Date: Mon, 15 Oct 2012 11:19:11 -0400 Subject: [PATCH 11/11] polished import progress bar --- cms/static/sass/_import.scss | 24 ++++++++++++++++++++++++ cms/templates/import.html | 20 +++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/cms/static/sass/_import.scss b/cms/static/sass/_import.scss index f9480a6d46..ac1044788f 100644 --- a/cms/static/sass/_import.scss +++ b/cms/static/sass/_import.scss @@ -67,4 +67,28 @@ white-space: normal; } } + + .progress-bar { + display: none; + width: 350px; + height: 30px; + margin: 30px auto 10px; + border: 1px solid $blue; + + &.loaded { + border-color: #66b93d; + + .progress-fill { + background: #66b93d; + } + } + } + + .progress-fill { + width: 0%; + height: 30px; + background: $blue; + color: #fff; + line-height: 48px; + } } \ No newline at end of file diff --git a/cms/templates/import.html b/cms/templates/import.html index 42def2d512..ffce24ed74 100644 --- a/cms/templates/import.html +++ b/cms/templates/import.html @@ -23,9 +23,9 @@

    change

    -