puffer 0.0.11 → 0.0.12
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.
- data/VERSION +1 -1
- data/app/helpers/puffer_helper.rb +8 -0
- data/app/views/layouts/puffer.html.erb +5 -11
- data/lib/generators/puffer/install/install_generator.rb +2 -2
- data/lib/generators/puffer/install/templates/puffer.rb +12 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/{application.js → puffer.js} +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/{rails-src.js → rails.js} +0 -0
- data/lib/puffer.rb +14 -0
- data/lib/puffer/controller/mutate.rb +8 -2
- data/lib/puffer/extensions/mapper.rb +2 -2
- data/lib/puffer/inputs.rb +1 -1
- data/lib/puffer/path_set.rb +14 -7
- data/lib/puffer/resource.rb +1 -1
- data/puffer.gemspec +8 -44
- data/spec/dummy/config/initializers/puffer.rb +12 -0
- data/spec/dummy/public/puffer/javascripts/{application.js → puffer.js} +0 -0
- data/spec/dummy/public/puffer/javascripts/{rails-src.js → rails.js} +0 -0
- metadata +10 -46
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-autocompleter-src.js +0 -621
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-autocompleter.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-calendar-src.js +0 -1461
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-calendar.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-in-edit-src.js +0 -369
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-in-edit.js +0 -13
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-in-edit.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-lightbox-src.js +0 -905
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-lightbox.js +0 -24
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-lightbox.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-sortable-src.js +0 -428
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-sortable.js +0 -17
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-sortable.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-src.js +0 -5892
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-tabs-src.js +0 -1145
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-tabs.js +0 -29
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-tabs.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right.js.gz +0 -0
- data/spec/dummy/config/puffer.rb +0 -0
- data/spec/dummy/public/puffer/javascripts/right-autocompleter-src.js +0 -621
- data/spec/dummy/public/puffer/javascripts/right-autocompleter.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-calendar-src.js +0 -1461
- data/spec/dummy/public/puffer/javascripts/right-calendar.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-in-edit-src.js +0 -369
- data/spec/dummy/public/puffer/javascripts/right-in-edit.js +0 -13
- data/spec/dummy/public/puffer/javascripts/right-in-edit.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-lightbox-src.js +0 -905
- data/spec/dummy/public/puffer/javascripts/right-lightbox.js +0 -24
- data/spec/dummy/public/puffer/javascripts/right-lightbox.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-sortable-src.js +0 -428
- data/spec/dummy/public/puffer/javascripts/right-sortable.js +0 -17
- data/spec/dummy/public/puffer/javascripts/right-sortable.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-src.js +0 -5892
- data/spec/dummy/public/puffer/javascripts/right-tabs-src.js +0 -1145
- data/spec/dummy/public/puffer/javascripts/right-tabs.js +0 -29
- data/spec/dummy/public/puffer/javascripts/right-tabs.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right.js.gz +0 -0
| @@ -1,29 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * Tabs widget for RightJS (http://rightjs.org/ui/tabs)
         | 
| 3 | 
            -
             *
         | 
| 4 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 5 | 
            -
             */
         | 
| 6 | 
            -
            var Tabs=RightJS.Tabs=function(n,t,e){function u(){return h(e.Cookie?(v.get("right-tabs-indexes")||"").split(","):[])}function z(a,b,c){if(e.Cookie){var f=u();f=f.without.apply(f,b.map("id"));f.push(c.target.id);v.set("right-tabs-indexes",f.uniq().join(","),a)}}var h=e,r=e.$,A=e.$w,g=e.$E,B=e.Fx,C=e.Object,D=e.Browser,E=e.isArray,F=e.isNumber,w=e.Class,s=e.Element,v=e.Cookie,G=new e.Class(e.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"});this.dots=[];for(var b=0;b<(a||4);b++)this.dots.push(new e.Element("div"));
         | 
| 7 | 
            -
            this.dots[0].addClass("glowing");this.insert(this.dots);e(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a);this.insert(a,"top")}}}),j=new (function(a,b){if(!b){b=a;a="DIV"}var c=new e.Class(e.Element.Wrappers[a]||e.Element,{initialize:function(f,d){this.key=f;var i=[{"class":"rui-"+f}];this instanceof e.Input||this instanceof e.Form||i.unshift(a);this.$super.apply(this,i);if(e.isString(d))d=e.$(d);if(d instanceof e.Element){this._=
         | 
| 8 | 
            -
            d._;if("$listeners"in d)d.$listeners=d.$listeners;d={}}this.setOptions(d,this);return e.Wrapper.Cache[e.$uid(this._)]=this},setOptions:function(f,d){d=d||this;e.Options.setOptions.call(this,e.Object.merge(f,eval("("+(d.get("data-"+this.key)||"{}")+")")));return this}});c=new e.Class(c,b);e.Observer.createShortcuts(c.prototype,c.EVENTS||[]);return c})("UL",{extend:{version:"2.2.0",EVENTS:A("select hide load disable enable add remove move"),Options:{idPrefix:"",tabsElement:null,resizeFx:"both",resizeDuration:400,
         | 
| 9 | 
            -
            scrollTabs:false,scrollDuration:400,selected:null,disabled:null,closable:false,loop:false,loopPause:true,url:false,cache:false,Xhr:null,Cookie:null},rescan:function(a){r(a||n).find(".rui-tabs,*[data-tabs]").each(function(b){b instanceof j||new j(b)})}},initialize:function(a,b){this.$super("tabs",a).setOptions(b).addClass("rui-tabs");this.isHarmonica=this._.tagName==="DL";this.isCarousel=this.hasClass("rui-tabs-carousel");this.isSimple=!this.isHarmonica&&!this.isCarousel;this.findTabs().initScrolls().findCurrent().setStyle("visibility:visible");
         | 
| 10 | 
            -
            this.options.disabled&&this.disable(this.options.disabled);this.options.loop&&this.startLoop()},select:function(a){return this.callTab(a,"select")},disable:function(a){return this.callTab(a,"disable")},enable:function(a){return this.callTab(a,"enable")},current:function(){return this.tabs.first("current")},enabled:function(){return this.tabs.filter("enabled")},callTab:function(a,b){h(E(a)?a:[a]).each(function(c){if(F(c))c=this.tabs[c];c&&c instanceof o&&c[b]()},this);return this},findTabs:function(){this.tabsList=
         | 
| 11 | 
            -
            this.isHarmonica?this:r(this.options.tabsElement)||this.first(".rui-tabs-list")||(this.first("UL")||g("UL").insertTo(this)).addClass("rui-tabs-list");this.tabs=h([]);this.tabsList.children(this.isHarmonica?"dt":null).map(function(c){this.tabs.push(new o(c,this))},this);for(var a=0,b=this.tabsList.get("childNodes");a<b.length;a++)b[a].nodeType==3&&this.tabsList._.removeChild(b[a]);return this}}),o=j.Tab=new w(s,{extend:{autoId:0},initialize:function(a,b){this.$super(a._);this.addClass("rui-tabs-tab");
         | 
| 12 | 
            -
            this.main=b;this.link=this.first("a");this.id=this.link.get("href").split("#")[1]||o.autoId++;this.panel=new H(this.findPanel(),this);this.current()&&this.select();b.options.closable&&this.link.insert(g("div",{"class":"rui-tabs-tab-close-icon",html:"×"}).onClick(h(this.remove).bind(this)));this.onClick(this._clicked)},select:function(){if(this.enabled()){var a=this.main.current();a&&a.removeClass("rui-tabs-current").fire("hide");this.addClass("rui-tabs-current");this.main.scrollToTab(this);
         | 
| 13 | 
            -
            this.panel.show()}return this.fire("select")},disable:function(){return this.addClass("rui-tabs-disabled").fire("disable")},enable:function(){return this.removeClass("rui-tabs-disabled").fire("enable")},disabled:function(){return!this.enabled()},enabled:function(){return!this.hasClass("rui-tabs-disabled")},current:function(){return this.hasClass("rui-tabs-current")},remove:function(a){a&&a.stop();if(this.current()){a=this.main.enabled();(a=a[a.indexOf(this)+1]||a[a.indexOf(this)-1])&&a.select()}this.main.tabs.splice(this.main.tabs.indexOf(this),
         | 
| 14 | 
            -
            1);this.panel.remove();return this.$super().fire("remove")},_clicked:function(a){a.stop();return this.select()},findPanel:function(){var a=this.main,b=a.options.idPrefix+this.id;if(a.isHarmonica)a=(a=this.next())&&a._.tagName==="DD"?a:g("DD").insertTo(this,"after");else a=r(b)||g(a._.tagName==="UL"?"LI":"DIV").insertTo(a);return a.set("id",b)},width:function(){var a=this.next();return a?a.position().x-this.position().x:this.size().x+1}}),H=j.Panel=new w(s,{initialize:function(a,b){this.$super(a._);
         | 
| 15 | 
            -
            this.addClass("rui-tabs-panel");this.tab=b;this.id=this.get("id")},show:function(){return this.resizing(function(){this.tab.main.find(".rui-tabs-panel").each(function(a){a[a===this?"addClass":"removeClass"]("rui-tabs-current")},this)})},update:function(a){this.tab.current()?this.resizing(function(){s.prototype.update.call(this,a||"")}):this.$super(a||"");return this},lock:function(){this.insert(this.locker(),"top")},resizing:function(a){var b=this.tab.main;if(b.__working)return this.resizing.bind(this,
         | 
| 16 | 
            -
            a).delay(100);var c=b.options,f=b.first(".rui-tabs-panel.rui-tabs-current"),d=this,i=f!==d,q=this.first("div.rui-tabs-panel-locker");d.parent().hasClass("rui-tabs-resizer")&&d.insertTo(f.parent());if(c.resizeFx&&e.Fx&&f&&(i||q)){b.__working=true;var m=c.resizeFx==="both"&&q?"slide":c.resizeFx,k=c.resizeDuration;k=B.Durations[k]||k;c=m==="fade"?0:m==="slide"?k:k/2;q=k-c;m!=="slide"&&d.setStyle({opacity:0});k=b.isHarmonica&&i?0:f.size().y;a.call(this);a=d.size().y;var l=null,p=null,x=null;if(m!=="fade"&&
         | 
| 17 | 
            -
            k!==a){b._.style.height=b.size().y+"px";l=g("div",{"class":"rui-tabs-resizer",style:"height: "+k+"px"});if(b.isHarmonica&&i){f.addClass("rui-tabs-current");p=g("div",{"class":"rui-tabs-resizer"});p._.style.height=f.size().y+"px";x=function(){p.replace(f.removeClass("rui-tabs-current"))};f.wrap(p);l._.style.height="0px"}d.wrap(l);b._.style.height="auto"}else{rezise_duration=0;k=q}var y=0;i=function(){if(l){if(m=="both"&&!y)return y++;l.replace(d)}b.__working=false};p&&p.morph({height:"0px"},{duration:c,
         | 
| 18 | 
            -
            onFinish:x});l&&l.morph({height:a+"px"},{duration:c,onFinish:i});m!=="slide"&&d.morph.bind(d,{opacity:1},{duration:q,onFinish:i}).delay(c);!l&&m==="slide"&&i()}else a.call(this);return this},locker:function(){return this._locker||(this._locker=g("div",{"class":"rui-tabs-panel-locker"}).insert(new G(5)))}});j.include({next:function(){return this.pickTab(+1)},prev:function(){return this.pickTab(-1)},scrollLeft:function(){this.prevButton.hasClass("rui-tabs-scroller-disabled")||this[this.isCarousel?"prev":
         | 
| 19 | 
            -
            "justScroll"](+0.6);return this},scrollRight:function(){this.nextButton.hasClass("rui-tabs-scroller-disabled")||this[this.isCarousel?"next":"justScroll"](-0.6);return this},initScrolls:function(){if(this.scrollable=this.options.scrollTabs||this.isCarousel)this.buildScroller();return this},buildScroller:function(){if(!((this.prevButton=this.first(".rui-tabs-scroller-prev"))&&(this.nextButton=this.first(".rui-tabs-scroller-next")))){this.prevButton=g("div",{"class":"rui-tabs-scroller-prev",html:"«"});
         | 
| 20 | 
            -
            this.nextButton=g("div",{"class":"rui-tabs-scroller-next",html:"»"});g("div").insertTo(this.tabsList,"before").replace(g("div",{"class":"rui-tabs-scroller"}).insert([this.prevButton,this.nextButton,this.scroller=g("div",{"class":"rui-tabs-scroller-body"}).insert(this.tabsList)])).remove()}this.prevButton.onClick(h(this.scrollLeft).bind(this));this.nextButton.onClick(h(this.scrollRight).bind(this))},pickTab:function(a){var b=this.current();if(b&&b.enabled()){var c=this.enabled();(a=c[c.indexOf(b)+
         | 
| 21 | 
            -
            a])&&a.select()}},scrollToTab:function(a){if(this.scroller){for(var b=0,c=0;c<this.tabs.length;c++){b+=this.tabs[c].width();if(this.tabs[c]===a)break}c=this.scroller.size().x;var f=(this.isCarousel?c/2+a.width()/2:c)-b;if(!this.isCarousel){var d=t(this.tabsList.getStyle("left")||0,10);if(f>=d&&f<d+c-a.width())f=d;else if(d>-b&&d<=a.width()-b)f=a.width()-b}this.scrollTo(f)}},justScroll:function(a){if(!this.scroller)return this;var b=t(this.tabsList.getStyle("left")||0,10),c=this.scroller.size().x;
         | 
| 22 | 
            -
            this.scrollTo(b+c*a)},scrollTo:function(a){var b=this.scroller.size().x,c=this.tabs.map("width").sum();if(a<b-c)a=b-c;if(a>0)a=0;this.tabsList.morph({left:a+"px"},{duration:this.options.scrollDuration});this.checkScrollButtons(c,b,a)},checkScrollButtons:function(a,b,c){var f=false,d=false;if(this.isCarousel){a=this.enabled();if(b=a.first("current")){d=a.indexOf(b);f=d>0;d=d<a.length-1}}else{f=c!==0;d=c>b-a}this.prevButton[f?"removeClass":"addClass"]("rui-tabs-scroller-disabled");this.nextButton[d?
         | 
| 23 | 
            -
            "removeClass":"addClass"]("rui-tabs-scroller-disabled")}});j.include({findCurrent:function(){var a=this.enabled();(a=this.tabs[this.options.selected]||this.tabs[this.urlIndex()]||this.tabs[this.cookieIndex()]||a.first("current")||a[0])&&a.select();this.options.Cookie&&this.onSelect(h(z).curry(this.options.Cookie,this.tabs));return this},urlIndex:function(){var a=-1,b=n.location.href.split("#")[1];if(b)for(var c=0;c<this.tabs.length;c++)if(this.tabs[c].id==b){a=c;break}return a},cookieIndex:function(){var a=
         | 
| 24 | 
            -
            -1;if(this.options.Cookie)for(var b=u(),c=0;c<this.tabs.length;c++)if(b.include(this.tabs[c].id)){a=c;break}return a}});j.include({add:function(a,b,c){c=c||{};a=g(this.isHarmonica?"dt":"li").insert(g("a",{html:a,href:c.url||"#"+(c.id||"")})).insertTo(this.tabsList);a=new o(a,this);a.panel.update(b||"");this.tabs.push(a);a.fire("add");"position"in c&&this.move(a,c.position);return this},move:function(a,b){a=this.tabs[a]||a;if(this.tabs[b]&&this.tabs[b]!==a){this.tabs[b].insert(a,b===this.tabs.length-
         | 
| 25 | 
            -
            1?"after":"before");this.isHarmonica&&a.insert(a.panel,"after");this.tabs.splice(this.tabs.indexOf(a),1);this.tabs.splice(b,0,a);a.fire("move",{index:b})}return this},remove:function(a){return this.callTab(a,"remove")}});var I=o.prototype.select;o.include({select:function(){if(this.dogPiling(arguments))return this;var a=I.apply(this,arguments),b=h(this.link.get("href")),c=this.main.options;if(b.includes("#"))b=c.url?c.url.replace("%{id}",b.split("#")[1]):null;if(b&&!this.request&&!(c.cache||this.cache)){this.panel.lock();
         | 
| 26 | 
            -
            try{this.request=(new e.Xhr(b,C.merge({method:"get"},c.Xhr))).onComplete(h(function(d){if(this.main.__working)return arguments.callee.bind(this,d).delay(100);this.panel.update(d.text);this.request=null;if(c.cache)this.cache=true;this.fire("load")}).bind(this)).send()}catch(f){if(!D.OLD)throw f;}}return a},dogPiling:function(a){if(this.main.__working){this.main.__timeout&&this.main.__timeout.cancel();this.main.__timeout=h(function(b){this.select.apply(this,b)}).bind(this,a).delay(100);return true}return this.main.__timeout=
         | 
| 27 | 
            -
            null}});j.include({startLoop:function(a){if(!a&&!this.options.loop)return this;if(this.options.loopPause){this._stopLoop=this._stopLoop||h(this.stopLoop).bind(this,true);this._startLoop=this._startLoop||h(this.startLoop).bind(this,a);this.forgetHovers().on({mouseover:this._stopLoop,mouseout:this._startLoop})}this.timer&&this.timer.stop();this.timer=h(function(){var b=this.enabled(),c=this.current();this.select(b[b.indexOf(c)+1]||b.first())}).bind(this).periodical(this.options.loop||a);return this},
         | 
| 28 | 
            -
            stopLoop:function(a,b){if(this.timer){this.timer.stop();this.timer=null}!b&&this._startLoop&&this.forgetHovers()},forgetHovers:function(){return this.stopObserving("mouseover",this._stopLoop).stopObserving("mouseout",this._startLoop)}});r(n).onReady(function(){j.rescan()});(function(){var a=n.createElement("style"),b=n.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}.rui-tabs,.rui-tabs-list,.rui-tabs-tab,.rui-tabs-panel,.rui-tabs-scroll-left,.rui-tabs-scroll-right,.rui-tabs-scroll-body,.rui-tabs-panel-locker,.rui-tabs-resizer{margin:0;padding:0;background:none;border:none;list-style:none;display:block;width:auto;height:auto}.rui-tabs{display:block;visibility:hidden;border-bottom:1px solid #CCC}.rui-tabs-resizer{overflow:hidden}.rui-tabs-list{display:block;position:relative;padding:0 .5em;border-bottom:1px solid #CCC;white-space:nowrap}.rui-tabs-list .rui-tabs-tab,.rui-tabs-tab *,.rui-tabs-tab *:hover{display:inline-block; *display:inline; *zoom:1;cursor:pointer;text-decoration:none;vertical-align:center}.rui-tabs-list .rui-tabs-tab{vertical-align:bottom;margin-right:.1em}.rui-tabs-tab a{outline:none;position:relative;border:1px solid #CCC;background:#DDD;color:#444;padding:.3em 1em;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0}.rui-tabs-tab a:hover{border-color:#CCC;background:#EEE}.rui-tabs-list .rui-tabs-current a,.rui-tabs-list .rui-tabs-current a:hover{font-weight:bold;color:#000;background:#FFF;border-bottom:1px solid #FFF;border-top-width:2px;padding-top:.34em;padding-bottom:.34em;top:1px}.rui-tabs-tab a img{border:none;opacity:.6;filter:alpha(opacity=60)}.rui-tabs-tab a:hover img,.rui-tabs-list .rui-tabs-current a img{opacity:1;filter:alpha(opacity=100)}.rui-tabs-disabled a,.rui-tabs-disabled a:hover{background:#EEE;border-color:#DDD;color:#AAA;cursor:default}.rui-tabs-disabled a img,.rui-tabs-disabled a:hover img{opacity:.5;filter:alpha(opacity=50)}.rui-tabs-tab-close-icon{display:inline-block; *display:inline; *zoom:1;margin-right:-0.5em;margin-left:0.5em;cursor:pointer;opacity:0.5;filter:alpha(opacity=50)}.rui-tabs-tab-close-icon:hover{opacity:1;filter:alpha(opacity=100);color:#B00;text-shadow:#888 .15em .15em .2em}.rui-tabs-panel{display:none;position:relative;min-height:4em;padding:.5em 0}.rui-tabs-current{display:block}.rui-tabs-scroller{position:relative;padding:0 1.4em}.rui-tabs-scroller-prev,.rui-tabs-scroller-next{width:1.1em;text-align:center;background:#EEE;color:#666;cursor:pointer;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:absolute;bottom:0px;left:0px;padding:0.3em 0;user-select:none;-moz-user-select:none;-webkit-user-select:none}.rui-tabs-scroller-prev:hover,.rui-tabs-scroller-next:hover{color:#000;background:#DDD;border-color:#AAA}.rui-tabs-scroller-prev:active,.rui-tabs-scroller-next:active{background:#eee;border-color:#ccc}.rui-tabs-scroller-next{left:auto;right:0px}.rui-tabs-scroller-disabled,.rui-tabs-scroller-disabled:hover{cursor:default;background:#DDD;border-color:#DDD;color:#AAA}.rui-tabs-scroller-body{overflow:hidden;width:100%;position:relative}.rui-tabs-scroller .rui-tabs-list{padding-left:0;padding-right:0;width:9999em;z-index:10}.rui-tabs-panel-locker{position:absolute;top:0px;left:0px;opacity:0.5;filter:alpha(opacity=50);background:#CCC;width:100%;height:100%;text-align:center}.rui-tabs-panel-locker .rui-spinner{position:absolute;left:44%;top:44%;background:none;border:none;height:2em}.rui-tabs-panel-locker .rui-spinner div{background:#666;width:.65em;margin-left:.15em}.rui-tabs-panel-locker .rui-spinner div.glowing{background:#000}.rui-tabs-carousel .rui-tabs-list{border:none}.rui-tabs-carousel .rui-tabs-tab a,.rui-tabs-carousel .rui-tabs-scroller .rui-tabs-scroller-prev,.rui-tabs-carousel .rui-tabs-scroller .rui-tabs-scroller-next{height:6em;line-height:6em;padding:0;border-bottom:1px solid #ccc;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em}.rui-tabs-carousel .rui-tabs-tab{margin-right:3px}.rui-tabs-carousel .rui-tabs-tab a img{border:1px solid #CCC;vertical-align:middle;margin:.4em;padding:0;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0}.rui-tabs-carousel .rui-tabs-list .rui-tabs-current a{border-width:1px;border-color:#AAA;padding:0;top:auto}.rui-tabs-carousel .rui-tabs-list .rui-tabs-current a img{border-color:#bbb}.rui-tabs-carousel .rui-tabs-panel{text-align:center}dl.rui-tabs{border:none}dt.rui-tabs-tab,dt.rui-tabs-tab a,dt.rui-tabs-tab a:hover{display:block;float:none}dt.rui-tabs-tab a,dt.rui-tabs-tab a:hover{padding:.2em 1em;border:1px solid #ccc;border-radius:.25em;-moz-border-radius:.3em;-webkit-border-radius:.3em}dl.rui-tabs dt.rui-tabs-current a{background:#EEE;border-bottom-left-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0}dl.rui-tabs dd.rui-tabs-current+dt.rui-tabs-tab a{border-top-left-radius:0;border-top-right-radius:0;-moz-border-radius-topleft:0;-moz-border-radius-topright:0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:0}");
         | 
| 29 | 
            -
            a.type="text/css";if(a.styleSheet)a.styleSheet.cssText=b.nodeValue;else a.appendChild(b);n.getElementsByTagName("head")[0].appendChild(a)})();return j}(document,parseInt,RightJS);
         | 
