Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created March 7, 2013 09:45
Show Gist options
  • Save kinglozzer/5106820 to your computer and use it in GitHub Desktop.
Save kinglozzer/5106820 to your computer and use it in GitHub Desktop.
/**
* File: NewsPage.js
*/
(function($) {
$.entwine('ss', function($) {
/**
* Class: .cms-edit-form .Actions #Form_EditForm_action_deletefromlive
*
* Show users a warning before allowing them to delete a page of 'NewsPage'
* page type.
*/
$('.cms-edit-form .Actions #Form_EditForm_action_deletefromlive').entwine({
/**
* Function: onclick
*
* Parameters:
* (Event) e
*/
onclick: function(e) {
var classname = $('.cms-edit-form :input[name=ClassName]').val(), message;
if (classname === 'NewsPage') {
message = "Are you sure you want to delete this page? \n\n"
+ "Any news items belonging to this page will need to be moved\n"
+ " to a different news page or deleted manually";
if ( ! confirm(message)) return false;
}
this._super(e);
}
});
});
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment