Skip to content

Commit e9483be

Browse files
committed
Fix delete registration checkbox on delete page (#6498)
Address #6501
1 parent 0c7b21a commit e9483be

3 files changed

Lines changed: 19 additions & 27 deletions

File tree

src/NuGetGallery/Areas/Admin/Views/Delete/Index.cshtml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,7 @@
124124
};
125125
126126
ko.applyBindings(new viewModel(), $('#stage').get(0));
127-
128-
$('#SoftDelete').change(function(e) {
129-
if (!this.checked) {
130-
$('#DeleteEmptyPackageRegistrationContainer').show();
131-
} else {
132-
$('#DeleteEmptyPackageRegistrationContainer').hide();
133-
}
134-
});
135-
136-
$('#delete-form').submit(function(e) {
137-
if (!confirm('Deleting these packages will make them unavailable for download and package restore. Are you sure you want to continue with the delete?')) {
138-
e.preventDefault();
139-
}
140-
});
141127
});
142128
</script>
129+
@Scripts.Render("~/Scripts/gallery/page-delete-package.js")
143130
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$(function () {
2+
'use strict';
3+
4+
$('#SoftDelete').change(function (e) {
5+
if (!this.checked) {
6+
$('#DeleteEmptyPackageRegistrationContainer').show();
7+
} else {
8+
$('#DeleteEmptyPackageRegistrationContainer').hide();
9+
}
10+
});
11+
12+
$('#delete-form').submit(function (e) {
13+
if (!confirm('Deleting this package will make it unavailable for download and package restore. Are you sure you want to continue with the delete?')) {
14+
e.preventDefault();
15+
}
16+
});
17+
});

src/NuGetGallery/Views/Packages/Delete.cshtml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,7 @@
151151
$('#input-select-version').change(function () {
152152
window.location.href = this.value;
153153
});
154-
155-
$('#DeletePackagesRequest_SoftDelete').change(function(e) {
156-
if (!this.checked) {
157-
$('#DeleteEmptyPackageRegistrationContainer').show();
158-
} else {
159-
$('#DeleteEmptyPackageRegistrationContainer').hide();
160-
}
161-
});
162-
$('#delete-form').submit(function(e) {
163-
if (!confirm('Deleting this package will make it unavailable for download and package restore. Are you sure you want to continue with the delete?')) {
164-
e.preventDefault();
165-
}
166-
});
167154
});
168155
</script>
156+
@Scripts.Render("~/Scripts/gallery/page-delete-package.js")
169157
}

0 commit comments

Comments
 (0)