| Binary file | 
| Binary file | 
    
        data/spec/dummy/config/puffer.rb
    DELETED
    
    | 
            File without changes
         | 
| @@ -1,621 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * RightJS-UI: Autocompleter
         | 
| 3 | 
            -
             * http://rightjs.org/ui/autocompleter
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 6 | 
            -
             */
         | 
| 7 | 
            -
            var Autocompleter = RightJS.Autocompleter = (function(document, RightJS) {
         | 
| 8 | 
            -
            /**
         | 
| 9 | 
            -
             * This module defines the basic widgets constructor
         | 
| 10 | 
            -
             * it creates an abstract proxy with the common functionality
         | 
| 11 | 
            -
             * which then we reuse and override in the actual widgets
         | 
| 12 | 
            -
             *
         | 
| 13 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 14 | 
            -
             */
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            /**
         | 
| 17 | 
            -
             * Autocompleter initializer
         | 
| 18 | 
            -
             *
         | 
| 19 | 
            -
             * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 20 | 
            -
             */
         | 
| 21 | 
            -
            var R       = RightJS,
         | 
| 22 | 
            -
                $       = RightJS.$,
         | 
| 23 | 
            -
                $w      = RightJS.$w,
         | 
| 24 | 
            -
                $E      = RightJS.$E,
         | 
| 25 | 
            -
                Xhr     = RightJS.Xhr,
         | 
| 26 | 
            -
                RegExp  = RightJS.RegExp,
         | 
| 27 | 
            -
                isArray = RightJS.isArray;
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
            /**
         | 
| 37 | 
            -
             * The widget units constructor
         | 
| 38 | 
            -
             *
         | 
| 39 | 
            -
             * @param String tag-name or Object methods
         | 
| 40 | 
            -
             * @param Object methods
         | 
| 41 | 
            -
             * @return Widget wrapper
         | 
| 42 | 
            -
             */
         | 
| 43 | 
            -
            function Widget(tag_name, methods) {
         | 
| 44 | 
            -
              if (!methods) {
         | 
| 45 | 
            -
                methods = tag_name;
         | 
| 46 | 
            -
                tag_name = 'DIV';
         | 
| 47 | 
            -
              }
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              /**
         | 
| 50 | 
            -
               * An Abstract Widget Unit
         | 
| 51 | 
            -
               *
         | 
| 52 | 
            -
               * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 53 | 
            -
               */
         | 
| 54 | 
            -
              var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
         | 
| 55 | 
            -
                /**
         | 
| 56 | 
            -
                 * The common constructor
         | 
| 57 | 
            -
                 *
         | 
| 58 | 
            -
                 * @param Object options
         | 
| 59 | 
            -
                 * @param String optional tag name
         | 
| 60 | 
            -
                 * @return void
         | 
| 61 | 
            -
                 */
         | 
| 62 | 
            -
                initialize: function(key, options) {
         | 
| 63 | 
            -
                  this.key = key;
         | 
| 64 | 
            -
                  var args = [{'class': 'rui-' + key}];
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                  // those two have different constructors
         | 
| 67 | 
            -
                  if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
         | 
| 68 | 
            -
                    args.unshift(tag_name);
         | 
| 69 | 
            -
                  }
         | 
| 70 | 
            -
                  this.$super.apply(this, args);
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                  if (RightJS.isString(options)) {
         | 
| 73 | 
            -
                    options = RightJS.$(options);
         | 
| 74 | 
            -
                  }
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                  // if the options is another element then
         | 
| 77 | 
            -
                  // try to dynamically rewrap it with our widget
         | 
| 78 | 
            -
                  if (options instanceof RightJS.Element) {
         | 
| 79 | 
            -
                    this._ = options._;
         | 
| 80 | 
            -
                    if ('$listeners' in options) {
         | 
| 81 | 
            -
                      options.$listeners = options.$listeners;
         | 
| 82 | 
            -
                    }
         | 
| 83 | 
            -
                    options = {};
         | 
| 84 | 
            -
                  }
         | 
| 85 | 
            -
                  this.setOptions(options, this);
         | 
| 86 | 
            -
             | 
| 87 | 
            -
                  return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
         | 
| 88 | 
            -
                },
         | 
| 89 | 
            -
             | 
| 90 | 
            -
              // protected
         | 
| 91 | 
            -
             | 
| 92 | 
            -
                /**
         | 
| 93 | 
            -
                 * Catches the options
         | 
| 94 | 
            -
                 *
         | 
| 95 | 
            -
                 * @param Object user-options
         | 
| 96 | 
            -
                 * @param Element element with contextual options
         | 
| 97 | 
            -
                 * @return void
         | 
| 98 | 
            -
                 */
         | 
| 99 | 
            -
                setOptions: function(options, element) {
         | 
| 100 | 
            -
                  element = element || this;
         | 
| 101 | 
            -
                  RightJS.Options.setOptions.call(this,
         | 
| 102 | 
            -
                    RightJS.Object.merge(options, eval("("+(
         | 
| 103 | 
            -
                      element.get('data-'+ this.key) || '{}'
         | 
| 104 | 
            -
                    )+")"))
         | 
| 105 | 
            -
                  );
         | 
| 106 | 
            -
                  return this;
         | 
| 107 | 
            -
                }
         | 
| 108 | 
            -
              });
         | 
