From 1d19a0f582924e17ea0d6872f9a878cdd7967725 Mon Sep 17 00:00:00 2001 From: tomovtony Date: Thu, 5 Nov 2009 11:29:07 +0200 Subject: [PATCH] Adding new files --- plugins/ui.multiselect.css | 30 ++++ plugins/ui.multiselect.js | 314 +++++++++++++++++++++++++++++++++++++ 2 files changed, 344 insertions(+) create mode 100644 plugins/ui.multiselect.css create mode 100644 plugins/ui.multiselect.js diff --git a/plugins/ui.multiselect.css b/plugins/ui.multiselect.css new file mode 100644 index 000000000..8ab18ef2c --- /dev/null +++ b/plugins/ui.multiselect.css @@ -0,0 +1,30 @@ +/* Multiselect +----------------------------------*/ + +.ui-multiselect { border: solid 1px; font-size: 0.8em; } +.ui-multiselect ul { -moz-user-select: none; } +.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; } +.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;} +.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; } + +.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; } +.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; } +.ui-multiselect ul.selected li { } + +.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; } +.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; } +.ui-multiselect ul.available li { padding-left: 10px; } + +.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;} +.ui-multiselect .ui-state-hover { border: none; } +.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;} + +.ui-multiselect .add-all { float: right; padding: 7px;} +.ui-multiselect .remove-all { float: right; padding: 7px;} +.ui-multiselect .search { float: left; padding: 4px;} +.ui-multiselect .count { float: left; padding: 7px;} + +.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; } +.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; } + +.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; } \ No newline at end of file diff --git a/plugins/ui.multiselect.js b/plugins/ui.multiselect.js new file mode 100644 index 000000000..fcbea81a3 --- /dev/null +++ b/plugins/ui.multiselect.js @@ -0,0 +1,314 @@ +/* + * jQuery UI Multiselect + * + * Authors: + * Michael Aufreiter (quasipartikel.at) + * Yanick Rochon (yanick.rochon[at]gmail[dot]com) + * + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://www.quasipartikel.at/multiselect/ + * + * + * Depends: + * ui.core.js + * ui.sortable.js + * + * Optional: + * localization (http://plugins.jquery.com/project/localisation) + * scrollTo (http://plugins.jquery.com/project/ScrollTo) + * + * Todo: + * Make batch actions faster + * Implement dynamic insertion through remote calls + */ + + +(function($) { + +$.widget("ui.multiselect", { + _init: function() { + this.element.hide(); + this.id = this.element.attr("id"); + this.container = $('
').insertAfter(this.element); + this.count = 0; // number of currently selected options + this.selectedContainer = $('
').appendTo(this.container); + this.availableContainer = $('
').appendTo(this.container); + this.selectedActions = $('
0 '+$.ui.multiselect.locale.itemsCount+''+$.ui.multiselect.locale.removeAll+'
').appendTo(this.selectedContainer); + this.availableActions = $('
'+$.ui.multiselect.locale.addAll+'
').appendTo(this.availableContainer); + this.selectedList = $('').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer); + this.availableList = $('').bind('selectstart', function(){return false;}).appendTo(this.availableContainer); + + var that = this; + + // set dimensions + this.container.width(this.element.width()+1); + this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation)); + this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation))); + + // fix list height to match