Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT Removed CheckboxRange javascript from AssetAdmin.js, unne…

…cessary complication of the UI with legacy prototypejs-based code.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92805 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit dd52d7a80401224f83a5bf6696b8dfe553895968 1 parent ba93170
@chillu chillu authored
Showing with 0 additions and 61 deletions.
  1. +0 −60 javascript/AssetAdmin.DragDrop.js
  2. +0 −1  javascript/AssetAdmin.js
View
60 javascript/AssetAdmin.DragDrop.js
@@ -1,63 +1,3 @@
-// CheckBoxRange adapted from: http://jroller.com/page/rmcmahon?entry=checkboxrange_with_prototype
-var CheckBoxRange = Class.create();
-
-CheckBoxRange.prototype = {
- currentBox: null,
- form: null,
- field: null,
-
- initialize: function(form, field) {
- this.form = form;
- this.field = field;
- this.eventPossibleCheckHappened = this.possibleCheckHappened.bindAsEventListener(this);
- if(form) {
- Event.observe(form, "click", this.eventPossibleCheckHappened);
- Event.observe(form, "keyup", this.eventPossibleCheckHappened);
- }
- },
-
- possibleCheckHappened: function(event) {
- var target = Event.element(event);
-
- if ((event.button == 0 || event.keyCode == 32 || event.keyCode == 17) &&
- this.isCheckBox(target) && target.form == $(this.form) && target.name == this.field) {
- // If ctrl or shift is keys are pressed
- if ((event.shiftKey || event.ctrlKey ) && this.currentBox)
- this.updateCheckBoxRange(this.currentBox, target);
- this.currentBox = target;
- }
- },
-
- isCheckBox: function(e) {
- return (e.tagName.toLowerCase() == "input" && e.type.toLowerCase() == "checkbox");
- },
-
- updateCheckBoxRange: function(start, end) {
- var last_clicked = end;
- var checkboxes = Form.getInputs(this.form, 'checkbox', this.field);
- var checkbox;
- var last;
-
- for (var i=0; (checkbox = checkboxes[i]); ++i) {
- if (checkbox == end) {
- last = start;
- break;
- }
- if (checkbox == start) {
- last = end;
- break;
- }
- }
-
- for (; (checkbox = checkboxes[i]); ++i) {
- if (checkbox != last_clicked && checkbox.checked != last_clicked.checked)
- checkbox.click();
- if (checkbox == last)
- break;
- }
- }
-}
-
// SubsDraggable adapted from http://dev.rubyonrails.org/ticket/5771
// extentions for scriptaculous dragdrop.js
View
1  javascript/AssetAdmin.js
@@ -283,5 +283,4 @@ jQuery(document).ready(function() {
Element.hide('Form_DeleteItemsForm');
}
- new CheckBoxRange($('Form_EditForm'), 'Files[]');
});
Please sign in to comment.
Something went wrong with that request. Please try again.