| 109 | 
            -
             | 
| 110 | 
            -
              /**
         | 
| 111 | 
            -
               * Creating the actual widget class
         | 
| 112 | 
            -
               *
         | 
| 113 | 
            -
               */
         | 
| 114 | 
            -
              var Klass = new RightJS.Class(AbstractWidget, methods);
         | 
| 115 | 
            -
             | 
| 116 | 
            -
              // creating the widget related shortcuts
         | 
| 117 | 
            -
              RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
         | 
| 118 | 
            -
             | 
| 119 | 
            -
              return Klass;
         | 
| 120 | 
            -
            }
         | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
            /**
         | 
| 124 | 
            -
             * A shared module to create textual spinners
         | 
| 125 | 
            -
             *
         | 
| 126 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 127 | 
            -
             */
         | 
| 128 | 
            -
            var Spinner = new RightJS.Class(RightJS.Element, {
         | 
| 129 | 
            -
              /**
         | 
| 130 | 
            -
               * Constructor
         | 
| 131 | 
            -
               *
         | 
| 132 | 
            -
               * @param Number optional spinner size (4 by default)
         | 
| 133 | 
            -
               * @return void
         | 
| 134 | 
            -
               */
         | 
| 135 | 
            -
              initialize: function(size) {
         | 
| 136 | 
            -
                this.$super('div', {'class': 'rui-spinner'});
         | 
| 137 | 
            -
                this.dots = [];
         | 
| 138 | 
            -
             | 
| 139 | 
            -
                for (var i=0; i < (size || 4); i++) {
         | 
| 140 | 
            -
                  this.dots.push(new RightJS.Element('div'));
         | 
| 141 | 
            -
                }
         | 
| 142 | 
            -
             | 
| 143 | 
            -
                this.dots[0].addClass('glowing');
         | 
| 144 | 
            -
                this.insert(this.dots);
         | 
| 145 | 
            -
                RightJS(this.shift).bind(this).periodical(300);
         | 
| 146 | 
            -
              },
         | 
| 147 | 
            -
             | 
| 148 | 
            -
              /**
         | 
| 149 | 
            -
               * Shifts the spinner elements
         | 
| 150 | 
            -
               *
         | 
| 151 | 
            -
               * @return void
         | 
| 152 | 
            -
               */
         | 
| 153 | 
            -
              shift: function() {
         | 
| 154 | 
            -
                if (this.visible()) {
         | 
| 155 | 
            -
                  var dot = this.dots.pop();
         | 
| 156 | 
            -
                  this.dots.unshift(dot);
         | 
| 157 | 
            -
                  this.insert(dot, 'top');
         | 
| 158 | 
            -
                }
         | 
| 159 | 
            -
              }
         | 
| 160 | 
            -
            });
         | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 163 | 
            -
            /**
         | 
| 164 | 
            -
             * A shared module that toggles a widget visibility status
         | 
| 165 | 
            -
             * in a uniformed way according to the options settings
         | 
| 166 | 
            -
             *
         | 
| 167 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 168 | 
            -
             */
         | 
