From 1be2068bcf4c7365fb29f6d7c0c42d1a78ea4110 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 28 Jun 2013 11:37:37 -0400 Subject: [PATCH 1/3] Show a confirmation on asset delete. Fixes STUD-375. --- cms/djangoapps/contentstore/features/upload.feature | 1 + cms/djangoapps/contentstore/features/upload.py | 6 ++++++ cms/static/js/views/assets.js | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/features/upload.feature b/cms/djangoapps/contentstore/features/upload.feature index b3c1fc2ce3ef..8d401636858e 100644 --- a/cms/djangoapps/contentstore/features/upload.feature +++ b/cms/djangoapps/contentstore/features/upload.feature @@ -21,6 +21,7 @@ Feature: Upload Files When I upload the file "test" And I delete the file "test" Then I should not see the file "test" was uploaded + And I see a confirmation that the file was deleted Scenario: Users can download files Given I have opened a new course in studio diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index 258fc5ebcf08..bc06c97f9cbe 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -90,6 +90,12 @@ def modify_upload(_step, file_name): cur_file.write(new_text) +@step('I see a confirmation that the file was deleted') +def i_see_a_delete_confirmation(step): + alert_css = '#alert-confirmation' + assert world.is_css_present(alert_css) + + def get_index(file_name): names_css = 'td.name-col > a.filename' all_names = world.css_find(names_css) diff --git a/cms/static/js/views/assets.js b/cms/static/js/views/assets.js index 18ef131f5203..e9ab2cb911c1 100644 --- a/cms/static/js/views/assets.js +++ b/cms/static/js/views/assets.js @@ -23,7 +23,11 @@ function removeAsset(e){ { 'location': row.data('id') }, function() { // show the post-commit confirmation - $(".wrapper-alert-confirmation").addClass("is-shown").attr('aria-hidden','false'); + var deleted = new CMS.Views.Alert.Confirmation({ + title: gettext("Your file has been deleted."), + closeIcon: false + }); + deleted.show(); row.remove(); analytics.track('Deleted Asset', { 'course': course_location_analytics, From b3cd6af9aa396f969dffb3471c1bd7994a706708 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Fri, 28 Jun 2013 14:34:05 -0400 Subject: [PATCH 2/3] Change deleted Alert to a Notification, with a timeout. --- cms/djangoapps/contentstore/features/upload.py | 2 +- cms/static/js/views/assets.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index bc06c97f9cbe..a298ff08b1be 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -92,7 +92,7 @@ def modify_upload(_step, file_name): @step('I see a confirmation that the file was deleted') def i_see_a_delete_confirmation(step): - alert_css = '#alert-confirmation' + alert_css = '#notification-confirmation' assert world.is_css_present(alert_css) diff --git a/cms/static/js/views/assets.js b/cms/static/js/views/assets.js index e9ab2cb911c1..224ec928fb67 100644 --- a/cms/static/js/views/assets.js +++ b/cms/static/js/views/assets.js @@ -23,9 +23,10 @@ function removeAsset(e){ { 'location': row.data('id') }, function() { // show the post-commit confirmation - var deleted = new CMS.Views.Alert.Confirmation({ + var deleted = new CMS.Views.Notification.Confirmation({ title: gettext("Your file has been deleted."), - closeIcon: false + closeIcon: false, + maxShown: 2000 }); deleted.show(); row.remove(); From 1809fde60c68288ef62806699f0c1daab0af69dd Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Mon, 1 Jul 2013 09:16:25 -0400 Subject: [PATCH 3/3] Pylint cleanup. --- cms/djangoapps/contentstore/features/upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index a298ff08b1be..47d770dc47b0 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -91,7 +91,7 @@ def modify_upload(_step, file_name): @step('I see a confirmation that the file was deleted') -def i_see_a_delete_confirmation(step): +def i_see_a_delete_confirmation(_step): alert_css = '#notification-confirmation' assert world.is_css_present(alert_css)