Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a confirmation on asset delete. Fixes STUD-375. #302

Merged
merged 3 commits into from
Jul 1, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cms/djangoapps/contentstore/features/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions cms/djangoapps/contentstore/features/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '#notification-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)
Expand Down
7 changes: 6 additions & 1 deletion cms/static/js/views/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ 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.Notification.Confirmation({
title: gettext("Your file has been deleted."),
closeIcon: false,
maxShown: 2000
});
deleted.show();
row.remove();
analytics.track('Deleted Asset', {
'course': course_location_analytics,
Expand Down