| 169 | 
            -
            var Toggler = {
         | 
| 170 | 
            -
              /**
         | 
| 171 | 
            -
               * Shows the element
         | 
| 172 | 
            -
               *
         | 
| 173 | 
            -
               * @param String fx-name
         | 
| 174 | 
            -
               * @param Object fx-options
         | 
| 175 | 
            -
               * @return Element this
         | 
| 176 | 
            -
               */
         | 
| 177 | 
            -
              show: function(fx_name, fx_options) {
         | 
| 178 | 
            -
                this.constructor.current = this;
         | 
| 179 | 
            -
                return Toggler_toggle(this, 'show', fx_name, fx_options);
         | 
| 180 | 
            -
              },
         | 
| 181 | 
            -
             | 
| 182 | 
            -
              /**
         | 
| 183 | 
            -
               * Hides the element
         | 
| 184 | 
            -
               *
         | 
| 185 | 
            -
               * @param String fx-name
         | 
| 186 | 
            -
               * @param Object fx-options
         | 
| 187 | 
            -
               * @return Element this
         | 
| 188 | 
            -
               */
         | 
| 189 | 
            -
              hide: function(fx_name, fx_options) {
         | 
| 190 | 
            -
                this.constructor.current = null;
         | 
| 191 | 
            -
                return Toggler_toggle(this, 'show', fx_name, fx_options);
         | 
| 192 | 
            -
              },
         | 
| 193 | 
            -
             | 
| 194 | 
            -
              /**
         | 
| 195 | 
            -
               * Toggles the widget at the given element
         | 
| 196 | 
            -
               *
         | 
| 197 | 
            -
               * @param Element the related element
         | 
| 198 | 
            -
               * @param String position right/bottom (bottom is the default)
         | 
| 199 | 
            -
               * @param Boolean marker if the element should be resized to the element size
         | 
| 200 | 
            -
               * @return Widget this
         | 
| 201 | 
            -
               */
         | 
| 202 | 
            -
              showAt: function(element, where, resize) {
         | 
| 203 | 
            -
                this.hide(null).shownAt = element = RightJS.$(element);
         | 
| 204 | 
            -
             | 
| 205 | 
            -
                // moves this element at the given one
         | 
| 206 | 
            -
                Toggler_re_position.call(this, element, where, resize);
         | 
| 207 | 
            -
             | 
| 208 | 
            -
                return this.show();
         | 
| 209 | 
            -
              },
         | 
| 210 | 
            -
             | 
| 211 | 
            -
              /**
         | 
| 212 | 
            -
               * Toggles the widget at the given element
         | 
| 213 | 
            -
               *
         | 
| 214 | 
            -
               * @param Element the related element
         | 
| 215 | 
            -
               * @param String position top/left/right/bottom (bottom is the default)
         | 
| 216 | 
            -
               * @param Boolean marker if the element should be resized to the element size
         | 
| 217 | 
            -
               * @return Widget this
         | 
| 218 | 
            -
               */
         | 
| 219 | 
            -
              toggleAt: function(element, where, resize) {
         | 
| 220 | 
            -
                return this.hidden() ? this.showAt(element, where, resize) : this.hide();
         | 
| 221 | 
            -
              }
         | 
| 222 | 
            -
            };
         | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 225 | 
            -
            /**
         | 
| 226 | 
            -
             * toggles the element's state according to the current settings
         | 
| 227 | 
            -
             *
         | 
| 228 | 
            -
             * @param event String 'show' or 'hide' the event name
         | 
| 229 | 
            -
             * @param String an optional fx-name
         | 
| 230 | 
            -
             * @param Object an optional fx-options hash
         | 
| 231 | 
            -
             * @return void
         | 
| 232 | 
            -
             */
         | 
