diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index fb072655e3..d95322f2f8 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'), @@ -273,6 +273,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: 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) -> diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 333c44f023..85355b5dd2 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -491,11 +491,13 @@ 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(); 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/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 @@
-