diff --git a/cms/djangoapps/contentstore/checklist_model.py b/cms/djangoapps/contentstore/checklist_model.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 7394edb4f7..25ae65f33c 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -113,9 +113,6 @@ def howitworks(request): else: return render_to_response('howitworks.html', {}) -def ux_checklists(request): - return render_to_response('ux-checklists.html', {}) - # ==== Views for any logged-in user ================================== @@ -179,11 +176,7 @@ def course_index(request, org, course, name): org, course, name: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) lms_link = get_lms_link_for_item(location) @@ -1071,11 +1064,7 @@ def course_info(request, org, course, name, provided_id=None): org, course, name: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) course_module = modulestore().get_item(location) @@ -1170,11 +1159,7 @@ def get_course_settings(request, org, course, name): org, course, name: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) course_module = modulestore().get_item(location) @@ -1197,11 +1182,7 @@ def course_config_graders_page(request, org, course, name): org, course, name: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) course_module = modulestore().get_item(location) course_details = CourseGradingModel.fetch(location) @@ -1221,11 +1202,7 @@ def course_config_advanced_page(request, org, course, name): org, course, name: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) course_module = modulestore().get_item(location) @@ -1280,11 +1257,7 @@ def course_grader_updates(request, org, course, name, grader_index=None): org, course: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) if request.method == 'POST' and 'HTTP_X_HTTP_METHOD_OVERRIDE' in request.META: real_method = request.META['HTTP_X_HTTP_METHOD_OVERRIDE'] @@ -1314,11 +1287,7 @@ def course_advanced_updates(request, org, course, name): org, course: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) # NB: we're setting Backbone.emulateHTTP to true on the client so everything comes as a post!!! if request.method == 'POST' and 'HTTP_X_HTTP_METHOD_OVERRIDE' in request.META: @@ -1335,6 +1304,27 @@ def course_advanced_updates(request, org, course, name): return HttpResponse(json.dumps(CourseMetadata.update_from_json(location, json.loads(request.body))), mimetype="application/json") +#@ensure_csrf_cookie what is this cookie? +@login_required +def get_checklists(request, org, course, name): + location = get_location_and_verify_access(request, org, course, name) + + modulestore = get_modulestore(location) + course_module = modulestore.get_item(location) + new_course_template = Location('i4x', 'edx', 'templates', 'course', 'Empty') + template_module = modulestore.get_item(new_course_template) + + # If course was created before checklists were introduced, copy them over from the template. + key = "checklists" + if not key in course_module.metadata: + course_module.metadata[key] = template_module.metadata[key] + modulestore.update_metadata(location, course_module.metadata) + + + return render_to_response('checklists.html', + {'checklists' : course_module.metadata[key]}) + + @login_required @ensure_csrf_cookie def asset_index(request, org, course, name): @@ -1343,12 +1333,7 @@ def asset_index(request, org, course, name): org, course, name: Attributes of the Location for the item to edit """ - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() - + location = get_location_and_verify_access(request, org, course, name) upload_asset_callback_url = reverse('upload_asset', kwargs={ 'org': org, @@ -1473,11 +1458,7 @@ def initialize_course_tabs(course): @login_required def import_course(request, org, course, name): - location = ['i4x', org, course, 'course', name] - - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) if request.method == 'POST': filename = request.FILES['course-data'].name @@ -1550,10 +1531,7 @@ def import_course(request, org, course, name): @ensure_csrf_cookie @login_required def generate_export_course(request, org, course, name): - location = ['i4x', org, course, 'course', name] - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() + location = get_location_and_verify_access(request, org, course, name) loc = Location(location) export_file = NamedTemporaryFile(prefix=name + '.', suffix=".tar.gz") @@ -1586,11 +1564,9 @@ def generate_export_course(request, org, course, name): @login_required def export_course(request, org, course, name): - location = ['i4x', org, course, 'course', name] + location = get_location_and_verify_access(request, org, course, name) + course_module = modulestore().get_item(location) - # check that logged in user has permissions to this item - if not has_access(request.user, location): - raise PermissionDenied() return render_to_response('export.html', { 'context_course': course_module, @@ -1605,3 +1581,12 @@ def event(request): console logs don't get distracted :-) ''' return HttpResponse(True) + +def get_location_and_verify_access(request, org, course, name): + location = ['i4x', org, course, 'course', name] + + # check that logged in user has permissions to this item + if not has_access(request.user, location): + raise PermissionDenied() + + return location \ No newline at end of file diff --git a/cms/static/js/views/checklists_view.js b/cms/static/js/views/checklists_view.js new file mode 100644 index 0000000000..b33a5d66f4 --- /dev/null +++ b/cms/static/js/views/checklists_view.js @@ -0,0 +1,18 @@ +CMS.Views.Checklists = Backbone.View.extend({ + // takes CMS.Models.CourseInfo as model + tagName: 'div', + + render: function() { + // instantiate the ClassInfoUpdateView and delegate the proper dom to it + new CMS.Views.ClassInfoUpdateView({ + el: $('body.updates'), + collection: this.model.get('updates') + }); + + new CMS.Views.ClassInfoHandoutsView({ + el: this.$('#course-handouts-view'), + model: this.model.get('handouts') + }); + return this; + } +}); \ No newline at end of file diff --git a/cms/templates/checklists.html b/cms/templates/checklists.html index 21f5c5007d..109ac36df5 100644 --- a/cms/templates/checklists.html +++ b/cms/templates/checklists.html @@ -1,43 +1,633 @@ <%inherit file="base.html" /> <%block name="title">Course Checklists -<%block name="bodyclass">is-signedin course checklists - -<%block name="jsextra"> - - +<%block name="bodyclass">is-signedin course uxdesign checklists <%block name="content">
-
-
- UX Design -