| 233 | 
            -
            function Toggler_toggle(element, event, fx_name, fx_options) {
         | 
| 234 | 
            -
              if (RightJS.Fx) {
         | 
| 235 | 
            -
                if (fx_name === undefined) {
         | 
| 236 | 
            -
                  fx_name = element.options.fxName;
         | 
| 237 | 
            -
             | 
| 238 | 
            -
                  if (fx_options === undefined) {
         | 
| 239 | 
            -
                    fx_options = {
         | 
| 240 | 
            -
                      duration: element.options.fxDuration,
         | 
| 241 | 
            -
                      onFinish: RightJS(element.fire).bind(element, event)
         | 
| 242 | 
            -
                    };
         | 
| 243 | 
            -
             | 
| 244 | 
            -
                    // hide on double time
         | 
| 245 | 
            -
                    if (event === 'hide') {
         | 
| 246 | 
            -
                      fx_options.duration = (RightJS.Fx.Durations[fx_options.duration] ||
         | 
| 247 | 
            -
                        fx_options.duration) / 2;
         | 
| 248 | 
            -
                    }
         | 
| 249 | 
            -
                  }
         | 
| 250 | 
            -
                }
         | 
| 251 | 
            -
              }
         | 
| 252 | 
            -
             | 
| 253 | 
            -
              // manually trigger the event if no fx were specified
         | 
| 254 | 
            -
              if (!RightJS.Fx || !fx_name) { element.fire(event); }
         | 
| 255 | 
            -
             | 
| 256 | 
            -
              return element.$super(fx_name, fx_options);
         | 
| 257 | 
            -
            }
         | 
