Permalink
Browse files

MINOR Moved some form logic from AssetAdmin.js to AssetTableField.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92808 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent f4e2dcb commit 284de94770285dfe895692cc65e56f2da8671d80 @chillu chillu committed Nov 21, 2009
Showing with 33 additions and 50 deletions.
  1. +1 −49 javascript/AssetAdmin.js
  2. +32 −1 javascript/AssetTableField.js
@@ -136,52 +136,4 @@ var _HANDLER_FORMS = {
}
};
});
-}(jQuery));
-
-
-Behaviour.register({
- '#Form_EditForm_Files': {
- removeFile : function(fileID) {
- var record;
- if(record = $('record-' + fileID)) {
- record.parentNode.removeChild(record);
- }
- }
- },
-
- '#Form_EditForm_Files a.deletelink' : {
- onclick : function(event) {
- // Send request
- new Ajax.Request(this.href + (this.href.indexOf("?") == -1 ? "?" : "&") + "ajax=1", {
- method : 'get',
- onSuccess : Ajax.Evaluator,
- onFailure : function(response) {errorMessage('Server Error', response);}
- });
- Event.stop(event);
- return false;
- }
- },
-
-
- '#Form_EditForm' : {
- changeDetection_fieldsToIgnore : {
- 'Files[]' : true
- }
- }
-});
-
-/**
- * We don't want hitting the enter key in the name field
- * to submit the form.
- */
- Behaviour.register({
- '#Form_EditForm_Name' : {
- onkeypress : function(event) {
- event = (event) ? event : window.event;
- var kc = event.keyCode ? event.keyCode : event.charCode;
- if(kc == 13) {
- return false;
- }
- }
- }
- });
+}(jQuery));
@@ -135,4 +135,35 @@ MarkingPropertiesButton.prototype = {
}
return false;
}
-}
+}
+
+Behaviour.register({
+ '#Form_EditForm_Files': {
+ removeFile : function(fileID) {
+ var record;
+ if(record = $('record-' + fileID)) {
+ record.parentNode.removeChild(record);
+ }
+ }
+ },
+
+ '#Form_EditForm_Files a.deletelink' : {
+ onclick : function(event) {
+ // Send request
+ new Ajax.Request(this.href + (this.href.indexOf("?") == -1 ? "?" : "&") + "ajax=1", {
+ method : 'get',
+ onSuccess : Ajax.Evaluator,
+ onFailure : function(response) {errorMessage('Server Error', response);}
+ });
+ Event.stop(event);
+ return false;
+ }
+ },
+
+
+ '#Form_EditForm' : {
+ changeDetection_fieldsToIgnore : {
+ 'Files[]' : true
+ }
+ }
+});

0 comments on commit 284de94

Please sign in to comment.