Alerts & Notifications

-
-
+
+
+ Tools +

Course Tasks & Checklists

+
+
-
-
-
-
-

Alerts

- persistant, static messages to the user -
+
+
+
+

Current Checklists

-

In Studio, alerts are 1) general warnings/notes (e.g. drafts, published content, next steps) about the current view a user is interacting with or 2) notes about the status (e.g. saved confirmations, errors, next system steps) of any previous state that need to communicated to the user when arriving at the current view.

-
-
-
+ +% for checklist in checklists: +
+
+

${checklist['short_description']}

+ Tasks Completed: 0/4 +
+ +
+% endfor + +
+
+

Getting Started with Studio

+ Tasks Completed: 0/4 +
+ + + + +
+ +
+
+

Draft a Rough Course Outline

+ Tasks Completed: 0/7 +
+ + + + +
+ +
+
+

Explore edX's Support Tools

+ Tasks Completed: 0/4 +
+ + + + +
+ +
+
+

Draft your Course Introduction

+ Tasks Completed: 0/4 +
+ + + + +
+ +
+ +

Completed Checklists

+ +
+
+

Completed Checklist Example

+ Tasks Completed: 3/3 +
+ + + + +
+ +
+ + + + +
<%block name="view_alerts"> - + +
+
+ + +
+

Your policy changes have been saved.

+

Please note that validation of your policy key and value pairs is not currently in place yet. If you are having difficulties, please review your policy pairs.

+
+ + + + close alert + +
+
+ + +<%block name="jsextra"> + \ No newline at end of file diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 7648f8b6f2..45ff66df85 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -58,7 +58,7 @@ diff --git a/cms/urls.py b/cms/urls.py index cba19310fe..18da7c7b71 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -83,7 +83,8 @@ urlpatterns = ('', # User creation and updating views urlpatterns += ( - url(r'^ux-checklists$', 'contentstore.views.ux_checklists', name='checklists'), + url(r'^(?P[^/]+)/(?P[^/]+)/checklists/(?P[^/]+)$', 'contentstore.views.get_checklists', name='checklists'), +# url(r'^ux-checklists$', 'contentstore.views.ux_checklists', name='checklists'), url(r'^howitworks$', 'contentstore.views.howitworks', name='howitworks'), url(r'^signup$', 'contentstore.views.signup', name='signup'), diff --git a/common/lib/xmodule/xmodule/templates/course/empty.yaml b/common/lib/xmodule/xmodule/templates/course/empty.yaml index cb2f3bcec6..61cc204254 100644 --- a/common/lib/xmodule/xmodule/templates/course/empty.yaml +++ b/common/lib/xmodule/xmodule/templates/course/empty.yaml @@ -2,5 +2,31 @@ metadata: display_name: Empty start: 2020-10-10T10:00 + checklists: [ + {"short_description" : "Getting Started With Studio", + "items" : [{"short_description": "Add Course Team Members", + "long_description": "Grant your collaborators permission to edit your course so you can work together.", + "is_checked": false, + "action_url": "/manage_users/", + "action_text": "Edit Course Team"}, + {"short_description": "Drink Whiskey", + "long_description": "Team-building activity.", + "is_checked": false, + "action_url": "/drink_alcohol", + "action_text": "Drink"}], + "completed" : false}, + {"short_description" : "Launching Your Course", + "items" : [{"short_description": "Add Content", + "long_description": "Create videos and problems.", + "is_checked": false, + "action_url": "", + "action_text": ""}, + {"short_description": "View Course as a Student", + "long_description": "Create a student account and view your course.", + "is_checked": false, + "action_url": "", + "action_text": ""}], + "completed" : false} + ] data: { 'textbooks' : [ ], 'wiki_slug' : null } children: []