| 258 | 
            -
             | 
| 259 | 
            -
            /**
         | 
| 260 | 
            -
             * Relatively positions the current element
         | 
| 261 | 
            -
             * against the specified one
         | 
| 262 | 
            -
             *
         | 
| 263 | 
            -
             * NOTE: this function is called in a context
         | 
| 264 | 
            -
             *       of another element
         | 
| 265 | 
            -
             *
         | 
| 266 | 
            -
             * @param Element the target element
         | 
| 267 | 
            -
             * @param String position 'right' or 'bottom'
         | 
| 268 | 
            -
             * @param Boolean if `true` then the element size will be adjusted
         | 
| 269 | 
            -
             * @return void
         | 
| 270 | 
            -
             */
         | 
| 271 | 
            -
            function Toggler_re_position(element, where, resize) {
         | 
| 272 | 
            -
              var anchor = this.reAnchor || (this.reAnchor =
         | 
| 273 | 
            -
                    new RightJS.Element('div', {'class': 'rui-re-anchor'}))
         | 
| 274 | 
            -
                    .insert(this),
         | 
| 275 | 
            -
             | 
| 276 | 
            -
                  pos  = anchor.insertTo(element, 'after').position(),
         | 
| 277 | 
            -
                  dims = element.dimensions(), target = this,
         | 
| 278 | 
            -
             | 
| 279 | 
            -
                  border_top    = parseInt(element.getStyle('borderTopWidth')),
         | 
| 280 | 
            -
                  border_left   = parseInt(element.getStyle('borderLeftWidth')),
         | 
| 281 | 
            -
                  border_right  = parseInt(element.getStyle('borderRightWidth')),
         | 
| 282 | 
            -
                  border_bottom = parseInt(element.getStyle('borderBottomWidth')),
         | 
| 283 | 
            -
             | 
| 284 | 
            -
                  top    = dims.top    - pos.y       + border_top,
         | 
| 285 | 
            -
                  left   = dims.left   - pos.x       + border_left,
         | 
| 286 | 
            -
                  width  = dims.width  - border_left - border_right,
         | 
| 287 | 
            -
                  height = dims.height - border_top  - border_bottom;
         | 
| 288 | 
            -
             | 
| 289 | 
            -
              // making the element to appear so we could read it's sizes
         | 
| 290 | 
            -
              target.setStyle('visibility:hidden').show(null);
         | 
| 291 | 
            -
             | 
| 292 | 
            -
              if (where === 'right') {
         | 
| 293 | 
            -
                left += width - target.size().x;
         | 
| 294 | 
            -
              } else {  // bottom
         | 
| 295 | 
            -
                top  += height;
         | 
| 296 | 
            -
              }
         | 
| 297 | 
            -
             | 
| 298 | 
            -
              target.moveTo(left, top);
         | 
| 299 | 
            -
             | 
| 300 | 
            -
              if (resize) {
         | 
| 301 | 
            -
                if (where === 'left' || where === 'right') {
         | 
| 302 | 
            -
                  target.setHeight(height);
         | 
| 303 | 
            -
                } else {
         | 
| 304 | 
            -
                  target.setWidth(width);
         | 
| 305 | 
            -
                }
         | 
| 306 | 
            -
              }
         | 
| 307 | 
            -
             | 
| 308 | 
            -
              // rolling the invisibility back
         | 
| 309 | 
            -
              target.setStyle('visibility:visible').hide(null);
         | 
| 310 | 
            -
            }
         | 
| 311 | 
            -
             | 
| 312 | 
            -
            /**
         | 
| 313 | 
            -
             * The RightJS UI Autocompleter unit base class
         | 
| 314 | 
            -
             *
         | 
| 315 | 
            -
             * Copyright (C) 2009-2011 Nikolay Nemshilov
         | 
| 316 | 
            -
             */
         | 
