remove obsolete manual inputs JS setup code
This commit is contained in:
parent
a581640f7e
commit
8a33c7df34
@ -63,9 +63,10 @@ headedRowSelector toExternal fromExternal attrs colonnade tdata = do
|
|||||||
-> return Nothing
|
-> return Nothing
|
||||||
|
|
||||||
view _ name attributes val _ =
|
view _ name attributes val _ =
|
||||||
|
-- TODO: move this to a *.hamlet file
|
||||||
[whamlet|
|
[whamlet|
|
||||||
<label style="display: block">
|
<label style="display: block">
|
||||||
<input type=checkbox name=#{name} value=#{toPathPiece extId} *{attributes} :isRight val:checked>
|
<input type=checkbox uw-checkbox name=#{name} value=#{toPathPiece extId} *{attributes} :isRight val:checked>
|
||||||
|]
|
|]
|
||||||
|
|
||||||
selectionIdent <- newFormIdent
|
selectionIdent <- newFormIdent
|
||||||
|
|||||||
@ -3,56 +3,6 @@
|
|||||||
|
|
||||||
var inputUtilities = [];
|
var inputUtilities = [];
|
||||||
|
|
||||||
var JS_INITIALIZED_CLASS = 'js-inputs-initialized';
|
|
||||||
|
|
||||||
window.utils.inputs = function(wrapper, options) {
|
|
||||||
options = options || {};
|
|
||||||
var utilInstances = [];
|
|
||||||
|
|
||||||
if (wrapper.classList.contains(JS_INITIALIZED_CLASS) && !options.force) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkboxes
|
|
||||||
var checkboxes = Array.from(wrapper.querySelectorAll('input[type="checkbox"]'));
|
|
||||||
checkboxes.forEach(function(checkbox) {
|
|
||||||
utilInstances.push(window.utils.setup('checkbox', checkbox));
|
|
||||||
});
|
|
||||||
|
|
||||||
// radios
|
|
||||||
var radios = Array.from(wrapper.querySelectorAll('input[type="radio"]'));
|
|
||||||
radios.forEach(function(radio) {
|
|
||||||
utilInstances.push(window.utils.setup('radio', radio));
|
|
||||||
});
|
|
||||||
|
|
||||||
// file-uploads
|
|
||||||
var fileUploads = Array.from(wrapper.querySelectorAll('input[type="file"]'));
|
|
||||||
fileUploads.forEach(function(input) {
|
|
||||||
utilInstances.push(window.utils.setup('fileUpload', input, options));
|
|
||||||
});
|
|
||||||
|
|
||||||
// file-checkboxes
|
|
||||||
var fileCheckboxes = Array.from(wrapper.querySelectorAll('.file-checkbox'));
|
|
||||||
fileCheckboxes.forEach(function(input) {
|
|
||||||
utilInstances.push(window.utils.setup('fileCheckbox', input, options));
|
|
||||||
});
|
|
||||||
|
|
||||||
function destroyUtils() {
|
|
||||||
utilInstances.filter(function(utilInstance) {
|
|
||||||
return !!utilInstance;
|
|
||||||
}).forEach(function(utilInstance) {
|
|
||||||
utilInstance.destroy();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.classList.add(JS_INITIALIZED_CLASS);
|
|
||||||
|
|
||||||
return {
|
|
||||||
scope: wrapper,
|
|
||||||
destroy: destroyUtils,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* FileInput Utility
|
* FileInput Utility
|
||||||
@ -241,6 +191,13 @@
|
|||||||
setup: checkboxUtil,
|
setup: checkboxUtil,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// register the collected input utilities
|
||||||
|
if (UtilRegistry) {
|
||||||
|
inputUtilities.forEach(UtilRegistry.register);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FH: leaving this as it is to be able to understand whats going on
|
||||||
|
|
||||||
// Override implicit submit (pressing enter) behaviour to trigger a specified submit button instead of the default
|
// Override implicit submit (pressing enter) behaviour to trigger a specified submit button instead of the default
|
||||||
window.utils.implicitSubmit = function(input, options) {
|
window.utils.implicitSubmit = function(input, options) {
|
||||||
var submit = options.submit;
|
var submit = options.submit;
|
||||||
@ -265,9 +222,4 @@
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// register input utilities
|
|
||||||
if (UtilRegistry) {
|
|
||||||
inputUtilities.forEach(UtilRegistry.register);
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user