mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 12:05:56 +00:00
MINOR: jslint suggested improvements
This commit is contained in:
parent
782b07ec80
commit
fd94ad19f4
@ -1,20 +1,26 @@
|
||||
(function($){
|
||||
"use strict";
|
||||
|
||||
$.entwine('ss', function($) {
|
||||
|
||||
|
||||
$('.ss-gridfield .action.dms-delete').entwine({
|
||||
onclick: function(e){
|
||||
//work out how many pages are left attached to this document
|
||||
var pagesCount = this.data('pages-count');
|
||||
var pagesCountAfterDeletion = pagesCount - 1;
|
||||
var addS = 's';
|
||||
if (pagesCountAfterDeletion == 1) addS = '';
|
||||
if (pagesCountAfterDeletion === 1) {
|
||||
addS = '';
|
||||
}
|
||||
|
||||
//display an appropriate message
|
||||
var message = '';
|
||||
if (this.hasClass('dms-delete-last-warning')) message = "Permanently delete this document?\n\nWarning: this document is attached only to this page, deleting it here will delete it permanently.";
|
||||
if (this.hasClass('dms-delete-link-only')) message = "Unlink this document from this page?\n\nNote: it will remain attached to "+pagesCountAfterDeletion+" other page"+addS+".";
|
||||
if (this.hasClass('dms-delete-last-warning')) {
|
||||
message = "Permanently delete this document?\n\nWarning: this document is attached only to this page, deleting it here will delete it permanently.";
|
||||
}
|
||||
if (this.hasClass('dms-delete-link-only')) {
|
||||
message = "Unlink this document from this page?\n\nNote: it will remain attached to "+pagesCountAfterDeletion+" other page"+addS+".";
|
||||
}
|
||||
|
||||
if(!confirm(message)) {
|
||||
e.preventDefault();
|
||||
@ -26,7 +32,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
Loading…
x
Reference in New Issue
Block a user