| 317 | 
            -
            var Autocompleter = new Widget('UL', {
         | 
| 318 | 
            -
              include: Toggler,
         | 
| 319 | 
            -
             | 
| 320 | 
            -
              extend: {
         | 
| 321 | 
            -
                version: '2.2.0',
         | 
| 322 | 
            -
             | 
| 323 | 
            -
                EVENTS: $w('show hide update load select done'),
         | 
| 324 | 
            -
             | 
| 325 | 
            -
                Options: {
         | 
| 326 | 
            -
                  url:        document.location.href,
         | 
| 327 | 
            -
                  param:      'search',
         | 
| 328 | 
            -
                  method:     'get',
         | 
| 329 | 
            -
             | 
| 330 | 
            -
                  minLength:  1,         // the minimal length when it starts work
         | 
| 331 | 
            -
                  threshold:  200,       // the typing pause threshold
         | 
| 332 | 
            -
             | 
| 333 | 
            -
                  cache:      true,      // use the results cache
         | 
| 334 | 
            -
                  local:      null,      // an optional local search results list
         | 
| 335 | 
            -
             | 
| 336 | 
            -
                  fxName:     'slide',   // list appearance fx name
         | 
| 337 | 
            -
                  fxDuration: 'short',   // list appearance fx duration
         | 
| 338 | 
            -
             | 
| 339 | 
            -
                  spinner:    'native',  // spinner element reference
         | 
| 340 | 
            -
             | 
| 341 | 
            -
                  cssRule:    'input[data-autocompleter]' // the auto-initialization css-rule
         | 
| 342 | 
            -
                }
         | 
| 343 | 
            -
              },
         | 
| 344 | 
            -
             | 
| 345 | 
            -
              /**
         | 
| 346 | 
            -
               * basic constructor
         | 
| 347 | 
            -
               *
         | 
| 348 | 
            -
               * @param mixed the input element reference, a string id or the element instance
         | 
| 349 | 
            -
               * @param Object options
         | 
| 350 | 
            -
               */
         | 
| 351 | 
            -
              initialize: function(input, options) {
         | 
| 352 | 
            -
                this.input = $(input); // KEEP IT before the super call
         | 
| 353 | 
            -
             | 
| 354 | 
            -
                this
         | 
| 355 | 
            -
                  .$super('autocompleter', options)
         | 
| 356 | 
            -
                  .addClass('rui-dd-menu')
         | 
| 357 | 
            -
                  .onMousedown(this.clicked);
         | 
| 358 | 
            -
             | 
| 359 | 
            -
                this.input.autocompleter = this;
         | 
| 360 | 
            -
              },
         | 
| 361 | 
            -
             | 
| 362 | 
            -
              /**
         | 
| 363 | 
            -
               * Destructor
         | 
| 364 | 
            -
               *
         | 
| 365 | 
            -
               * @return Autocompleter this
         | 
| 366 | 
            -
               */
         | 
| 367 | 
            -
              destroy: function() {
         | 
| 368 | 
            -
                delete(this.input.autocompleter);
         | 
| 369 | 
            -
                return this;
         | 
| 370 | 
            -
              },
         | 
| 371 | 
            -
             | 
| 372 | 
            -
              /**
         | 
| 373 | 
            -
               * picks the next item on the list
         | 
| 374 | 
            -
               *
         | 
| 375 | 
            -
               * @return Autocompleter this
         | 
| 376 | 
            -
               */
         | 
| 377 | 
            -
              prev: function() {
         | 
| 378 | 
            -
                return this.pick('prev');
         | 
| 379 | 
            -
              },
         | 
| 380 | 
            -
             | 
| 381 | 
            -
              /**
         | 
| 382 | 
            -
               * picks the next item on the list
         | 
| 383 | 
            -
               *
         | 
| 384 | 
            -
               * @return Autocompleter this
         | 
| 385 | 
            -
               */
         | 
| 386 | 
            -
              next: function() {
         | 
| 387 | 
            -
                return this.pick('next');
         | 
| 388 | 
            -
              },
         | 
| 389 | 
            -
             | 
| 390 | 
            -
              /**
         | 
| 391 | 
            -
               * triggers the done event, sets up the value and closes the list
         | 
| 392 | 
            -
               *
         | 
| 393 | 
            -
               * @return Autocompleter this
         | 
| 394 | 
            -
               */
         | 
| 395 | 
            -
              done: function(current) {
         | 
| 396 | 
            -
                current = current || this.first('li.current');
         | 
| 397 | 
            -
             | 
| 398 | 
            -
                if (current) {
         | 
| 399 | 
            -
                  current.radioClass('current');
         | 
| 400 | 
            -
                  this.input.setValue(R(current.html()).stripTags());
         | 
| 401 | 
            -
                  this.fire('done');
         | 
| 402 | 
            -
                }
         | 
| 403 | 
            -
             | 
| 404 | 
            -
                return this.hide();
         | 
| 405 | 
            -
              },
         | 
| 406 | 
            -
             | 
| 407 | 
            -
            // protected
         | 
| 408 | 
            -
             | 
| 409 | 
            -
              // preprocessing the urls a bit
         | 
| 410 | 
            -
              setOptions: function(options) {
         | 
| 411 | 
            -
                this.$super(options, this.input);
         | 
| 412 | 
            -
             | 
| 413 | 
            -
                options = this.options;
         | 
| 414 | 
            -
             | 
| 415 | 
            -
                // building the correct url template with a placeholder
         | 
| 416 | 
            -
                if (!R(options.url).includes('%{search}')) {
         | 
| 417 | 
            -
                  options.url += (R(options.url).includes('?') ? '&' : '?') + options.param + '=%{search}';
         | 
| 418 | 
            -
                }
         | 
| 419 | 
            -
              },
         | 
| 420 | 
            -
             | 
| 421 | 
            -
              // works with the 'prev' and 'next' methods
         | 
| 422 | 
            -
              pick: function(which_one) {
         | 
| 423 | 
            -
                var items   = this.children(),
         | 
| 424 | 
            -
                    current = items.first('hasClass', 'current'),
         | 
| 425 | 
            -
                    index   = items.indexOf(current);
         | 
| 426 | 
            -
             | 
| 427 | 
            -
                if (which_one == 'prev') {
         | 
| 428 | 
            -
                  current = index < 1 ? items.last() : items[index < 0 ? 0 : (index-1)];
         | 
| 429 | 
            -
                } else if (which_one == 'next') {
         | 
| 430 | 
            -
                  current = index < 0 || index == (items.length - 1) ?
         | 
| 431 | 
            -
                    items.first() : items[index + 1];
         | 
| 432 | 
            -
                }
         | 
| 433 | 
            -
             | 
| 434 | 
            -
                return this.fire('select', {item: current.radioClass('current')});
         | 
| 435 | 
            -
              },
         | 
| 436 | 
            -
             | 
| 437 | 
            -
              // handles mouse clicks on the list element
         | 
| 438 | 
            -
              clicked: function(event) {
         | 
| 439 | 
            -
                this.done(event.stop().find('li'));
         | 
| 440 | 
            -
              },
         | 
| 441 | 
            -
             | 
| 442 | 
            -
              // handles the key-press events
         | 
| 443 | 
            -
              keypressed: function(event) {
         | 
| 444 | 
            -
                if (this.input.value().length >= this.options.minLength) {
         | 
| 445 | 
            -
                  if (this.timeout) {
         | 
| 446 | 
            -
                    this.timeout.cancel();
         | 
| 447 | 
            -
                  }
         | 
| 448 | 
            -
                  this.timeout = R(this.trigger).bind(this).delay(this.options.threshold);
         | 
| 449 | 
            -
                } else {
         | 
| 450 | 
            -
                  return this.hide();
         | 
| 451 | 
            -
                }
         | 
| 452 | 
            -
              },
         | 
| 453 | 
            -
             | 
| 454 | 
            -
              // triggers the actual action
         | 
| 455 | 
            -
              trigger: function() {
         | 
| 456 | 
            -
                this.timeout = null;
         | 
| 457 | 
            -
             | 
| 458 | 
            -
                this.cache = this.cache || {};
         | 
| 459 | 
            -
                var search = this.input.value(), options = this.options;
         | 
| 460 | 
            -
             | 
| 461 | 
            -
                if (search.length < options.minLength) { return this.hide(); }
         | 
| 462 | 
            -
             | 
| 463 | 
            -
                if (this.cache[search]) {
         | 
| 464 | 
            -
                  this.suggest(this.cache[search], search);
         | 
| 465 | 
            -
                } else if (isArray(options.local)) {
         | 
| 466 | 
            -
                  this.suggest(this.findLocal(search), search);
         | 
| 467 | 
            -
                } else {
         | 
| 468 | 
            -
                  this.request = Xhr.load(options.url.replace('%{search}', encodeURIComponent(search)), {
         | 
| 469 | 
            -
                    method:  options.method,
         | 
| 470 | 
            -
                    spinner: this.getSpinner(),
         | 
| 471 | 
            -
                    onComplete: R(function(response) {
         | 
| 472 | 
            -
                      this.fire('load').suggest(response.text, search);
         | 
| 473 | 
            -
                    }).bind(this)
         | 
| 474 | 
            -
                  });
         | 
| 475 | 
            -
                }
         | 
| 476 | 
            -
              },
         | 
| 477 | 
            -
             | 
| 478 | 
            -
              // updates the suggestions list
         | 
| 479 | 
            -
              suggest: function(result_text, search) {
         | 
| 480 | 
            -
                // saving the result in cache
         | 
| 481 | 
            -
                if (this.options.cache) {
         | 
| 482 | 
            -
                  this.cache[search] = result_text;
         | 
| 483 | 
            -
                }
         | 
| 484 | 
            -
             | 
| 485 | 
            -
                if (!R(result_text).blank()) {
         | 
| 486 | 
            -
                  this.update(result_text.replace(/<ul[^>]*>|<\/ul>/im, ''));
         | 
| 487 | 
            -
                  this.fire('update');
         | 
| 488 | 
            -
                  if (!this._connected || this.hidden()) {
         | 
| 489 | 
            -
                    this.showAt(this.input, 'bottom', 'resize');
         | 
| 490 | 
            -
                    this._connected = true;
         | 
| 491 | 
            -
                  }
         | 
| 492 | 
            -
                } else {
         | 
| 493 | 
            -
                  this.hide();
         | 
| 494 | 
            -
                }
         | 
| 495 | 
            -
             | 
| 496 | 
            -
                return this;
         | 
| 497 | 
            -
              },
         | 
| 498 | 
            -
             | 
| 499 | 
            -
              // performs the locals search
         | 
| 500 | 
            -
              findLocal: function(search) {
         | 
| 501 | 
            -
                var regexp  = new RegExp("("+RegExp.escape(search)+")", 'ig');
         | 
| 502 | 
            -
             | 
| 503 | 
            -
                return R(this.options.local).map(function(option) {
         | 
| 504 | 
            -
                  if (option.match(regexp)) {
         | 
| 505 | 
            -
                    return '<li>'+ option.replace(regexp, '<strong>$1</strong>') +'</li>';
         | 
| 506 | 
            -
                  }
         | 
| 507 | 
            -
                }).compact().join('');
         | 
| 508 | 
            -
              },
         | 
| 509 | 
            -
             | 
| 510 | 
            -
              // builds a native textual spinner if necessary
         | 
| 511 | 
            -
              getSpinner: function() {
         | 
| 512 | 
            -
                var options = this.options, spinner = options.spinner;
         | 
| 513 | 
            -
             | 
| 514 | 
            -
                if (spinner == 'native') {
         | 
| 515 | 
            -
                  spinner = options.spinner = new Spinner(3).insertTo(this);
         | 
| 516 | 
            -
                  spinner.addClass('rui-autocompleter-spinner');
         | 
| 517 | 
            -
                }
         | 
| 518 | 
            -
             | 
| 519 | 
            -
                // positioning the native spinner
         | 
| 520 | 
            -
                if (spinner instanceof Spinner) {
         | 
| 521 | 
            -
                  Toggler_re_position.call(spinner, this.input, 'right', 'resize');
         | 
| 522 | 
            -
                }
         | 
| 523 | 
            -
             | 
| 524 | 
            -
                return spinner;
         | 
| 525 | 
            -
              }
         | 
| 526 | 
            -
            });
         | 
