Commit 5cb1b259 by Peter Fogg

Merge pull request #787 from edx/peter-fogg/static-page-delete

Add delete confirmation to static pages.
parents 07d9106c 75b76b37
...@@ -11,8 +11,9 @@ Feature: Static Pages ...@@ -11,8 +11,9 @@ Feature: Static Pages
Given I have opened a new course in Studio Given I have opened a new course in Studio
And I go to the static pages page And I go to the static pages page
And I add a new page And I add a new page
When I will confirm all alerts
And I "delete" the "Empty" page And I "delete" the "Empty" page
Then I am shown a prompt
When I confirm the prompt
Then I should not see a "Empty" static page Then I should not see a "Empty" static page
# Safari won't update the name properly # Safari won't update the name properly
......
...@@ -64,20 +64,31 @@ class CMS.Views.TabsEdit extends Backbone.View ...@@ -64,20 +64,31 @@ class CMS.Views.TabsEdit extends Backbone.View
course: course_location_analytics course: course_location_analytics
deleteTab: (event) => deleteTab: (event) =>
if not confirm 'Are you sure you want to delete this component? This action cannot be undone.' confirm = new CMS.Views.Prompt.Warning
return title: gettext('Delete Component Confirmation')
message: gettext('Are you sure you want to delete this component? This action cannot be undone.')
actions:
primary:
text: gettext("OK")
click: (view) ->
view.hide()
$component = $(event.currentTarget).parents('.component') $component = $(event.currentTarget).parents('.component')
analytics.track "Deleted Static Page", analytics.track "Deleted Static Page",
course: course_location_analytics course: course_location_analytics
id: $component.data('id') id: $component.data('id')
deleting = new CMS.Views.Notification.Mini
title: gettext('Deleting') + '…'
deleting.show()
$.post('/delete_item', { $.post('/delete_item', {
id: $component.data('id') id: $component.data('id')
}, => }, =>
$component.remove() $component.remove()
deleting.hide()
) )
secondary: [
text: gettext('Cancel')
click: (view) ->
view.hide()
]
confirm.show()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment