right-rails 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -179,7 +179,7 @@ var Selectable = new Widget('UL', {
179
179
  include: Updater,
180
180
 
181
181
  extend: {
182
- version: '2.0.0',
182
+ version: '2.0.1',
183
183
 
184
184
  EVENTS: $w('change select unselect disable enable hover leave show hide'),
185
185
 
@@ -487,7 +487,7 @@ var Selectable = new Widget('UL', {
487
487
  event.stop();
488
488
  var item = event.target, items = this.items();
489
489
 
490
- if (!this.disabled(item)) {
490
+ if (items.include(item) && !this.disabled(item)) {
491
491
  if (this.isSingle) { // single-selects are always select
492
492
  this.select(item);
493
493
  } else if (this.selected(item)) {
@@ -6,16 +6,16 @@
6
6
  */
7
7
  var Selectable=RightJS.Selectable=function(h,e){var g=e.$,p=e.$$,q=e.$w,i=e.$E,o=e.$A,r=e.isHash,l=e.isArray,m=e.isString,s=e.isNumber,t=e.defined,u=e.Input,n=e.Element,k=new (function(a,b){if(!b){b=a;a="DIV"}var d=new e.Wrapper(e.Element.Wrappers[a]||e.Element,{initialize:function(c,f){this.key=c;var j=[{"class":"rui-"+c}];this instanceof e.Input||this instanceof e.Form||j.unshift(a);this.$super.apply(this,j);if(e.isString(f))f=e.$(f);if(f instanceof e.Element){this._=f._;if("$listeners"in f)f.$listeners=
8
8
  f.$listeners;f={}}this.setOptions(f,this);return this},setOptions:function(c,f){f=f||this;e.Options.setOptions.call(this,e.Object.merge(c,eval("("+(f.get("data-"+this.key)||"{}")+")")));return this}});d=new e.Wrapper(d,b);e.Observer.createShortcuts(d.prototype,d.EVENTS||[]);return d})("UL",{include:{assignTo:function(a){var b=e(function(c,f){if(c=g(c))c[c.setValue?"setValue":"update"](f.target.getValue())}).curry(a),d=e(function(c,f){(c=g(c))&&c.onChange&&c.onChange(e(function(){this.setValue(c.value())}).bind(f))}).curry(a);
9
- if(g(a)){b({target:this});d(this)}else g(h).onReady(e(function(){b({target:this});d(this)}.bind(this)));return this.onChange(b)}},extend:{version:"2.0.0",EVENTS:q("change select unselect disable enable hover leave show hide"),Options:{options:null,selected:null,disabled:null,multiple:true,fxName:"slide",fxDuration:"short",update:null,parseIds:false,limit:null,hCont:"•"},rescan:function(a){g(a||h).find(".rui-selectable").each(function(b){b instanceof k||new k(b)})}},initialize:function(){var a=
9
+ if(g(a)){b({target:this});d(this)}else g(h).onReady(e(function(){b({target:this});d(this)}.bind(this)));return this.onChange(b)}},extend:{version:"2.0.1",EVENTS:q("change select unselect disable enable hover leave show hide"),Options:{options:null,selected:null,disabled:null,multiple:true,fxName:"slide",fxDuration:"short",update:null,parseIds:false,limit:null,hCont:"•"},rescan:function(a){g(a||h).find(".rui-selectable").each(function(b){b instanceof k||new k(b)})}},initialize:function(){var a=
10
10
  o(arguments).compact(),b=a.pop();a=a.pop();var d;if(!r(b)||b instanceof n){a=g(a||b);b={}}if(a&&a instanceof u)a=b=this.harvestOptions(d=a);this.$super("selectable",a).setOptions(b).on({mousedown:this._mousedown,mouseover:this._mouseover,mouseout:this._mouseout,mouseup:this._mouseup,click:this._click,select:this._change,unselect:this._change});this.empty()&&this.build();b=this.options;if(!b.multiple||this.hasClass("rui-selectable-single")){this.isSingle=true;this.addClass("rui-selectable-single");
11
11
  this.buildSingle();b.selected===null&&this.select(this.items()[0])}b.disabled&&this.disable(b.disabled);b.selected&&this.select(b.selected);b.update&&this.assignTo(b.update);if(d){this.assignTo(d).insertTo(d,"before");d.wrap(i("div",{style:"position:absolute;z-index:-1;visibility:hidden;width:0;height:0;overflow:hidden"}))}},setValue:function(a){if(m(a))a=a.split(",").map("trim").filter(function(b){return!b.blank()});this.items().each("removeClass","rui-selectable-selected");return this.select(a)},
12
12
  getValue:function(){if(this.isSingle){var a=this.items().first("hasClass","rui-selectable-selected");return a?this.itemValue(a):null}else return this.items().filter("hasClass","rui-selectable-selected").map(function(b){return this.itemValue(b)},this)},disable:function(a){this.mapOrAll(a).each(function(b){this.fire("disable",b.addClass("rui-selectable-disabled"))},this);return this},enable:function(a){this.mapOrAll(a).each(function(b){this.fire("enable",b.removeClass("rui-selectable-disabled"))},this);
13
13
  return this},disabled:function(a){return this.mapOrAll(a).every("hasClass","rui-selectable-disabled")},select:function(a){a=this.mapEnabled(a);if(this.isSingle&&a){this.items().each("removeClass","rui-selectable-selected");a=e([a[0]])}if(!this.isSingle&&this.options.limit){for(var b=this.items().filter("hasClass","rui-selectable-selected"),d=[];a.length&&b.length+d.length<this.options.limit;){var c=a.shift();b.include(c)||d.push(c)}a=d}a.compact().each(function(f){this.fire("select",f.addClass("rui-selectable-selected"))},
14
14
  this);return this},unselect:function(a){this.getValue();this.mapEnabled(a).each(function(b){this.fire("unselect",b.removeClass("rui-selectable-selected"))},this);return this},selected:function(a){return this.mapEnabled(a).every("hasClass","rui-selectable-selected")},insertTo:function(a,b){n.prototype.insertTo.call(this.isSingle?this.container:this,a,b);return this},fire:function(a,b){b&&b instanceof n?this.$super(a,{item:b,index:this.items().indexOf(b)}):this.$super.apply(this,arguments);return this},
15
15
  itemValue:function(a){var b=a.get("id")||a.get("val");return b?this.options.parseIds?b.match(/\d+/):b:this.items().indexOf(a)},items:function(){return this.find("li")},mapOrAll:function(a){var b=this.items();if(t(a)){l(a)||(a=[a]);b=e(a).map(function(d){var c=m(d)&&/^\d+$/.test(d)?parseInt(d,10):d,f=d;if(s(c))f=b[c];else if(m(d))f=b.first(function(j){return j.id==d||j.val==d});return f},this).compact()}return b},mapEnabled:function(a){return this.mapOrAll(a).filter(function(b){return!b.hasClass("rui-selectable-disabled")},
16
- this)},_mousedown:function(a){a.stop();var b=a.target,d=this.items();if(!this.disabled(b)){if(this.isSingle)this.select(b);else if(this.selected(b)){this.unselect(b);this._massRemove=true}else{this.select(b);this._massSelect=true}if((a.shiftKey||a.metaKey)&&this._prevItem){var c=d.indexOf(this._prevItem);a=d.indexOf(b);if(c!=a){if(c>a)a=c=a;for(c=c;c<a;c++)this[this._prevItem.hasClass("rui-selectable-selected")?"select":"unselect"](d[c])}}this._prevItem=b}},_mouseup:function(a){a.stop();this._massRemove=
17
- this._massSelect=false},_mouseover:function(a){a=a.target;this.fire("hover",a);if(!this.isSingle)if(this._massSelect)this.select(a);else this._massRemove&&this.unselect(a)},_mouseout:function(a){this.fire("leave",a.target)},_click:function(a){a.stop()},_change:function(){if(""+this.value!=""+this.getValue()){this.value=this.getValue();this.fire("change")}},build:function(){var a=this.options.options,b=e([]);if(l(a))a.each(function(c){b.push(l(c)?c:[c,c])});else for(var d in a)b.push([a[d],d]);b.each(function(c){this.insert(i("li",
18
- {val:c[1],html:c[0]}))},this);return this},buildSingle:function(){this.container=i("div",{"class":"rui-selectable-container"}).insert([this.trigger=i("div",{html:this.options.hCont,"class":"rui-selectable-handle"}),this.display=i("ul",{"class":"rui-selectable-display"})]).onClick(e(this.toggleList).bind(this));this.parent()&&this.container.insertTo(this,"instead");this.container.insert(this);g(h).onClick(e(this.hideList).bind(this));return this.onSelect("showItem").onSelect("hideList").addClass("rui-dd-menu")},
16
+ this)},_mousedown:function(a){a.stop();var b=a.target,d=this.items();if(d.include(b)&&!this.disabled(b)){if(this.isSingle)this.select(b);else if(this.selected(b)){this.unselect(b);this._massRemove=true}else{this.select(b);this._massSelect=true}if((a.shiftKey||a.metaKey)&&this._prevItem){var c=d.indexOf(this._prevItem);a=d.indexOf(b);if(c!=a){if(c>a)a=c=a;for(c=c;c<a;c++)this[this._prevItem.hasClass("rui-selectable-selected")?"select":"unselect"](d[c])}}this._prevItem=b}},_mouseup:function(a){a.stop();
17
+ this._massRemove=this._massSelect=false},_mouseover:function(a){a=a.target;this.fire("hover",a);if(!this.isSingle)if(this._massSelect)this.select(a);else this._massRemove&&this.unselect(a)},_mouseout:function(a){this.fire("leave",a.target)},_click:function(a){a.stop()},_change:function(){if(""+this.value!=""+this.getValue()){this.value=this.getValue();this.fire("change")}},build:function(){var a=this.options.options,b=e([]);if(l(a))a.each(function(c){b.push(l(c)?c:[c,c])});else for(var d in a)b.push([a[d],
18
+ d]);b.each(function(c){this.insert(i("li",{val:c[1],html:c[0]}))},this);return this},buildSingle:function(){this.container=i("div",{"class":"rui-selectable-container"}).insert([this.trigger=i("div",{html:this.options.hCont,"class":"rui-selectable-handle"}),this.display=i("ul",{"class":"rui-selectable-display"})]).onClick(e(this.toggleList).bind(this));this.parent()&&this.container.insertTo(this,"instead");this.container.insert(this);g(h).onClick(e(this.hideList).bind(this));return this.onSelect("showItem").onSelect("hideList").addClass("rui-dd-menu")},
19
19
  toggleList:function(a){a.stop();return this.visible()?this.hideList():this.showList(a)},showList:function(a){a.stop();p(".rui-selectable-single").without(this).each("hide");a=this.container.dimensions();var b=this.container.position();this.setStyle({top:a.top+a.height-b.y-1+"px",left:a.left-b.x+"px",width:a.width+"px"}).show(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"show",this)});this.options.fxName||this.fire("show",this)},hideList:function(){if(this.isSingle&&
20
20
  this.visible()){this.hide(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"hide")});this.options.fxName||this.fire("hide")}},showItem:function(){var a=this.items().first("hasClass","rui-selectable-selected")||this.items().first();this.display.html("<li>"+(a?a.html():"&nbsp;")+"</li>")},harvestOptions:function(a){var b={};b.multiple=a.has("multiple");b.options=e([]);b.selected=e([]);b.disabled=e([]);o(a._.getElementsByTagName("OPTION")).each(function(d,c){b.options.push([d.innerHTML,
21
21
  g(d).get("value")||d.innerHTML]);d.selected&&!a._.disabled&&b.selected.push(c);if(d.disabled||a._.disabled)b.disabled.push(c)});if(b.selected.empty())b.selected=0;return b}});g(h).onReady(function(){k.rescan()});h.write('<style type="text/css"> *.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em} *.rui-selectable, *.rui-selectable li, *.rui-selectable dt, *.rui-selectable dd, *.rui-selectable ul,div.rui-selectable-container ul.rui-selectable-display,div.rui-selectable-container ul.rui-selectable-display li{margin:0;padding:0;border:none;background:none;list-style:none} *.rui-selectable{border:1px solid #CCC;border-bottom:none;display:inline-block; *display:inline; *zoom:1;min-width:10em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-selectable li{padding:.3em 1em;cursor:pointer;border-bottom:1px solid #CCC} *.rui-selectable li:hover{background:#EEE} *.rui-selectable li.rui-selectable-selected{font-weight:bold;background:#DDD} *.rui-selectable li.rui-selectable-disabled, *.rui-selectable li.rui-selectable-disabled:hover{background:#CCC;color:#777;cursor:default}dl.rui-selectable dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE;border-bottom:1px solid #CCC}dl.rui-selectable dd li{padding-left:1.5em} *.rui-selectable-single{background:#FFF;display:none}div.rui-selectable-container{border:1px solid #CCC;-moz-border-radius:.2em;-webkit-border-radius:.2em;display:inline-block; *display:inline; *zoom:1; *width:10em;vertical-align:middle;min-width:10em;cursor:pointer;height:1.6em;position:relative}div.rui-selectable-container div.rui-selectable-handle{font-family:Arial;float:right;width:0.8em;background:#DDD;text-align:center;height:100%;line-height:0.8em;font-size:200%;color:#888;border-left:1px solid #CCC}div.rui-selectable-container:hover div.rui-selectable-handle{color:#666}div.rui-selectable-container ul.rui-selectable-display{display:block;width:auto;margin-right:2em;overflow:hidden}div.rui-selectable-container ul.rui-selectable-display li{line-height:1.6em;padding:0 .5em}select.rui-selectable{visibility:hidden}</style>');
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 8
10
- version: 1.0.8
9
+ - 9
10
+ version: 1.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nikolay Nemshilov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-11 00:00:00 +04:00
18
+ date: 2010-10-17 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -89,8 +89,8 @@ files:
89
89
  - public/javascripts/right/sortable.js
90
90
  - public/javascripts/right/tabs-src.js
91
91
  - public/javascripts/right/tabs.js
92
- - public/javascripts/right/tooltip-src.js
93
- - public/javascripts/right/tooltip.js
92
+ - public/javascripts/right/tooltips-src.js
93
+ - public/javascripts/right/tooltips.js
94
94
  - public/javascripts/right/uploader-src.js
95
95
  - public/javascripts/right/uploader.js
96
96
  - public/javascripts/right-olds-src.js