| 527 | 
            -
             | 
| 528 | 
            -
             | 
| 529 | 
            -
            /**
         | 
| 530 | 
            -
             * The document events hooking
         | 
| 531 | 
            -
             *
         | 
| 532 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 533 | 
            -
             */
         | 
| 534 | 
            -
            $(document).on({
         | 
| 535 | 
            -
              /**
         | 
| 536 | 
            -
               * Initializes autocompleters on-focus
         | 
| 537 | 
            -
               *
         | 
| 538 | 
            -
               * @param Event focus
         | 
| 539 | 
            -
               * @return void
         | 
| 540 | 
            -
               */
         | 
| 541 | 
            -
              focus: function(event) {
         | 
| 542 | 
            -
                var target = event.target;
         | 
| 543 | 
            -
             | 
| 544 | 
            -
                if (target && (target instanceof RightJS.Element) && (target.autocompleter || target.match(Autocompleter.Options.cssRule))) {
         | 
| 545 | 
            -
                  if (!target.autocompleter) {
         | 
| 546 | 
            -
                    new Autocompleter(target);
         | 
| 547 | 
            -
                  }
         | 
| 548 | 
            -
                }
         | 
| 549 | 
            -
              },
         | 
| 550 | 
            -
             | 
| 551 | 
            -
              /**
         | 
| 552 | 
            -
               * Hides autocompleters on-blur
         | 
| 553 | 
            -
               *
         | 
| 554 | 
            -
               * @param Event blur
         | 
| 555 | 
            -
               * @return void
         | 
| 556 | 
            -
               */
         | 
| 557 | 
            -
              blur: function(event) {
         | 
| 558 | 
            -
                var autocompleter = event.target ? event.target.autocompleter : null;
         | 
| 559 | 
            -
             | 
| 560 | 
            -
                if (autocompleter && autocompleter.visible()) {
         | 
| 561 | 
            -
                  autocompleter.hide();
         | 
| 562 | 
            -
                }
         | 
| 563 | 
            -
              },
         | 
| 564 | 
            -
             | 
| 565 | 
            -
              /**
         | 
| 566 | 
            -
               * Catching the basic keyboard events
         | 
| 567 | 
            -
               * to navigate through the autocompletion list
         | 
| 568 | 
            -
               *
         | 
| 569 | 
            -
               * @param Event keydown
         | 
| 570 | 
            -
               * @return void
         | 
| 571 | 
            -
               */
         | 
| 572 | 
            -
              keydown: function(event) {
         | 
| 573 | 
            -
                var autocompleter = event.target ? event.target.autocompleter : null;
         | 
| 574 | 
            -
             | 
| 575 | 
            -
                if (autocompleter && autocompleter.visible()) {
         | 
| 576 | 
            -
                  var method_name = ({
         | 
| 577 | 
            -
                    27: 'hide', // Esc
         | 
| 578 | 
            -
                    38: 'prev', // Up
         | 
| 579 | 
            -
                    40: 'next', // Down
         | 
| 580 | 
            -
                    13: 'done'  // Enter
         | 
| 581 | 
            -
                  })[event.keyCode];
         | 
| 582 | 
            -
             | 
| 583 | 
            -
                  if (method_name) {
         | 
| 584 | 
            -
                    event.stop();
         | 
| 585 | 
            -
                    autocompleter[method_name]();
         | 
| 586 | 
            -
                  }
         | 
| 587 | 
            -
                }
         | 
| 588 | 
            -
              },
         | 
| 589 | 
            -
             | 
| 590 | 
            -
              /**
         | 
| 591 | 
            -
               * Catches the input fields keyup events
         | 
| 592 | 
            -
               * and tries to make the autocompleter to show some suggestions
         | 
| 593 | 
            -
               *
         | 
| 594 | 
            -
               * @param Event keyup
         | 
| 595 | 
            -
               * @return void
         | 
| 596 | 
            -
               */
         | 
| 597 | 
            -
              keyup: function(event) {
         | 
| 598 | 
            -
                var autocompleter = event.target ? event.target.autocompleter : null;
         | 
| 599 | 
            -
             | 
| 600 | 
            -
                if (autocompleter && !R([9, 27, 37, 38, 39, 40, 13]).include(event.keyCode)) {
         | 
| 601 | 
            -
                  autocompleter.keypressed(event);
         | 
| 602 | 
            -
                }
         | 
| 603 | 
            -
              }
         | 
| 604 | 
            -
            });
         | 
| 605 | 
            -
            (function() {
         | 
| 606 | 
            -
                    var style = document.createElement('style'),
         | 
| 607 | 
            -
                        rules = document.createTextNode(" *.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}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}");
         | 
| 608 | 
            -
             | 
| 609 | 
            -
                    style.type = 'text/css';
         | 
| 610 | 
            -
             | 
| 611 | 
            -
                    if(style.styleSheet) {
         | 
| 612 | 
            -
                      style.styleSheet.cssText = rules.nodeValue;
         | 
| 613 | 
            -
                    } else {
         | 
| 614 | 
            -
                      style.appendChild(rules);
         | 
| 615 | 
            -
                    }
         | 
| 616 | 
            -
             | 
| 617 | 
            -
                    document.getElementsByTagName('head')[0].appendChild(style);
         | 
| 618 | 
            -
                  })();
         | 
| 619 | 
            -
             | 
| 620 | 
            -
            return Autocompleter;
         | 
| 621 | 
            -
            })(document, RightJS);
         |