Commit d62200cad430565bd9f80befaf329297120330b5
1 parent
f6a67fba
Exists in
master
and in
4 other branches
clean-up code
* Remove trailing whitespace * Converts hard-tabs into two-space soft-tabs * Remove consecutive blank lines
Showing
112 changed files
with
1408 additions
and
1437 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 112 files displayed.
app/assets/javascripts/jquery-ui-1.8.16.custom.min.js
@@ -41,7 +41,7 @@ c);return this},enable:function(){return this._setOption("disabled",false)},disa | @@ -41,7 +41,7 @@ c);return this},enable:function(){return this._setOption("disabled",false)},disa | ||
41 | * http://docs.jquery.com/UI/Mouse | 41 | * http://docs.jquery.com/UI/Mouse |
42 | * | 42 | * |
43 | * Depends: | 43 | * Depends: |
44 | - * jquery.ui.widget.js | 44 | + * jquery.ui.widget.js |
45 | */ | 45 | */ |
46 | (function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+ | 46 | (function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+ |
47 | this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted= | 47 | this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted= |
@@ -74,9 +74,9 @@ g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"lef | @@ -74,9 +74,9 @@ g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"lef | ||
74 | * http://docs.jquery.com/UI/Draggables | 74 | * http://docs.jquery.com/UI/Draggables |
75 | * | 75 | * |
76 | * Depends: | 76 | * Depends: |
77 | - * jquery.ui.core.js | ||
78 | - * jquery.ui.mouse.js | ||
79 | - * jquery.ui.widget.js | 77 | + * jquery.ui.core.js |
78 | + * jquery.ui.mouse.js | ||
79 | + * jquery.ui.widget.js | ||
80 | */ | 80 | */ |
81 | (function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== | 81 | (function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== |
82 | "original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= | 82 | "original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= |
@@ -124,10 +124,10 @@ p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math. | @@ -124,10 +124,10 @@ p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math. | ||
124 | * http://docs.jquery.com/UI/Droppables | 124 | * http://docs.jquery.com/UI/Droppables |
125 | * | 125 | * |
126 | * Depends: | 126 | * Depends: |
127 | - * jquery.ui.core.js | ||
128 | - * jquery.ui.widget.js | ||
129 | - * jquery.ui.mouse.js | ||
130 | - * jquery.ui.draggable.js | 127 | + * jquery.ui.core.js |
128 | + * jquery.ui.widget.js | ||
129 | + * jquery.ui.mouse.js | ||
130 | + * jquery.ui.draggable.js | ||
131 | */ | 131 | */ |
132 | (function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this); | 132 | (function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this); |
133 | a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&& | 133 | a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&& |
@@ -151,9 +151,9 @@ a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)}}})(jQuery); | @@ -151,9 +151,9 @@ a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,b)}}})(jQuery); | ||
151 | * http://docs.jquery.com/UI/Resizables | 151 | * http://docs.jquery.com/UI/Resizables |
152 | * | 152 | * |
153 | * Depends: | 153 | * Depends: |
154 | - * jquery.ui.core.js | ||
155 | - * jquery.ui.mouse.js | ||
156 | - * jquery.ui.widget.js | 154 | + * jquery.ui.core.js |
155 | + * jquery.ui.mouse.js | ||
156 | + * jquery.ui.widget.js | ||
157 | */ | 157 | */ |
158 | (function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element, | 158 | (function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element, |
159 | _proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), | 159 | _proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), |
@@ -200,9 +200,9 @@ d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f | @@ -200,9 +200,9 @@ d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f | ||
200 | * http://docs.jquery.com/UI/Selectables | 200 | * http://docs.jquery.com/UI/Selectables |
201 | * | 201 | * |
202 | * Depends: | 202 | * Depends: |
203 | - * jquery.ui.core.js | ||
204 | - * jquery.ui.mouse.js | ||
205 | - * jquery.ui.widget.js | 203 | + * jquery.ui.core.js |
204 | + * jquery.ui.mouse.js | ||
205 | + * jquery.ui.widget.js | ||
206 | */ | 206 | */ |
207 | (function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), | 207 | (function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), |
208 | selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, | 208 | selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, |
@@ -222,9 +222,9 @@ e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass(" | @@ -222,9 +222,9 @@ e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass(" | ||
222 | * http://docs.jquery.com/UI/Sortables | 222 | * http://docs.jquery.com/UI/Sortables |
223 | * | 223 | * |
224 | * Depends: | 224 | * Depends: |
225 | - * jquery.ui.core.js | ||
226 | - * jquery.ui.mouse.js | ||
227 | - * jquery.ui.widget.js | 225 | + * jquery.ui.core.js |
226 | + * jquery.ui.mouse.js | ||
227 | + * jquery.ui.widget.js | ||
228 | */ | 228 | */ |
229 | (function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); | 229 | (function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); |
230 | this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== | 230 | this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== |
@@ -282,8 +282,8 @@ _uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placehold | @@ -282,8 +282,8 @@ _uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placehold | ||
282 | * http://docs.jquery.com/UI/Accordion | 282 | * http://docs.jquery.com/UI/Accordion |
283 | * | 283 | * |
284 | * Depends: | 284 | * Depends: |
285 | - * jquery.ui.core.js | ||
286 | - * jquery.ui.widget.js | 285 | + * jquery.ui.core.js |
286 | + * jquery.ui.widget.js | ||
287 | */ | 287 | */ |
288 | (function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); | 288 | (function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); |
289 | a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); | 289 | a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); |
@@ -312,9 +312,9 @@ paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show", | @@ -312,9 +312,9 @@ paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show", | ||
312 | * http://docs.jquery.com/UI/Autocomplete | 312 | * http://docs.jquery.com/UI/Autocomplete |
313 | * | 313 | * |
314 | * Depends: | 314 | * Depends: |
315 | - * jquery.ui.core.js | ||
316 | - * jquery.ui.widget.js | ||
317 | - * jquery.ui.position.js | 315 | + * jquery.ui.core.js |
316 | + * jquery.ui.widget.js | ||
317 | + * jquery.ui.position.js | ||
318 | */ | 318 | */ |
319 | (function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g= | 319 | (function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g= |
320 | false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= | 320 | false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= |
@@ -344,8 +344,8 @@ this.first()?":last":":first"))},hasScroll:function(){return this.element.height | @@ -344,8 +344,8 @@ this.first()?":last":":first"))},hasScroll:function(){return this.element.height | ||
344 | * http://docs.jquery.com/UI/Button | 344 | * http://docs.jquery.com/UI/Button |
345 | * | 345 | * |
346 | * Depends: | 346 | * Depends: |
347 | - * jquery.ui.core.js | ||
348 | - * jquery.ui.widget.js | 347 | + * jquery.ui.core.js |
348 | + * jquery.ui.widget.js | ||
349 | */ | 349 | */ |
350 | (function(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!== | 350 | (function(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!== |
351 | "boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover"); | 351 | "boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover"); |
@@ -371,13 +371,13 @@ b.Widget.prototype.destroy.call(this)}})})(jQuery); | @@ -371,13 +371,13 @@ b.Widget.prototype.destroy.call(this)}})})(jQuery); | ||
371 | * http://docs.jquery.com/UI/Dialog | 371 | * http://docs.jquery.com/UI/Dialog |
372 | * | 372 | * |
373 | * Depends: | 373 | * Depends: |
374 | - * jquery.ui.core.js | ||
375 | - * jquery.ui.widget.js | 374 | + * jquery.ui.core.js |
375 | + * jquery.ui.widget.js | ||
376 | * jquery.ui.button.js | 376 | * jquery.ui.button.js |
377 | - * jquery.ui.draggable.js | ||
378 | - * jquery.ui.mouse.js | ||
379 | - * jquery.ui.position.js | ||
380 | - * jquery.ui.resizable.js | 377 | + * jquery.ui.draggable.js |
378 | + * jquery.ui.mouse.js | ||
379 | + * jquery.ui.position.js | ||
380 | + * jquery.ui.resizable.js | ||
381 | */ | 381 | */ |
382 | (function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, | 382 | (function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, |
383 | position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ | 383 | position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ |
@@ -411,9 +411,9 @@ c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.b | @@ -411,9 +411,9 @@ c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.b | ||
411 | * http://docs.jquery.com/UI/Slider | 411 | * http://docs.jquery.com/UI/Slider |
412 | * | 412 | * |
413 | * Depends: | 413 | * Depends: |
414 | - * jquery.ui.core.js | ||
415 | - * jquery.ui.mouse.js | ||
416 | - * jquery.ui.widget.js | 414 | + * jquery.ui.core.js |
415 | + * jquery.ui.mouse.js | ||
416 | + * jquery.ui.widget.js | ||
417 | */ | 417 | */ |
418 | (function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+ | 418 | (function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+ |
419 | this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>"); | 419 | this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>"); |
@@ -444,8 +444,8 @@ b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate": | @@ -444,8 +444,8 @@ b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate": | ||
444 | * http://docs.jquery.com/UI/Tabs | 444 | * http://docs.jquery.com/UI/Tabs |
445 | * | 445 | * |
446 | * Depends: | 446 | * Depends: |
447 | - * jquery.ui.core.js | ||
448 | - * jquery.ui.widget.js | 447 | + * jquery.ui.core.js |
448 | + * jquery.ui.widget.js | ||
449 | */ | 449 | */ |
450 | (function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& | 450 | (function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& |
451 | e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= | 451 | e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= |
@@ -479,7 +479,7 @@ a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow" | @@ -479,7 +479,7 @@ a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow" | ||
479 | * http://docs.jquery.com/UI/Datepicker | 479 | * http://docs.jquery.com/UI/Datepicker |
480 | * | 480 | * |
481 | * Depends: | 481 | * Depends: |
482 | - * jquery.ui.core.js | 482 | + * jquery.ui.core.js |
483 | */ | 483 | */ |
484 | (function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass= | 484 | (function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass= |
485 | "ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su", | 485 | "ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su", |
@@ -609,7 +609,7 @@ a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery); | @@ -609,7 +609,7 @@ a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery); | ||
609 | * http://docs.jquery.com/UI/Effects/Blind | 609 | * http://docs.jquery.com/UI/Effects/Blind |
610 | * | 610 | * |
611 | * Depends: | 611 | * Depends: |
612 | - * jquery.effects.core.js | 612 | + * jquery.effects.core.js |
613 | */ | 613 | */ |
614 | (function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a, | 614 | (function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a, |
615 | g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery); | 615 | g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery); |
@@ -623,7 +623,7 @@ g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.deq | @@ -623,7 +623,7 @@ g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.deq | ||
623 | * http://docs.jquery.com/UI/Effects/Bounce | 623 | * http://docs.jquery.com/UI/Effects/Bounce |
624 | * | 624 | * |
625 | * Depends: | 625 | * Depends: |
626 | - * jquery.effects.core.js | 626 | + * jquery.effects.core.js |
627 | */ | 627 | */ |
628 | (function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/ | 628 | (function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/ |
629 | 3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a); | 629 | 3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a); |
@@ -638,7 +638,7 @@ b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-= | @@ -638,7 +638,7 @@ b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-= | ||
638 | * http://docs.jquery.com/UI/Effects/Clip | 638 | * http://docs.jquery.com/UI/Effects/Clip |
639 | * | 639 | * |
640 | * Depends: | 640 | * Depends: |
641 | - * jquery.effects.core.js | 641 | + * jquery.effects.core.js |
642 | */ | 642 | */ |
643 | (function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position, | 643 | (function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position, |
644 | c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery); | 644 | c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery); |
@@ -652,7 +652,7 @@ c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h, | @@ -652,7 +652,7 @@ c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h, | ||
652 | * http://docs.jquery.com/UI/Effects/Drop | 652 | * http://docs.jquery.com/UI/Effects/Drop |
653 | * | 653 | * |
654 | * Depends: | 654 | * Depends: |
655 | - * jquery.effects.core.js | 655 | + * jquery.effects.core.js |
656 | */ | 656 | */ |
657 | (function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e== | 657 | (function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e== |
658 | "show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); | 658 | "show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); |
@@ -666,7 +666,7 @@ c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h, | @@ -666,7 +666,7 @@ c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h, | ||
666 | * http://docs.jquery.com/UI/Effects/Explode | 666 | * http://docs.jquery.com/UI/Effects/Explode |
667 | * | 667 | * |
668 | * Depends: | 668 | * Depends: |
669 | - * jquery.effects.core.js | 669 | + * jquery.effects.core.js |
670 | */ | 670 | */ |
671 | (function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f= | 671 | (function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f= |
672 | 0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ | 672 | 0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ |
@@ -681,7 +681,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m | @@ -681,7 +681,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m | ||
681 | * http://docs.jquery.com/UI/Effects/Fade | 681 | * http://docs.jquery.com/UI/Effects/Fade |
682 | * | 682 | * |
683 | * Depends: | 683 | * Depends: |
684 | - * jquery.effects.core.js | 684 | + * jquery.effects.core.js |
685 | */ | 685 | */ |
686 | (function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); | 686 | (function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); |
687 | ;/* | 687 | ;/* |
@@ -694,7 +694,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m | @@ -694,7 +694,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m | ||
694 | * http://docs.jquery.com/UI/Effects/Fold | 694 | * http://docs.jquery.com/UI/Effects/Fold |
695 | * | 695 | * |
696 | * Depends: | 696 | * Depends: |
697 | - * jquery.effects.core.js | 697 | + * jquery.effects.core.js |
698 | */ | 698 | */ |
699 | (function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], | 699 | (function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], |
700 | 10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); | 700 | 10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); |
@@ -708,7 +708,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m | @@ -708,7 +708,7 @@ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.m | ||
708 | * http://docs.jquery.com/UI/Effects/Highlight | 708 | * http://docs.jquery.com/UI/Effects/Highlight |
709 | * | 709 | * |
710 | * Depends: | 710 | * Depends: |
711 | - * jquery.effects.core.js | 711 | + * jquery.effects.core.js |
712 | */ | 712 | */ |
713 | (function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& | 713 | (function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& |
714 | this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); | 714 | this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); |
@@ -722,7 +722,7 @@ this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments | @@ -722,7 +722,7 @@ this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments | ||
722 | * http://docs.jquery.com/UI/Effects/Pulsate | 722 | * http://docs.jquery.com/UI/Effects/Pulsate |
723 | * | 723 | * |
724 | * Depends: | 724 | * Depends: |
725 | - * jquery.effects.core.js | 725 | + * jquery.effects.core.js |
726 | */ | 726 | */ |
727 | (function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration, | 727 | (function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration, |
728 | a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery); | 728 | a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery); |
@@ -736,7 +736,7 @@ a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply( | @@ -736,7 +736,7 @@ a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply( | ||
736 | * http://docs.jquery.com/UI/Effects/Scale | 736 | * http://docs.jquery.com/UI/Effects/Scale |
737 | * | 737 | * |
738 | * Depends: | 738 | * Depends: |
739 | - * jquery.effects.core.js | 739 | + * jquery.effects.core.js |
740 | */ | 740 | */ |
741 | (function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a, | 741 | (function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a, |
742 | b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity= | 742 | b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity= |
@@ -756,7 +756,7 @@ n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a | @@ -756,7 +756,7 @@ n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a | ||
756 | * http://docs.jquery.com/UI/Effects/Shake | 756 | * http://docs.jquery.com/UI/Effects/Shake |
757 | * | 757 | * |
758 | * Depends: | 758 | * Depends: |
759 | - * jquery.effects.core.js | 759 | + * jquery.effects.core.js |
760 | */ | 760 | */ |
761 | (function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]= | 761 | (function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]= |
762 | (h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery); | 762 | (h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery); |
@@ -770,7 +770,7 @@ n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a | @@ -770,7 +770,7 @@ n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a | ||
770 | * http://docs.jquery.com/UI/Effects/Slide | 770 | * http://docs.jquery.com/UI/Effects/Slide |
771 | * | 771 | * |
772 | * Depends: | 772 | * Depends: |
773 | - * jquery.effects.core.js | 773 | + * jquery.effects.core.js |
774 | */ | 774 | */ |
775 | (function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e); | 775 | (function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e); |
776 | var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); | 776 | var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); |
@@ -784,8 +784,8 @@ var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{q | @@ -784,8 +784,8 @@ var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{q | ||
784 | * http://docs.jquery.com/UI/Effects/Transfer | 784 | * http://docs.jquery.com/UI/Effects/Transfer |
785 | * | 785 | * |
786 | * Depends: | 786 | * Depends: |
787 | - * jquery.effects.core.js | 787 | + * jquery.effects.core.js |
788 | */ | 788 | */ |
789 | (function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); | 789 | (function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); |
790 | b.dequeue()})})}})(jQuery); | 790 | b.dequeue()})})}})(jQuery); |
791 | -; | ||
792 | \ No newline at end of file | 791 | \ No newline at end of file |
792 | +; |
app/assets/javascripts/jquery.ui.selectmenu.js
@@ -12,834 +12,833 @@ | @@ -12,834 +12,833 @@ | ||
12 | (function($) { | 12 | (function($) { |
13 | 13 | ||
14 | $.widget("ui.selectmenu", { | 14 | $.widget("ui.selectmenu", { |
15 | - getter: "value", | ||
16 | - version: "1.8", | ||
17 | - eventPrefix: "selectmenu", | ||
18 | - options: { | ||
19 | - transferClasses: true, | ||
20 | - typeAhead: "sequential", | ||
21 | - style: 'dropdown', | ||
22 | - positionOptions: { | ||
23 | - my: "left top", | ||
24 | - at: "left bottom", | ||
25 | - offset: null | ||
26 | - }, | ||
27 | - width: null, | ||
28 | - menuWidth: null, | ||
29 | - handleWidth: 26, | ||
30 | - maxHeight: null, | ||
31 | - icons: null, | ||
32 | - format: null, | ||
33 | - bgImage: function() {}, | ||
34 | - wrapperElement: "<div />" | ||
35 | - }, | ||
36 | - | ||
37 | - _create: function() { | ||
38 | - var self = this, o = this.options; | ||
39 | - | ||
40 | - // set a default id value, generate a new random one if not set by developer | ||
41 | - var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ); | ||
42 | - | ||
43 | - // quick array of button and menu id's | ||
44 | - this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ]; | ||
45 | - | ||
46 | - // define safe mouseup for future toggling | ||
47 | - this._safemouseup = true; | ||
48 | - | ||
49 | - // create menu button wrapper | ||
50 | - this.newelement = $( '<a />', { | ||
51 | - 'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all', | ||
52 | - 'id' : this.ids[ 0 ], | ||
53 | - 'role': 'button', | ||
54 | - 'href': '#nogo', | ||
55 | - 'tabindex': this.element.attr( 'disabled' ) ? 1 : 0, | ||
56 | - 'aria-haspopup': true, | ||
57 | - 'aria-owns': this.ids[ 1 ] | ||
58 | - }); | ||
59 | - this.newelementWrap = $( o.wrapperElement ) | ||
60 | - .append( this.newelement ) | ||
61 | - .insertAfter( this.element ); | ||
62 | - | ||
63 | - // transfer tabindex | ||
64 | - var tabindex = this.element.attr( 'tabindex' ); | ||
65 | - if ( tabindex ) { | ||
66 | - this.newelement.attr( 'tabindex', tabindex ); | ||
67 | - } | ||
68 | - | ||
69 | - // save reference to select in data for ease in calling methods | ||
70 | - this.newelement.data( 'selectelement', this.element ); | ||
71 | - | ||
72 | - // menu icon | ||
73 | - this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' ) | ||
74 | - .prependTo( this.newelement ); | ||
75 | - | ||
76 | - // append status span to button | ||
77 | - this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' ); | ||
78 | - | ||
79 | - // make associated form label trigger focus | ||
80 | - $( 'label[for="' + selectmenuId + '"]' ) | ||
81 | - .attr( 'for', this.ids[0] ) | ||
82 | - .bind( 'click.selectmenu', function() { | ||
83 | - self.newelement[0].focus(); | ||
84 | - return false; | ||
85 | - }); | ||
86 | - | ||
87 | - // click toggle for menu visibility | ||
88 | - this.newelement | ||
89 | - .bind('mousedown.selectmenu', function(event) { | ||
90 | - self._toggle(event, true); | ||
91 | - // make sure a click won't open/close instantly | ||
92 | - if (o.style == "popup") { | ||
93 | - self._safemouseup = false; | ||
94 | - setTimeout(function() { self._safemouseup = true; }, 300); | ||
95 | - } | ||
96 | - return false; | ||
97 | - }) | ||
98 | - .bind('click.selectmenu', function() { | ||
99 | - return false; | ||
100 | - }) | ||
101 | - .bind("keydown.selectmenu", function(event) { | ||
102 | - var ret = false; | ||
103 | - switch (event.keyCode) { | ||
104 | - case $.ui.keyCode.ENTER: | ||
105 | - ret = true; | ||
106 | - break; | ||
107 | - case $.ui.keyCode.SPACE: | ||
108 | - self._toggle(event); | ||
109 | - break; | ||
110 | - case $.ui.keyCode.UP: | ||
111 | - if (event.altKey) { | ||
112 | - self.open(event); | ||
113 | - } else { | ||
114 | - self._moveSelection(-1); | ||
115 | - } | ||
116 | - break; | ||
117 | - case $.ui.keyCode.DOWN: | ||
118 | - if (event.altKey) { | ||
119 | - self.open(event); | ||
120 | - } else { | ||
121 | - self._moveSelection(1); | ||
122 | - } | ||
123 | - break; | ||
124 | - case $.ui.keyCode.LEFT: | ||
125 | - self._moveSelection(-1); | ||
126 | - break; | ||
127 | - case $.ui.keyCode.RIGHT: | ||
128 | - self._moveSelection(1); | ||
129 | - break; | ||
130 | - case $.ui.keyCode.TAB: | ||
131 | - ret = true; | ||
132 | - break; | ||
133 | - default: | ||
134 | - ret = true; | ||
135 | - } | ||
136 | - return ret; | ||
137 | - }) | ||
138 | - .bind('keypress.selectmenu', function(event) { | ||
139 | - self._typeAhead(event.which, 'mouseup'); | ||
140 | - return true; | ||
141 | - }) | ||
142 | - .bind('mouseover.selectmenu focus.selectmenu', function() { | ||
143 | - if (!o.disabled) { | ||
144 | - $(this).addClass(self.widgetBaseClass + '-focus ui-state-hover'); | ||
145 | - } | ||
146 | - }) | ||
147 | - .bind('mouseout.selectmenu blur.selectmenu', function() { | ||
148 | - if (!o.disabled) { | ||
149 | - $(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover'); | ||
150 | - } | ||
151 | - }); | ||
152 | - | ||
153 | - // document click closes menu | ||
154 | - $(document).bind("mousedown.selectmenu", function(event) { | ||
155 | - self.close(event); | ||
156 | - }); | ||
157 | - | ||
158 | - // change event on original selectmenu | ||
159 | - this.element | ||
160 | - .bind("click.selectmenu", function() { | ||
161 | - self._refreshValue(); | ||
162 | - }) | ||
163 | - // FIXME: newelement can be null under unclear circumstances in IE8 | ||
164 | - // TODO not sure if this is still a problem (fnagel 20.03.11) | ||
165 | - .bind("focus.selectmenu", function() { | ||
166 | - if (self.newelement) { | ||
167 | - self.newelement[0].focus(); | ||
168 | - } | ||
169 | - }); | ||
170 | - | ||
171 | - // set width when not set via options | ||
172 | - if (!o.width) { | ||
173 | - o.width = this.element.outerWidth(); | ||
174 | - } | ||
175 | - // set menu button width | ||
176 | - this.newelement.width(o.width); | ||
177 | - | ||
178 | - // hide original selectmenu element | ||
179 | - this.element.hide(); | ||
180 | - | ||
181 | - // create menu portion, append to body | ||
182 | - this.list = $( '<ul />', { | ||
183 | - 'class': 'ui-widget ui-widget-content', | ||
184 | - 'aria-hidden': true, | ||
185 | - 'role': 'listbox', | ||
186 | - 'aria-labelledby': this.ids[0], | ||
187 | - 'id': this.ids[1] | ||
188 | - }); | ||
189 | - this.listWrap = $( o.wrapperElement ) | ||
190 | - .addClass( self.widgetBaseClass + '-menu' ) | ||
191 | - .append( this.list ) | ||
192 | - .appendTo( 'body' ); | ||
193 | - | ||
194 | - // transfer menu click to menu button | ||
195 | - this.list | ||
196 | - .bind("keydown.selectmenu", function(event) { | ||
197 | - var ret = false; | ||
198 | - switch (event.keyCode) { | ||
199 | - case $.ui.keyCode.UP: | ||
200 | - if (event.altKey) { | ||
201 | - self.close(event, true); | ||
202 | - } else { | ||
203 | - self._moveFocus(-1); | ||
204 | - } | ||
205 | - break; | ||
206 | - case $.ui.keyCode.DOWN: | ||
207 | - if (event.altKey) { | ||
208 | - self.close(event, true); | ||
209 | - } else { | ||
210 | - self._moveFocus(1); | ||
211 | - } | ||
212 | - break; | ||
213 | - case $.ui.keyCode.LEFT: | ||
214 | - self._moveFocus(-1); | ||
215 | - break; | ||
216 | - case $.ui.keyCode.RIGHT: | ||
217 | - self._moveFocus(1); | ||
218 | - break; | ||
219 | - case $.ui.keyCode.HOME: | ||
220 | - self._moveFocus(':first'); | ||
221 | - break; | ||
222 | - case $.ui.keyCode.PAGE_UP: | ||
223 | - self._scrollPage('up'); | ||
224 | - break; | ||
225 | - case $.ui.keyCode.PAGE_DOWN: | ||
226 | - self._scrollPage('down'); | ||
227 | - break; | ||
228 | - case $.ui.keyCode.END: | ||
229 | - self._moveFocus(':last'); | ||
230 | - break; | ||
231 | - case $.ui.keyCode.ENTER: | ||
232 | - case $.ui.keyCode.SPACE: | ||
233 | - self.close(event, true); | ||
234 | - $(event.target).parents('li:eq(0)').trigger('mouseup'); | ||
235 | - break; | ||
236 | - case $.ui.keyCode.TAB: | ||
237 | - ret = true; | ||
238 | - self.close(event, true); | ||
239 | - $(event.target).parents('li:eq(0)').trigger('mouseup'); | ||
240 | - break; | ||
241 | - case $.ui.keyCode.ESCAPE: | ||
242 | - self.close(event, true); | ||
243 | - break; | ||
244 | - default: | ||
245 | - ret = true; | ||
246 | - } | ||
247 | - return ret; | ||
248 | - }) | ||
249 | - .bind('keypress.selectmenu', function(event) { | ||
250 | - self._typeAhead(event.which, 'focus'); | ||
251 | - return true; | ||
252 | - }) | ||
253 | - // this allows for using the scrollbar in an overflowed list | ||
254 | - .bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; }); | ||
255 | - | ||
256 | - // needed when window is resized | ||
257 | - // TODO seems to be useless, but causes errors (fnagel 01.08.11) | ||
258 | - // see: https://github.com/fnagel/jquery-ui/issues/147 | ||
259 | - // $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) ); | ||
260 | - }, | ||
261 | - | ||
262 | - _init: function() { | ||
263 | - var self = this, o = this.options; | ||
264 | - | ||
265 | - // serialize selectmenu element options | ||
266 | - var selectOptionData = []; | ||
267 | - this.element | ||
268 | - .find('option') | ||
269 | - .each(function() { | ||
270 | - var opt = $(this); | ||
271 | - selectOptionData.push({ | ||
272 | - value: opt.attr('value'), | ||
273 | - text: self._formatText(opt.text()), | ||
274 | - selected: opt.attr('selected'), | ||
275 | - disabled: opt.attr('disabled'), | ||
276 | - classes: opt.attr('class'), | ||
277 | - typeahead: opt.attr('typeahead'), | ||
278 | - parentOptGroup: opt.parent('optgroup'), | ||
279 | - bgImage: o.bgImage.call(opt) | ||
280 | - }); | ||
281 | - }); | ||
282 | - | ||
283 | - // active state class is only used in popup style | ||
284 | - var activeClass = (self.options.style == "popup") ? " ui-state-active" : ""; | ||
285 | - | ||
286 | - // empty list so we can refresh the selectmenu via selectmenu() | ||
287 | - this.list.html(""); | ||
288 | - | ||
289 | - // write li's | ||
290 | - if (selectOptionData.length) { | ||
291 | - for (var i = 0; i < selectOptionData.length; i++) { | ||
292 | - var thisLiAttr = { role : 'presentation' }; | ||
293 | - if ( selectOptionData[ i ].disabled ) { | ||
294 | - thisLiAttr[ 'class' ] = this.namespace + '-state-disabled'; | ||
295 | - } | ||
296 | - var thisAAttr = { | ||
297 | - html: selectOptionData[i].text, | ||
298 | - href : '#nogo', | ||
299 | - tabindex : -1, | ||
300 | - role : 'option', | ||
301 | - 'aria-selected' : false | ||
302 | - }; | ||
303 | - if ( selectOptionData[ i ].disabled ) { | ||
304 | - thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled; | ||
305 | - } | ||
306 | - if ( selectOptionData[ i ].typeahead ) { | ||
307 | - thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead; | ||
308 | - } | ||
309 | - var thisA = $('<a/>', thisAAttr); | ||
310 | - var thisLi = $('<li/>', thisLiAttr) | ||
311 | - .append(thisA) | ||
312 | - .data('index', i) | ||
313 | - .addClass(selectOptionData[i].classes) | ||
314 | - .data('optionClasses', selectOptionData[i].classes || '') | ||
315 | - .bind("mouseup.selectmenu", function(event) { | ||
316 | - if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) { | ||
317 | - var changed = $(this).data('index') != self._selectedIndex(); | ||
318 | - self.index($(this).data('index')); | ||
319 | - self.select(event); | ||
320 | - if (changed) { | ||
321 | - self.change(event); | ||
322 | - } | ||
323 | - self.close(event, true); | ||
324 | - } | ||
325 | - return false; | ||
326 | - }) | ||
327 | - .bind("click.selectmenu", function() { | ||
328 | - return false; | ||
329 | - }) | ||
330 | - .bind('mouseover.selectmenu focus.selectmenu', function(e) { | ||
331 | - // no hover if diabled | ||
332 | - if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) { | ||
333 | - self._selectedOptionLi().addClass(activeClass); | ||
334 | - self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); | ||
335 | - $(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover'); | ||
336 | - } | ||
337 | - }) | ||
338 | - .bind('mouseout.selectmenu blur.selectmenu', function() { | ||
339 | - if ($(this).is(self._selectedOptionLi().selector)) { | ||
340 | - $(this).addClass(activeClass); | ||
341 | - } | ||
342 | - $(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); | ||
343 | - }); | ||
344 | - | ||
345 | - // optgroup or not... | ||
346 | - if ( selectOptionData[i].parentOptGroup.length ) { | ||
347 | - var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup ); | ||
348 | - if (this.list.find( 'li.' + optGroupName ).length ) { | ||
349 | - this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi ); | ||
350 | - } else { | ||
351 | - $(' <li role="presentation" class="' + self.widgetBaseClass + '-group ' + optGroupName + (selectOptionData[i].parentOptGroup.attr("disabled") ? ' ' + this.namespace + '-state-disabled" aria-disabled="true"' : '"' ) + '><span class="' + self.widgetBaseClass + '-group-label">' + selectOptionData[i].parentOptGroup.attr('label') + '</span><ul></ul></li> ') | ||
352 | - .appendTo( this.list ) | ||
353 | - .find( 'ul' ) | ||
354 | - .append( thisLi ); | ||
355 | - } | ||
356 | - } else { | ||
357 | - thisLi.appendTo(this.list); | ||
358 | - } | ||
359 | - | ||
360 | - // append icon if option is specified | ||
361 | - if (o.icons) { | ||
362 | - for (var j in o.icons) { | ||
363 | - if (thisLi.is(o.icons[j].find)) { | ||
364 | - thisLi | ||
365 | - .data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon') | ||
366 | - .addClass(self.widgetBaseClass + '-hasIcon'); | ||
367 | - var iconClass = o.icons[j].icon || ""; | ||
368 | - thisLi | ||
369 | - .find('a:eq(0)') | ||
370 | - .prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>'); | ||
371 | - if (selectOptionData[i].bgImage) { | ||
372 | - thisLi.find('span').css('background-image', selectOptionData[i].bgImage); | ||
373 | - } | ||
374 | - } | ||
375 | - } | ||
376 | - } | ||
377 | - } | ||
378 | - } else { | ||
379 | - $('<li role="presentation"><a href="#nogo" tabindex="-1" role="option"></a></li>').appendTo(this.list); | ||
380 | - } | ||
381 | - // we need to set and unset the CSS classes for dropdown and popup style | ||
382 | - var isDropDown = ( o.style == 'dropdown' ); | ||
383 | - this.newelement | ||
384 | - .toggleClass( self.widgetBaseClass + '-dropdown', isDropDown ) | ||
385 | - .toggleClass( self.widgetBaseClass + '-popup', !isDropDown ); | ||
386 | - this.list | ||
387 | - .toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown ) | ||
388 | - .toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown ) | ||
389 | - // add corners to top and bottom menu items | ||
390 | - .find( 'li:first' ) | ||
391 | - .toggleClass( 'ui-corner-top', !isDropDown ) | ||
392 | - .end().find( 'li:last' ) | ||
393 | - .addClass( 'ui-corner-bottom' ); | ||
394 | - this.selectmenuIcon | ||
395 | - .toggleClass( 'ui-icon-triangle-1-s', isDropDown ) | ||
396 | - .toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown ); | ||
397 | - | ||
398 | - // transfer classes to selectmenu and list | ||
399 | - if ( o.transferClasses ) { | ||
400 | - var transferClasses = this.element.attr( 'class' ) || ''; | ||
401 | - this.newelement.add( this.list ).addClass( transferClasses ); | ||
402 | - } | ||
403 | - | ||
404 | - // set menu width to either menuWidth option value, width option value, or select width | ||
405 | - if ( o.style == 'dropdown' ) { | ||
406 | - this.list.width( o.menuWidth ? o.menuWidth : o.width ); | ||
407 | - } else { | ||
408 | - this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth ); | ||
409 | - } | ||
410 | - | ||
411 | - // reset height to auto | ||
412 | - this.list.css( 'height', 'auto' ); | ||
413 | - var listH = this.listWrap.height(); | ||
414 | - // calculate default max height | ||
415 | - if ( o.maxHeight && o.maxHeight < listH ) { | ||
416 | - this.list.height( o.maxHeight ); | ||
417 | - } else { | ||
418 | - var winH = $( window ).height() / 3; | ||
419 | - if ( winH < listH ) this.list.height( winH ); | ||
420 | - } | ||
421 | - | ||
422 | - // save reference to actionable li's (not group label li's) | ||
423 | - this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' ); | ||
424 | - | ||
425 | - // transfer disabled state | ||
426 | - if ( this.element.attr( 'disabled' ) ) { | ||
427 | - this.disable(); | ||
428 | - } else { | ||
429 | - this.enable() | ||
430 | - } | ||
431 | - | ||
432 | - // update value | ||
433 | - this.index( this._selectedIndex() ); | ||
434 | - | ||
435 | - // needed when selectmenu is placed at the very bottom / top of the page | ||
436 | - window.setTimeout( function() { | ||
437 | - self._refreshPosition(); | ||
438 | - }, 200 ); | ||
439 | - }, | ||
440 | - | ||
441 | - destroy: function() { | ||
442 | - this.element.removeData( this.widgetName ) | ||
443 | - .removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' ) | ||
444 | - .removeAttr( 'aria-disabled' ) | ||
445 | - .unbind( ".selectmenu" ); | ||
446 | - | ||
447 | - // TODO unneded as event binding has been disabled | ||
448 | - // $( window ).unbind( ".selectmenu" ); | ||
449 | - $( document ).unbind( ".selectmenu" ); | ||
450 | - | ||
451 | - // unbind click on label, reset its for attr | ||
452 | - $( 'label[for=' + this.newelement.attr('id') + ']' ) | ||
453 | - .attr( 'for', this.element.attr( 'id' ) ) | ||
454 | - .unbind( '.selectmenu' ); | ||
455 | - | ||
456 | - this.newelementWrap.remove(); | ||
457 | - this.listWrap.remove(); | ||
458 | - | ||
459 | - this.element.show(); | ||
460 | - | ||
461 | - // call widget destroy function | ||
462 | - $.Widget.prototype.destroy.apply(this, arguments); | ||
463 | - }, | ||
464 | - | ||
465 | - _typeAhead: function( code, eventType ){ | ||
466 | - var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase(); | ||
467 | - c = C.toLowerCase(); | ||
468 | - | ||
469 | - if ( self.options.typeAhead == 'sequential' ) { | ||
470 | - // clear the timeout so we can use _prevChar | ||
471 | - window.clearTimeout('ui.selectmenu-' + self.selectmenuId); | ||
472 | - | ||
473 | - // define our find var | ||
474 | - var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' ); | ||
475 | - | ||
476 | - function focusOptSeq( elem, ind, c ){ | ||
477 | - focusFound = true; | ||
478 | - $( elem ).trigger( eventType ); | ||
479 | - typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c; | ||
480 | - } | ||
481 | - this.list.find( 'li a' ).each( function( i ) { | ||
482 | - if ( !focusFound ) { | ||
483 | - // allow the typeahead attribute on the option tag for a more specific lookup | ||
484 | - var thisText = $( this ).attr( 'typeahead' ) || $(this).text(); | ||
485 | - if ( thisText.indexOf( find + C ) === 0 ) { | ||
486 | - focusOptSeq( this, i, C ); | ||
487 | - } else if (thisText.indexOf(find+c) === 0 ) { | ||
488 | - focusOptSeq( this, i, c ); | ||
489 | - } | ||
490 | - } | ||
491 | - }); | ||
492 | - // set a 1 second timeout for sequenctial typeahead | ||
493 | - // keep this set even if we have no matches so it doesnt typeahead somewhere else | ||
494 | - window.setTimeout( function( el ) { | ||
495 | - self._prevChar = undefined; | ||
496 | - }, 1000, self ); | ||
497 | - | ||
498 | - } else { | ||
499 | - // define self._prevChar if needed | ||
500 | - if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; } | ||
501 | - | ||
502 | - focusFound = false; | ||
503 | - function focusOpt( elem, ind ){ | ||
504 | - focusFound = true; | ||
505 | - $( elem ).trigger( eventType ); | ||
506 | - self._prevChar[ 1 ] = ind; | ||
507 | - } | ||
508 | - this.list.find( 'li a' ).each(function( i ){ | ||
509 | - if (!focusFound){ | ||
510 | - var thisText = $(this).text(); | ||
511 | - if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) { | ||
512 | - if (self._prevChar[0] == C){ | ||
513 | - if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); } | ||
514 | - } else{ | ||
515 | - focusOpt( this, i ); | ||
516 | - } | ||
517 | - } | ||
518 | - } | ||
519 | - }); | ||
520 | - this._prevChar[ 0 ] = C; | ||
521 | - } | ||
522 | - }, | ||
523 | - | ||
524 | - // returns some usefull information, called by callbacks only | ||
525 | - _uiHash: function() { | ||
526 | - var index = this.index(); | ||
527 | - return { | ||
528 | - index: index, | ||
529 | - option: $("option", this.element).get(index), | ||
530 | - value: this.element[0].value | ||
531 | - }; | ||
532 | - }, | ||
533 | - | ||
534 | - open: function(event) { | ||
535 | - var self = this, o = this.options; | ||
536 | - if ( self.newelement.attr("aria-disabled") != 'true' ) { | ||
537 | - self._closeOthers(event); | ||
538 | - self.newelement.addClass('ui-state-active'); | ||
539 | - | ||
540 | - self.listWrap.appendTo( o.appendTo ); | ||
541 | - self.list.attr('aria-hidden', false); | ||
542 | - | ||
543 | - if ( o.style == "dropdown" ) { | ||
544 | - self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); | ||
545 | - } | ||
546 | - | ||
547 | - self.listWrap.addClass( self.widgetBaseClass + '-open' ); | ||
548 | - // positioning needed for IE7 (tested 01.08.11 on MS VPC Image) | ||
549 | - // see https://github.com/fnagel/jquery-ui/issues/147 | ||
550 | - if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) { | ||
551 | - self._refreshPosition(); | ||
552 | - } | ||
553 | - var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + '):visible a'); | ||
554 | - if (selected.length) selected[0].focus(); | ||
555 | - // positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image) | ||
556 | - self._refreshPosition(); | ||
557 | - | ||
558 | - self._trigger("open", event, self._uiHash()); | ||
559 | - } | ||
560 | - }, | ||
561 | - | ||
562 | - close: function(event, retainFocus) { | ||
563 | - if ( this.newelement.is('.ui-state-active') ) { | ||
564 | - this.newelement | ||
565 | - .removeClass('ui-state-active'); | ||
566 | - this.listWrap.removeClass(this.widgetBaseClass + '-open'); | ||
567 | - this.list.attr('aria-hidden', true); | ||
568 | - if ( this.options.style == "dropdown" ) { | ||
569 | - this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); | ||
570 | - } | ||
571 | - if ( retainFocus ) { | ||
572 | - this.newelement.focus(); | ||
573 | - } | ||
574 | - this._trigger("close", event, this._uiHash()); | ||
575 | - } | ||
576 | - }, | ||
577 | - | ||
578 | - change: function(event) { | ||
579 | - this.element.trigger("change"); | ||
580 | - this._trigger("change", event, this._uiHash()); | ||
581 | - }, | ||
582 | - | ||
583 | - select: function(event) { | ||
584 | - if (this._disabled(event.currentTarget)) { return false; } | ||
585 | - this._trigger("select", event, this._uiHash()); | ||
586 | - }, | ||
587 | - | ||
588 | - _closeOthers: function(event) { | ||
589 | - $('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() { | ||
590 | - $(this).data('selectelement').selectmenu('close', event); | ||
591 | - }); | ||
592 | - $('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout'); | ||
593 | - }, | ||
594 | - | ||
595 | - _toggle: function(event, retainFocus) { | ||
596 | - if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) { | ||
597 | - this.close(event, retainFocus); | ||
598 | - } else { | ||
599 | - this.open(event); | ||
600 | - } | ||
601 | - }, | ||
602 | - | ||
603 | - _formatText: function(text) { | ||
604 | - return (this.options.format ? this.options.format(text) : text); | ||
605 | - }, | ||
606 | - | ||
607 | - _selectedIndex: function() { | ||
608 | - return this.element[0].selectedIndex; | ||
609 | - }, | ||
610 | - | ||
611 | - _selectedOptionLi: function() { | ||
612 | - return this._optionLis.eq(this._selectedIndex()); | ||
613 | - }, | ||
614 | - | ||
615 | - _focusedOptionLi: function() { | ||
616 | - return this.list.find('.' + this.widgetBaseClass + '-item-focus'); | ||
617 | - }, | ||
618 | - | ||
619 | - _moveSelection: function(amt, recIndex) { | ||
620 | - // do nothing if disabled | ||
621 | - if (!this.options.disabled) { | ||
622 | - var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10); | ||
623 | - var newIndex = currIndex + amt; | ||
624 | - // do not loop when using up key | ||
625 | - | ||
626 | - if (newIndex < 0) { | ||
627 | - newIndex = 0; | ||
628 | - } | ||
629 | - if (newIndex > this._optionLis.size() - 1) { | ||
630 | - newIndex = this._optionLis.size() - 1; | ||
631 | - } | ||
632 | - // Occurs when a full loop has been made | ||
633 | - if (newIndex === recIndex) { return false; } | ||
634 | - | ||
635 | - if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) { | ||
636 | - // if option at newIndex is disabled, call _moveFocus, incrementing amt by one | ||
637 | - (amt > 0) ? ++amt : --amt; | ||
638 | - this._moveSelection(amt, newIndex); | ||
639 | - } else { | ||
640 | - return this._optionLis.eq(newIndex).trigger('mouseup'); | ||
641 | - } | ||
642 | - } | ||
643 | - }, | ||
644 | - | ||
645 | - _moveFocus: function(amt, recIndex) { | ||
646 | - if (!isNaN(amt)) { | ||
647 | - var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10); | ||
648 | - var newIndex = currIndex + amt; | ||
649 | - } else { | ||
650 | - var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); | ||
651 | - } | ||
652 | - | ||
653 | - if (newIndex < 0) { | ||
654 | - newIndex = 0; | ||
655 | - } | ||
656 | - if (newIndex > this._optionLis.size() - 1) { | ||
657 | - newIndex = this._optionLis.size() - 1; | ||
658 | - } | ||
659 | - | ||
660 | - //Occurs when a full loop has been made | ||
661 | - if (newIndex === recIndex) { return false; } | ||
662 | - | ||
663 | - var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); | ||
664 | - | ||
665 | - this._focusedOptionLi().find('a:eq(0)').attr('id', ''); | ||
666 | - | ||
667 | - if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) { | ||
668 | - // if option at newIndex is disabled, call _moveFocus, incrementing amt by one | ||
669 | - (amt > 0) ? ++amt : --amt; | ||
670 | - this._moveFocus(amt, newIndex); | ||
671 | - } else { | ||
672 | - this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus(); | ||
673 | - } | ||
674 | - | ||
675 | - this.list.attr('aria-activedescendant', activeID); | ||
676 | - }, | ||
677 | - | ||
678 | - _scrollPage: function(direction) { | ||
679 | - var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight()); | ||
680 | - numPerPage = (direction == 'up' ? -numPerPage : numPerPage); | ||
681 | - this._moveFocus(numPerPage); | ||
682 | - }, | ||
683 | - | ||
684 | - _setOption: function(key, value) { | ||
685 | - this.options[key] = value; | ||
686 | - // set | ||
687 | - if (key == 'disabled') { | ||
688 | - this.close(); | ||
689 | - this.element | ||
690 | - .add(this.newelement) | ||
691 | - .add(this.list)[value ? 'addClass' : 'removeClass']( | ||
692 | - this.widgetBaseClass + '-disabled' + ' ' + | ||
693 | - this.namespace + '-state-disabled') | ||
694 | - .attr("aria-disabled", value); | ||
695 | - } | ||
696 | - }, | ||
697 | - | ||
698 | - disable: function(index, type){ | ||
699 | - // if options is not provided, call the parents disable function | ||
700 | - if ( typeof( index ) == 'undefined' ) { | ||
701 | - this._setOption( 'disabled', true ); | ||
702 | - } else { | ||
703 | - if ( type == "optgroup" ) { | ||
704 | - this._disableOptgroup(index); | ||
705 | - } else { | ||
706 | - this._disableOption(index); | ||
707 | - } | ||
708 | - } | ||
709 | - }, | ||
710 | - | ||
711 | - enable: function(index, type) { | ||
712 | - // if options is not provided, call the parents enable function | ||
713 | - if ( typeof( index ) == 'undefined' ) { | ||
714 | - this._setOption('disabled', false); | ||
715 | - } else { | ||
716 | - if ( type == "optgroup" ) { | ||
717 | - this._enableOptgroup(index); | ||
718 | - } else { | ||
719 | - this._enableOption(index); | ||
720 | - } | ||
721 | - } | ||
722 | - }, | ||
723 | - | ||
724 | - _disabled: function(elem) { | ||
725 | - return $(elem).hasClass( this.namespace + '-state-disabled' ); | ||
726 | - }, | ||
727 | - | ||
728 | - | ||
729 | - _disableOption: function(index) { | ||
730 | - var optionElem = this._optionLis.eq(index); | ||
731 | - if (optionElem) { | ||
732 | - optionElem.addClass(this.namespace + '-state-disabled') | ||
733 | - .find("a").attr("aria-disabled", true); | ||
734 | - this.element.find("option").eq(index).attr("disabled", "disabled"); | ||
735 | - } | ||
736 | - }, | ||
737 | - | ||
738 | - _enableOption: function(index) { | ||
739 | - var optionElem = this._optionLis.eq(index); | ||
740 | - if (optionElem) { | ||
741 | - optionElem.removeClass( this.namespace + '-state-disabled' ) | ||
742 | - .find("a").attr("aria-disabled", false); | ||
743 | - this.element.find("option").eq(index).removeAttr("disabled"); | ||
744 | - } | ||
745 | - }, | ||
746 | - | ||
747 | - _disableOptgroup: function(index) { | ||
748 | - var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index ); | ||
749 | - if (optGroupElem) { | ||
750 | - optGroupElem.addClass(this.namespace + '-state-disabled') | ||
751 | - .attr("aria-disabled", true); | ||
752 | - this.element.find("optgroup").eq(index).attr("disabled", "disabled"); | ||
753 | - } | ||
754 | - }, | ||
755 | - | ||
756 | - _enableOptgroup: function(index) { | ||
757 | - var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index ); | ||
758 | - if (optGroupElem) { | ||
759 | - optGroupElem.removeClass(this.namespace + '-state-disabled') | ||
760 | - .attr("aria-disabled", false); | ||
761 | - this.element.find("optgroup").eq(index).removeAttr("disabled"); | ||
762 | - } | ||
763 | - }, | ||
764 | - | ||
765 | - index: function(newValue) { | ||
766 | - if (arguments.length) { | ||
767 | - if (!this._disabled($(this._optionLis[newValue]))) { | ||
768 | - this.element[0].selectedIndex = newValue; | ||
769 | - this._refreshValue(); | ||
770 | - } else { | ||
771 | - return false; | ||
772 | - } | ||
773 | - } else { | ||
774 | - return this._selectedIndex(); | ||
775 | - } | ||
776 | - }, | ||
777 | - | ||
778 | - value: function(newValue) { | ||
779 | - if (arguments.length) { | ||
780 | - this.element[0].value = newValue; | ||
781 | - this._refreshValue(); | ||
782 | - } else { | ||
783 | - return this.element[0].value; | ||
784 | - } | ||
785 | - }, | ||
786 | - | ||
787 | - _refreshValue: function() { | ||
788 | - var activeClass = (this.options.style == "popup") ? " ui-state-active" : ""; | ||
789 | - var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); | ||
790 | - // deselect previous | ||
791 | - this.list | ||
792 | - .find('.' + this.widgetBaseClass + '-item-selected') | ||
793 | - .removeClass(this.widgetBaseClass + "-item-selected" + activeClass) | ||
794 | - .find('a') | ||
795 | - .attr('aria-selected', 'false') | ||
796 | - .attr('id', ''); | ||
797 | - // select new | ||
798 | - this._selectedOptionLi() | ||
799 | - .addClass(this.widgetBaseClass + "-item-selected" + activeClass) | ||
800 | - .find('a') | ||
801 | - .attr('aria-selected', 'true') | ||
802 | - .attr('id', activeID); | ||
803 | - | ||
804 | - // toggle any class brought in from option | ||
805 | - var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : ""); | ||
806 | - var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : ""); | ||
807 | - this.newelement | ||
808 | - .removeClass(currentOptionClasses) | ||
809 | - .data('optionClasses', newOptionClasses) | ||
810 | - .addClass( newOptionClasses ) | ||
811 | - .find('.' + this.widgetBaseClass + '-status') | ||
812 | - .html( | ||
813 | - this._selectedOptionLi() | ||
814 | - .find('a:eq(0)') | ||
815 | - .html() | ||
816 | - ); | ||
817 | - | ||
818 | - this.list.attr('aria-activedescendant', activeID); | ||
819 | - }, | ||
820 | - | ||
821 | - _refreshPosition: function() { | ||
822 | - var o = this.options; | ||
823 | - | ||
824 | - // if its a native pop-up we need to calculate the position of the selected li | ||
825 | - if ( o.style == "popup" && !o.positionOptions.offset ) { | ||
826 | - var selected = this._selectedOptionLi(); | ||
827 | - var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top ); | ||
828 | - } | ||
829 | - // update zIndex if jQuery UI is able to process | ||
830 | - var zIndexElement = this.element.zIndex(); | ||
831 | - if ( zIndexElement ) { | ||
832 | - this.listWrap.css( 'zIndex', zIndexElement ); | ||
833 | - } | ||
834 | - this.listWrap.position({ | ||
835 | - // set options for position plugin | ||
836 | - of: o.positionOptions.of || this.newelement, | ||
837 | - my: o.positionOptions.my, | ||
838 | - at: o.positionOptions.at, | ||
839 | - offset: o.positionOptions.offset || _offset, | ||
840 | - collision: o.positionOptions.collision || 'flip' | ||
841 | - }); | ||
842 | - } | 15 | + getter: "value", |
16 | + version: "1.8", | ||
17 | + eventPrefix: "selectmenu", | ||
18 | + options: { | ||
19 | + transferClasses: true, | ||
20 | + typeAhead: "sequential", | ||
21 | + style: 'dropdown', | ||
22 | + positionOptions: { | ||
23 | + my: "left top", | ||
24 | + at: "left bottom", | ||
25 | + offset: null | ||
26 | + }, | ||
27 | + width: null, | ||
28 | + menuWidth: null, | ||
29 | + handleWidth: 26, | ||
30 | + maxHeight: null, | ||
31 | + icons: null, | ||
32 | + format: null, | ||
33 | + bgImage: function() {}, | ||
34 | + wrapperElement: "<div />" | ||
35 | + }, | ||
36 | + | ||
37 | + _create: function() { | ||
38 | + var self = this, o = this.options; | ||
39 | + | ||
40 | + // set a default id value, generate a new random one if not set by developer | ||
41 | + var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ); | ||
42 | + | ||
43 | + // quick array of button and menu id's | ||
44 | + this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ]; | ||
45 | + | ||
46 | + // define safe mouseup for future toggling | ||
47 | + this._safemouseup = true; | ||
48 | + | ||
49 | + // create menu button wrapper | ||
50 | + this.newelement = $( '<a />', { | ||
51 | + 'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all', | ||
52 | + 'id' : this.ids[ 0 ], | ||
53 | + 'role': 'button', | ||
54 | + 'href': '#nogo', | ||
55 | + 'tabindex': this.element.attr( 'disabled' ) ? 1 : 0, | ||
56 | + 'aria-haspopup': true, | ||
57 | + 'aria-owns': this.ids[ 1 ] | ||
58 | + }); | ||
59 | + this.newelementWrap = $( o.wrapperElement ) | ||
60 | + .append( this.newelement ) | ||
61 | + .insertAfter( this.element ); | ||
62 | + | ||
63 | + // transfer tabindex | ||
64 | + var tabindex = this.element.attr( 'tabindex' ); | ||
65 | + if ( tabindex ) { | ||
66 | + this.newelement.attr( 'tabindex', tabindex ); | ||
67 | + } | ||
68 | + | ||
69 | + // save reference to select in data for ease in calling methods | ||
70 | + this.newelement.data( 'selectelement', this.element ); | ||
71 | + | ||
72 | + // menu icon | ||
73 | + this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' ) | ||
74 | + .prependTo( this.newelement ); | ||
75 | + | ||
76 | + // append status span to button | ||
77 | + this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' ); | ||
78 | + | ||
79 | + // make associated form label trigger focus | ||
80 | + $( 'label[for="' + selectmenuId + '"]' ) | ||
81 | + .attr( 'for', this.ids[0] ) | ||
82 | + .bind( 'click.selectmenu', function() { | ||
83 | + self.newelement[0].focus(); | ||
84 | + return false; | ||
85 | + }); | ||
86 | + | ||
87 | + // click toggle for menu visibility | ||
88 | + this.newelement | ||
89 | + .bind('mousedown.selectmenu', function(event) { | ||
90 | + self._toggle(event, true); | ||
91 | + // make sure a click won't open/close instantly | ||
92 | + if (o.style == "popup") { | ||
93 | + self._safemouseup = false; | ||
94 | + setTimeout(function() { self._safemouseup = true; }, 300); | ||
95 | + } | ||
96 | + return false; | ||
97 | + }) | ||
98 | + .bind('click.selectmenu', function() { | ||
99 | + return false; | ||
100 | + }) | ||
101 | + .bind("keydown.selectmenu", function(event) { | ||
102 | + var ret = false; | ||
103 | + switch (event.keyCode) { | ||
104 | + case $.ui.keyCode.ENTER: | ||
105 | + ret = true; | ||
106 | + break; | ||
107 | + case $.ui.keyCode.SPACE: | ||
108 | + self._toggle(event); | ||
109 | + break; | ||
110 | + case $.ui.keyCode.UP: | ||
111 | + if (event.altKey) { | ||
112 | + self.open(event); | ||
113 | + } else { | ||
114 | + self._moveSelection(-1); | ||
115 | + } | ||
116 | + break; | ||
117 | + case $.ui.keyCode.DOWN: | ||
118 | + if (event.altKey) { | ||
119 | + self.open(event); | ||
120 | + } else { | ||
121 | + self._moveSelection(1); | ||
122 | + } | ||
123 | + break; | ||
124 | + case $.ui.keyCode.LEFT: | ||
125 | + self._moveSelection(-1); | ||
126 | + break; | ||
127 | + case $.ui.keyCode.RIGHT: | ||
128 | + self._moveSelection(1); | ||
129 | + break; | ||
130 | + case $.ui.keyCode.TAB: | ||
131 | + ret = true; | ||
132 | + break; | ||
133 | + default: | ||
134 | + ret = true; | ||
135 | + } | ||
136 | + return ret; | ||
137 | + }) | ||
138 | + .bind('keypress.selectmenu', function(event) { | ||
139 | + self._typeAhead(event.which, 'mouseup'); | ||
140 | + return true; | ||
141 | + }) | ||
142 | + .bind('mouseover.selectmenu focus.selectmenu', function() { | ||
143 | + if (!o.disabled) { | ||
144 | + $(this).addClass(self.widgetBaseClass + '-focus ui-state-hover'); | ||
145 | + } | ||
146 | + }) | ||
147 | + .bind('mouseout.selectmenu blur.selectmenu', function() { | ||
148 | + if (!o.disabled) { | ||
149 | + $(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover'); | ||
150 | + } | ||
151 | + }); | ||
152 | + | ||
153 | + // document click closes menu | ||
154 | + $(document).bind("mousedown.selectmenu", function(event) { | ||
155 | + self.close(event); | ||
156 | + }); | ||
157 | + | ||
158 | + // change event on original selectmenu | ||
159 | + this.element | ||
160 | + .bind("click.selectmenu", function() { | ||
161 | + self._refreshValue(); | ||
162 | + }) | ||
163 | + // FIXME: newelement can be null under unclear circumstances in IE8 | ||
164 | + // TODO not sure if this is still a problem (fnagel 20.03.11) | ||
165 | + .bind("focus.selectmenu", function() { | ||
166 | + if (self.newelement) { | ||
167 | + self.newelement[0].focus(); | ||
168 | + } | ||
169 | + }); | ||
170 | + | ||
171 | + // set width when not set via options | ||
172 | + if (!o.width) { | ||
173 | + o.width = this.element.outerWidth(); | ||
174 | + } | ||
175 | + // set menu button width | ||
176 | + this.newelement.width(o.width); | ||
177 | + | ||
178 | + // hide original selectmenu element | ||
179 | + this.element.hide(); | ||
180 | + | ||
181 | + // create menu portion, append to body | ||
182 | + this.list = $( '<ul />', { | ||
183 | + 'class': 'ui-widget ui-widget-content', | ||
184 | + 'aria-hidden': true, | ||
185 | + 'role': 'listbox', | ||
186 | + 'aria-labelledby': this.ids[0], | ||
187 | + 'id': this.ids[1] | ||
188 | + }); | ||
189 | + this.listWrap = $( o.wrapperElement ) | ||
190 | + .addClass( self.widgetBaseClass + '-menu' ) | ||
191 | + .append( this.list ) | ||
192 | + .appendTo( 'body' ); | ||
193 | + | ||
194 | + // transfer menu click to menu button | ||
195 | + this.list | ||
196 | + .bind("keydown.selectmenu", function(event) { | ||
197 | + var ret = false; | ||
198 | + switch (event.keyCode) { | ||
199 | + case $.ui.keyCode.UP: | ||
200 | + if (event.altKey) { | ||
201 | + self.close(event, true); | ||
202 | + } else { | ||
203 | + self._moveFocus(-1); | ||
204 | + } | ||
205 | + break; | ||
206 | + case $.ui.keyCode.DOWN: | ||
207 | + if (event.altKey) { | ||
208 | + self.close(event, true); | ||
209 | + } else { | ||
210 | + self._moveFocus(1); | ||
211 | + } | ||
212 | + break; | ||
213 | + case $.ui.keyCode.LEFT: | ||
214 | + self._moveFocus(-1); | ||
215 | + break; | ||
216 | + case $.ui.keyCode.RIGHT: | ||
217 | + self._moveFocus(1); | ||
218 | + break; | ||
219 | + case $.ui.keyCode.HOME: | ||
220 | + self._moveFocus(':first'); | ||
221 | + break; | ||
222 | + case $.ui.keyCode.PAGE_UP: | ||
223 | + self._scrollPage('up'); | ||
224 | + break; | ||
225 | + case $.ui.keyCode.PAGE_DOWN: | ||
226 | + self._scrollPage('down'); | ||
227 | + break; | ||
228 | + case $.ui.keyCode.END: | ||
229 | + self._moveFocus(':last'); | ||
230 | + break; | ||
231 | + case $.ui.keyCode.ENTER: | ||
232 | + case $.ui.keyCode.SPACE: | ||
233 | + self.close(event, true); | ||
234 | + $(event.target).parents('li:eq(0)').trigger('mouseup'); | ||
235 | + break; | ||
236 | + case $.ui.keyCode.TAB: | ||
237 | + ret = true; | ||
238 | + self.close(event, true); | ||
239 | + $(event.target).parents('li:eq(0)').trigger('mouseup'); | ||
240 | + break; | ||
241 | + case $.ui.keyCode.ESCAPE: | ||
242 | + self.close(event, true); | ||
243 | + break; | ||
244 | + default: | ||
245 | + ret = true; | ||
246 | + } | ||
247 | + return ret; | ||
248 | + }) | ||
249 | + .bind('keypress.selectmenu', function(event) { | ||
250 | + self._typeAhead(event.which, 'focus'); | ||
251 | + return true; | ||
252 | + }) | ||
253 | + // this allows for using the scrollbar in an overflowed list | ||
254 | + .bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; }); | ||
255 | + | ||
256 | + // needed when window is resized | ||
257 | + // TODO seems to be useless, but causes errors (fnagel 01.08.11) | ||
258 | + // see: https://github.com/fnagel/jquery-ui/issues/147 | ||
259 | + // $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) ); | ||
260 | + }, | ||
261 | + | ||
262 | + _init: function() { | ||
263 | + var self = this, o = this.options; | ||
264 | + | ||
265 | + // serialize selectmenu element options | ||
266 | + var selectOptionData = []; | ||
267 | + this.element | ||
268 | + .find('option') | ||
269 | + .each(function() { | ||
270 | + var opt = $(this); | ||
271 | + selectOptionData.push({ | ||
272 | + value: opt.attr('value'), | ||
273 | + text: self._formatText(opt.text()), | ||
274 | + selected: opt.attr('selected'), | ||
275 | + disabled: opt.attr('disabled'), | ||
276 | + classes: opt.attr('class'), | ||
277 | + typeahead: opt.attr('typeahead'), | ||
278 | + parentOptGroup: opt.parent('optgroup'), | ||
279 | + bgImage: o.bgImage.call(opt) | ||
280 | + }); | ||
281 | + }); | ||
282 | + | ||
283 | + // active state class is only used in popup style | ||
284 | + var activeClass = (self.options.style == "popup") ? " ui-state-active" : ""; | ||
285 | + | ||
286 | + // empty list so we can refresh the selectmenu via selectmenu() | ||
287 | + this.list.html(""); | ||
288 | + | ||
289 | + // write li's | ||
290 | + if (selectOptionData.length) { | ||
291 | + for (var i = 0; i < selectOptionData.length; i++) { | ||
292 | + var thisLiAttr = { role : 'presentation' }; | ||
293 | + if ( selectOptionData[ i ].disabled ) { | ||
294 | + thisLiAttr[ 'class' ] = this.namespace + '-state-disabled'; | ||
295 | + } | ||
296 | + var thisAAttr = { | ||
297 | + html: selectOptionData[i].text, | ||
298 | + href : '#nogo', | ||
299 | + tabindex : -1, | ||
300 | + role : 'option', | ||
301 | + 'aria-selected' : false | ||
302 | + }; | ||
303 | + if ( selectOptionData[ i ].disabled ) { | ||
304 | + thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled; | ||
305 | + } | ||
306 | + if ( selectOptionData[ i ].typeahead ) { | ||
307 | + thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead; | ||
308 | + } | ||
309 | + var thisA = $('<a/>', thisAAttr); | ||
310 | + var thisLi = $('<li/>', thisLiAttr) | ||
311 | + .append(thisA) | ||
312 | + .data('index', i) | ||
313 | + .addClass(selectOptionData[i].classes) | ||
314 | + .data('optionClasses', selectOptionData[i].classes || '') | ||
315 | + .bind("mouseup.selectmenu", function(event) { | ||
316 | + if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) { | ||
317 | + var changed = $(this).data('index') != self._selectedIndex(); | ||
318 | + self.index($(this).data('index')); | ||
319 | + self.select(event); | ||
320 | + if (changed) { | ||
321 | + self.change(event); | ||
322 | + } | ||
323 | + self.close(event, true); | ||
324 | + } | ||
325 | + return false; | ||
326 | + }) | ||
327 | + .bind("click.selectmenu", function() { | ||
328 | + return false; | ||
329 | + }) | ||
330 | + .bind('mouseover.selectmenu focus.selectmenu', function(e) { | ||
331 | + // no hover if diabled | ||
332 | + if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) { | ||
333 | + self._selectedOptionLi().addClass(activeClass); | ||
334 | + self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); | ||
335 | + $(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover'); | ||
336 | + } | ||
337 | + }) | ||
338 | + .bind('mouseout.selectmenu blur.selectmenu', function() { | ||
339 | + if ($(this).is(self._selectedOptionLi().selector)) { | ||
340 | + $(this).addClass(activeClass); | ||
341 | + } | ||
342 | + $(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); | ||
343 | + }); | ||
344 | + | ||
345 | + // optgroup or not... | ||
346 | + if ( selectOptionData[i].parentOptGroup.length ) { | ||
347 | + var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup ); | ||
348 | + if (this.list.find( 'li.' + optGroupName ).length ) { | ||
349 | + this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi ); | ||
350 | + } else { | ||
351 | + $(' <li role="presentation" class="' + self.widgetBaseClass + '-group ' + optGroupName + (selectOptionData[i].parentOptGroup.attr("disabled") ? ' ' + this.namespace + '-state-disabled" aria-disabled="true"' : '"' ) + '><span class="' + self.widgetBaseClass + '-group-label">' + selectOptionData[i].parentOptGroup.attr('label') + '</span><ul></ul></li> ') | ||
352 | + .appendTo( this.list ) | ||
353 | + .find( 'ul' ) | ||
354 | + .append( thisLi ); | ||
355 | + } | ||
356 | + } else { | ||
357 | + thisLi.appendTo(this.list); | ||
358 | + } | ||
359 | + | ||
360 | + // append icon if option is specified | ||
361 | + if (o.icons) { | ||
362 | + for (var j in o.icons) { | ||
363 | + if (thisLi.is(o.icons[j].find)) { | ||
364 | + thisLi | ||
365 | + .data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon') | ||
366 | + .addClass(self.widgetBaseClass + '-hasIcon'); | ||
367 | + var iconClass = o.icons[j].icon || ""; | ||
368 | + thisLi | ||
369 | + .find('a:eq(0)') | ||
370 | + .prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>'); | ||
371 | + if (selectOptionData[i].bgImage) { | ||
372 | + thisLi.find('span').css('background-image', selectOptionData[i].bgImage); | ||
373 | + } | ||
374 | + } | ||
375 | + } | ||
376 | + } | ||
377 | + } | ||
378 | + } else { | ||
379 | + $('<li role="presentation"><a href="#nogo" tabindex="-1" role="option"></a></li>').appendTo(this.list); | ||
380 | + } | ||
381 | + // we need to set and unset the CSS classes for dropdown and popup style | ||
382 | + var isDropDown = ( o.style == 'dropdown' ); | ||
383 | + this.newelement | ||
384 | + .toggleClass( self.widgetBaseClass + '-dropdown', isDropDown ) | ||
385 | + .toggleClass( self.widgetBaseClass + '-popup', !isDropDown ); | ||
386 | + this.list | ||
387 | + .toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown ) | ||
388 | + .toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown ) | ||
389 | + // add corners to top and bottom menu items | ||
390 | + .find( 'li:first' ) | ||
391 | + .toggleClass( 'ui-corner-top', !isDropDown ) | ||
392 | + .end().find( 'li:last' ) | ||
393 | + .addClass( 'ui-corner-bottom' ); | ||
394 | + this.selectmenuIcon | ||
395 | + .toggleClass( 'ui-icon-triangle-1-s', isDropDown ) | ||
396 | + .toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown ); | ||
397 | + | ||
398 | + // transfer classes to selectmenu and list | ||
399 | + if ( o.transferClasses ) { | ||
400 | + var transferClasses = this.element.attr( 'class' ) || ''; | ||
401 | + this.newelement.add( this.list ).addClass( transferClasses ); | ||
402 | + } | ||
403 | + | ||
404 | + // set menu width to either menuWidth option value, width option value, or select width | ||
405 | + if ( o.style == 'dropdown' ) { | ||
406 | + this.list.width( o.menuWidth ? o.menuWidth : o.width ); | ||
407 | + } else { | ||
408 | + this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth ); | ||
409 | + } | ||
410 | + | ||
411 | + // reset height to auto | ||
412 | + this.list.css( 'height', 'auto' ); | ||
413 | + var listH = this.listWrap.height(); | ||
414 | + // calculate default max height | ||
415 | + if ( o.maxHeight && o.maxHeight < listH ) { | ||
416 | + this.list.height( o.maxHeight ); | ||
417 | + } else { | ||
418 | + var winH = $( window ).height() / 3; | ||
419 | + if ( winH < listH ) this.list.height( winH ); | ||
420 | + } | ||
421 | + | ||
422 | + // save reference to actionable li's (not group label li's) | ||
423 | + this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' ); | ||
424 | + | ||
425 | + // transfer disabled state | ||
426 | + if ( this.element.attr( 'disabled' ) ) { | ||
427 | + this.disable(); | ||
428 | + } else { | ||
429 | + this.enable() | ||
430 | + } | ||
431 | + | ||
432 | + // update value | ||
433 | + this.index( this._selectedIndex() ); | ||
434 | + | ||
435 | + // needed when selectmenu is placed at the very bottom / top of the page | ||
436 | + window.setTimeout( function() { | ||
437 | + self._refreshPosition(); | ||
438 | + }, 200 ); | ||
439 | + }, | ||
440 | + | ||
441 | + destroy: function() { | ||
442 | + this.element.removeData( this.widgetName ) | ||
443 | + .removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' ) | ||
444 | + .removeAttr( 'aria-disabled' ) | ||
445 | + .unbind( ".selectmenu" ); | ||
446 | + | ||
447 | + // TODO unneded as event binding has been disabled | ||
448 | + // $( window ).unbind( ".selectmenu" ); | ||
449 | + $( document ).unbind( ".selectmenu" ); | ||
450 | + | ||
451 | + // unbind click on label, reset its for attr | ||
452 | + $( 'label[for=' + this.newelement.attr('id') + ']' ) | ||
453 | + .attr( 'for', this.element.attr( 'id' ) ) | ||
454 | + .unbind( '.selectmenu' ); | ||
455 | + | ||
456 | + this.newelementWrap.remove(); | ||
457 | + this.listWrap.remove(); | ||
458 | + | ||
459 | + this.element.show(); | ||
460 | + | ||
461 | + // call widget destroy function | ||
462 | + $.Widget.prototype.destroy.apply(this, arguments); | ||
463 | + }, | ||
464 | + | ||
465 | + _typeAhead: function( code, eventType ){ | ||
466 | + var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase(); | ||
467 | + c = C.toLowerCase(); | ||
468 | + | ||
469 | + if ( self.options.typeAhead == 'sequential' ) { | ||
470 | + // clear the timeout so we can use _prevChar | ||
471 | + window.clearTimeout('ui.selectmenu-' + self.selectmenuId); | ||
472 | + | ||
473 | + // define our find var | ||
474 | + var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' ); | ||
475 | + | ||
476 | + function focusOptSeq( elem, ind, c ){ | ||
477 | + focusFound = true; | ||
478 | + $( elem ).trigger( eventType ); | ||
479 | + typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c; | ||
480 | + } | ||
481 | + this.list.find( 'li a' ).each( function( i ) { | ||
482 | + if ( !focusFound ) { | ||
483 | + // allow the typeahead attribute on the option tag for a more specific lookup | ||
484 | + var thisText = $( this ).attr( 'typeahead' ) || $(this).text(); | ||
485 | + if ( thisText.indexOf( find + C ) === 0 ) { | ||
486 | + focusOptSeq( this, i, C ); | ||
487 | + } else if (thisText.indexOf(find+c) === 0 ) { | ||
488 | + focusOptSeq( this, i, c ); | ||
489 | + } | ||
490 | + } | ||
491 | + }); | ||
492 | + // set a 1 second timeout for sequenctial typeahead | ||
493 | + // keep this set even if we have no matches so it doesnt typeahead somewhere else | ||
494 | + window.setTimeout( function( el ) { | ||
495 | + self._prevChar = undefined; | ||
496 | + }, 1000, self ); | ||
497 | + | ||
498 | + } else { | ||
499 | + // define self._prevChar if needed | ||
500 | + if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; } | ||
501 | + | ||
502 | + focusFound = false; | ||
503 | + function focusOpt( elem, ind ){ | ||
504 | + focusFound = true; | ||
505 | + $( elem ).trigger( eventType ); | ||
506 | + self._prevChar[ 1 ] = ind; | ||
507 | + } | ||
508 | + this.list.find( 'li a' ).each(function( i ){ | ||
509 | + if (!focusFound){ | ||
510 | + var thisText = $(this).text(); | ||
511 | + if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) { | ||
512 | + if (self._prevChar[0] == C){ | ||
513 | + if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); } | ||
514 | + } else{ | ||
515 | + focusOpt( this, i ); | ||
516 | + } | ||
517 | + } | ||
518 | + } | ||
519 | + }); | ||
520 | + this._prevChar[ 0 ] = C; | ||
521 | + } | ||
522 | + }, | ||
523 | + | ||
524 | + // returns some usefull information, called by callbacks only | ||
525 | + _uiHash: function() { | ||
526 | + var index = this.index(); | ||
527 | + return { | ||
528 | + index: index, | ||
529 | + option: $("option", this.element).get(index), | ||
530 | + value: this.element[0].value | ||
531 | + }; | ||
532 | + }, | ||
533 | + | ||
534 | + open: function(event) { | ||
535 | + var self = this, o = this.options; | ||
536 | + if ( self.newelement.attr("aria-disabled") != 'true' ) { | ||
537 | + self._closeOthers(event); | ||
538 | + self.newelement.addClass('ui-state-active'); | ||
539 | + | ||
540 | + self.listWrap.appendTo( o.appendTo ); | ||
541 | + self.list.attr('aria-hidden', false); | ||
542 | + | ||
543 | + if ( o.style == "dropdown" ) { | ||
544 | + self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); | ||
545 | + } | ||
546 | + | ||
547 | + self.listWrap.addClass( self.widgetBaseClass + '-open' ); | ||
548 | + // positioning needed for IE7 (tested 01.08.11 on MS VPC Image) | ||
549 | + // see https://github.com/fnagel/jquery-ui/issues/147 | ||
550 | + if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) { | ||
551 | + self._refreshPosition(); | ||
552 | + } | ||
553 | + var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + '):visible a'); | ||
554 | + if (selected.length) selected[0].focus(); | ||
555 | + // positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image) | ||
556 | + self._refreshPosition(); | ||
557 | + | ||
558 | + self._trigger("open", event, self._uiHash()); | ||
559 | + } | ||
560 | + }, | ||
561 | + | ||
562 | + close: function(event, retainFocus) { | ||
563 | + if ( this.newelement.is('.ui-state-active') ) { | ||
564 | + this.newelement | ||
565 | + .removeClass('ui-state-active'); | ||
566 | + this.listWrap.removeClass(this.widgetBaseClass + '-open'); | ||
567 | + this.list.attr('aria-hidden', true); | ||
568 | + if ( this.options.style == "dropdown" ) { | ||
569 | + this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); | ||
570 | + } | ||
571 | + if ( retainFocus ) { | ||
572 | + this.newelement.focus(); | ||
573 | + } | ||
574 | + this._trigger("close", event, this._uiHash()); | ||
575 | + } | ||
576 | + }, | ||
577 | + | ||
578 | + change: function(event) { | ||
579 | + this.element.trigger("change"); | ||
580 | + this._trigger("change", event, this._uiHash()); | ||
581 | + }, | ||
582 | + | ||
583 | + select: function(event) { | ||
584 | + if (this._disabled(event.currentTarget)) { return false; } | ||
585 | + this._trigger("select", event, this._uiHash()); | ||
586 | + }, | ||
587 | + | ||
588 | + _closeOthers: function(event) { | ||
589 | + $('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() { | ||
590 | + $(this).data('selectelement').selectmenu('close', event); | ||
591 | + }); | ||
592 | + $('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout'); | ||
593 | + }, | ||
594 | + | ||
595 | + _toggle: function(event, retainFocus) { | ||
596 | + if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) { | ||
597 | + this.close(event, retainFocus); | ||
598 | + } else { | ||
599 | + this.open(event); | ||
600 | + } | ||
601 | + }, | ||
602 | + | ||
603 | + _formatText: function(text) { | ||
604 | + return (this.options.format ? this.options.format(text) : text); | ||
605 | + }, | ||
606 | + | ||
607 | + _selectedIndex: function() { | ||
608 | + return this.element[0].selectedIndex; | ||
609 | + }, | ||
610 | + | ||
611 | + _selectedOptionLi: function() { | ||
612 | + return this._optionLis.eq(this._selectedIndex()); | ||
613 | + }, | ||
614 | + | ||
615 | + _focusedOptionLi: function() { | ||
616 | + return this.list.find('.' + this.widgetBaseClass + '-item-focus'); | ||
617 | + }, | ||
618 | + | ||
619 | + _moveSelection: function(amt, recIndex) { | ||
620 | + // do nothing if disabled | ||
621 | + if (!this.options.disabled) { | ||
622 | + var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10); | ||
623 | + var newIndex = currIndex + amt; | ||
624 | + // do not loop when using up key | ||
625 | + | ||
626 | + if (newIndex < 0) { | ||
627 | + newIndex = 0; | ||
628 | + } | ||
629 | + if (newIndex > this._optionLis.size() - 1) { | ||
630 | + newIndex = this._optionLis.size() - 1; | ||
631 | + } | ||
632 | + // Occurs when a full loop has been made | ||
633 | + if (newIndex === recIndex) { return false; } | ||
634 | + | ||
635 | + if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) { | ||
636 | + // if option at newIndex is disabled, call _moveFocus, incrementing amt by one | ||
637 | + (amt > 0) ? ++amt : --amt; | ||
638 | + this._moveSelection(amt, newIndex); | ||
639 | + } else { | ||
640 | + return this._optionLis.eq(newIndex).trigger('mouseup'); | ||
641 | + } | ||
642 | + } | ||
643 | + }, | ||
644 | + | ||
645 | + _moveFocus: function(amt, recIndex) { | ||
646 | + if (!isNaN(amt)) { | ||
647 | + var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10); | ||
648 | + var newIndex = currIndex + amt; | ||
649 | + } else { | ||
650 | + var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); | ||
651 | + } | ||
652 | + | ||
653 | + if (newIndex < 0) { | ||
654 | + newIndex = 0; | ||
655 | + } | ||
656 | + if (newIndex > this._optionLis.size() - 1) { | ||
657 | + newIndex = this._optionLis.size() - 1; | ||
658 | + } | ||
659 | + | ||
660 | + //Occurs when a full loop has been made | ||
661 | + if (newIndex === recIndex) { return false; } | ||
662 | + | ||
663 | + var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); | ||
664 | + | ||
665 | + this._focusedOptionLi().find('a:eq(0)').attr('id', ''); | ||
666 | + | ||
667 | + if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) { | ||
668 | + // if option at newIndex is disabled, call _moveFocus, incrementing amt by one | ||
669 | + (amt > 0) ? ++amt : --amt; | ||
670 | + this._moveFocus(amt, newIndex); | ||
671 | + } else { | ||
672 | + this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus(); | ||
673 | + } | ||
674 | + | ||
675 | + this.list.attr('aria-activedescendant', activeID); | ||
676 | + }, | ||
677 | + | ||
678 | + _scrollPage: function(direction) { | ||
679 | + var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight()); | ||
680 | + numPerPage = (direction == 'up' ? -numPerPage : numPerPage); | ||
681 | + this._moveFocus(numPerPage); | ||
682 | + }, | ||
683 | + | ||
684 | + _setOption: function(key, value) { | ||
685 | + this.options[key] = value; | ||
686 | + // set | ||
687 | + if (key == 'disabled') { | ||
688 | + this.close(); | ||
689 | + this.element | ||
690 | + .add(this.newelement) | ||
691 | + .add(this.list)[value ? 'addClass' : 'removeClass']( | ||
692 | + this.widgetBaseClass + '-disabled' + ' ' + | ||
693 | + this.namespace + '-state-disabled') | ||
694 | + .attr("aria-disabled", value); | ||
695 | + } | ||
696 | + }, | ||
697 | + | ||
698 | + disable: function(index, type){ | ||
699 | + // if options is not provided, call the parents disable function | ||
700 | + if ( typeof( index ) == 'undefined' ) { | ||
701 | + this._setOption( 'disabled', true ); | ||
702 | + } else { | ||
703 | + if ( type == "optgroup" ) { | ||
704 | + this._disableOptgroup(index); | ||
705 | + } else { | ||
706 | + this._disableOption(index); | ||
707 | + } | ||
708 | + } | ||
709 | + }, | ||
710 | + | ||
711 | + enable: function(index, type) { | ||
712 | + // if options is not provided, call the parents enable function | ||
713 | + if ( typeof( index ) == 'undefined' ) { | ||
714 | + this._setOption('disabled', false); | ||
715 | + } else { | ||
716 | + if ( type == "optgroup" ) { | ||
717 | + this._enableOptgroup(index); | ||
718 | + } else { | ||
719 | + this._enableOption(index); | ||
720 | + } | ||
721 | + } | ||
722 | + }, | ||
723 | + | ||
724 | + _disabled: function(elem) { | ||
725 | + return $(elem).hasClass( this.namespace + '-state-disabled' ); | ||
726 | + }, | ||
727 | + | ||
728 | + _disableOption: function(index) { | ||
729 | + var optionElem = this._optionLis.eq(index); | ||
730 | + if (optionElem) { | ||
731 | + optionElem.addClass(this.namespace + '-state-disabled') | ||
732 | + .find("a").attr("aria-disabled", true); | ||
733 | + this.element.find("option").eq(index).attr("disabled", "disabled"); | ||
734 | + } | ||
735 | + }, | ||
736 | + | ||
737 | + _enableOption: function(index) { | ||
738 | + var optionElem = this._optionLis.eq(index); | ||
739 | + if (optionElem) { | ||
740 | + optionElem.removeClass( this.namespace + '-state-disabled' ) | ||
741 | + .find("a").attr("aria-disabled", false); | ||
742 | + this.element.find("option").eq(index).removeAttr("disabled"); | ||
743 | + } | ||
744 | + }, | ||
745 | + | ||
746 | + _disableOptgroup: function(index) { | ||
747 | + var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index ); | ||
748 | + if (optGroupElem) { | ||
749 | + optGroupElem.addClass(this.namespace + '-state-disabled') | ||
750 | + .attr("aria-disabled", true); | ||
751 | + this.element.find("optgroup").eq(index).attr("disabled", "disabled"); | ||
752 | + } | ||
753 | + }, | ||
754 | + | ||
755 | + _enableOptgroup: function(index) { | ||
756 | + var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index ); | ||
757 | + if (optGroupElem) { | ||
758 | + optGroupElem.removeClass(this.namespace + '-state-disabled') | ||
759 | + .attr("aria-disabled", false); | ||
760 | + this.element.find("optgroup").eq(index).removeAttr("disabled"); | ||
761 | + } | ||
762 | + }, | ||
763 | + | ||
764 | + index: function(newValue) { | ||
765 | + if (arguments.length) { | ||
766 | + if (!this._disabled($(this._optionLis[newValue]))) { | ||
767 | + this.element[0].selectedIndex = newValue; | ||
768 | + this._refreshValue(); | ||
769 | + } else { | ||
770 | + return false; | ||
771 | + } | ||
772 | + } else { | ||
773 | + return this._selectedIndex(); | ||
774 | + } | ||
775 | + }, | ||
776 | + | ||
777 | + value: function(newValue) { | ||
778 | + if (arguments.length) { | ||
779 | + this.element[0].value = newValue; | ||
780 | + this._refreshValue(); | ||
781 | + } else { | ||
782 | + return this.element[0].value; | ||
783 | + } | ||
784 | + }, | ||
785 | + | ||
786 | + _refreshValue: function() { | ||
787 | + var activeClass = (this.options.style == "popup") ? " ui-state-active" : ""; | ||
788 | + var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); | ||
789 | + // deselect previous | ||
790 | + this.list | ||
791 | + .find('.' + this.widgetBaseClass + '-item-selected') | ||
792 | + .removeClass(this.widgetBaseClass + "-item-selected" + activeClass) | ||
793 | + .find('a') | ||
794 | + .attr('aria-selected', 'false') | ||
795 | + .attr('id', ''); | ||
796 | + // select new | ||
797 | + this._selectedOptionLi() | ||
798 | + .addClass(this.widgetBaseClass + "-item-selected" + activeClass) | ||
799 | + .find('a') | ||
800 | + .attr('aria-selected', 'true') | ||
801 | + .attr('id', activeID); | ||
802 | + | ||
803 | + // toggle any class brought in from option | ||
804 | + var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : ""); | ||
805 | + var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : ""); | ||
806 | + this.newelement | ||
807 | + .removeClass(currentOptionClasses) | ||
808 | + .data('optionClasses', newOptionClasses) | ||
809 | + .addClass( newOptionClasses ) | ||
810 | + .find('.' + this.widgetBaseClass + '-status') | ||
811 | + .html( | ||
812 | + this._selectedOptionLi() | ||
813 | + .find('a:eq(0)') | ||
814 | + .html() | ||
815 | + ); | ||
816 | + | ||
817 | + this.list.attr('aria-activedescendant', activeID); | ||
818 | + }, | ||
819 | + | ||
820 | + _refreshPosition: function() { | ||
821 | + var o = this.options; | ||
822 | + | ||
823 | + // if its a native pop-up we need to calculate the position of the selected li | ||
824 | + if ( o.style == "popup" && !o.positionOptions.offset ) { | ||
825 | + var selected = this._selectedOptionLi(); | ||
826 | + var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top ); | ||
827 | + } | ||
828 | + // update zIndex if jQuery UI is able to process | ||
829 | + var zIndexElement = this.element.zIndex(); | ||
830 | + if ( zIndexElement ) { | ||
831 | + this.listWrap.css( 'zIndex', zIndexElement ); | ||
832 | + } | ||
833 | + this.listWrap.position({ | ||
834 | + // set options for position plugin | ||
835 | + of: o.positionOptions.of || this.newelement, | ||
836 | + my: o.positionOptions.my, | ||
837 | + at: o.positionOptions.at, | ||
838 | + offset: o.positionOptions.offset || _offset, | ||
839 | + collision: o.positionOptions.collision || 'flip' | ||
840 | + }); | ||
841 | + } | ||
843 | }); | 842 | }); |
844 | 843 | ||
845 | })(jQuery); | 844 | })(jQuery); |
app/assets/javascripts/projects.js
@@ -8,7 +8,7 @@ $(document).ready(function(){ | @@ -8,7 +8,7 @@ $(document).ready(function(){ | ||
8 | e.stopPropagation(); | 8 | e.stopPropagation(); |
9 | $(this).find("td.tree-item-file-name a").click(); | 9 | $(this).find("td.tree-item-file-name a").click(); |
10 | return false; | 10 | return false; |
11 | - } | 11 | + } |
12 | }); | 12 | }); |
13 | 13 | ||
14 | $("#projects-list .project").live('click', function(e){ | 14 | $("#projects-list .project").live('click', function(e){ |
app/assets/stylesheets/application.css
@@ -3,5 +3,5 @@ | @@ -3,5 +3,5 @@ | ||
3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at | 3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at |
4 | * the top of the compiled file, but it's generally better to create a new file per style scope. | 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. |
5 | *= require_self | 5 | *= require_self |
6 | - *= require_tree . | 6 | + *= require_tree . |
7 | */ | 7 | */ |
app/assets/stylesheets/highlight.css.scss
1 | -@mixin round-borders-all($radius) { | 1 | +@mixin round-borders-all($radius) { |
2 | border: 1px solid #eaeaea; | 2 | border: 1px solid #eaeaea; |
3 | -moz-border-radius: $radius; | 3 | -moz-border-radius: $radius; |
4 | -webkit-border-radius: $radius; | 4 | -webkit-border-radius: $radius; |
@@ -28,11 +28,11 @@ td.linenos{ | @@ -28,11 +28,11 @@ td.linenos{ | ||
28 | .highlight pre{ | 28 | .highlight pre{ |
29 | } | 29 | } |
30 | 30 | ||
31 | -.linenodiv pre { | 31 | +.linenodiv pre { |
32 | white-space:pre-line; | 32 | white-space:pre-line; |
33 | } | 33 | } |
34 | 34 | ||
35 | -td.linenos { | 35 | +td.linenos { |
36 | background:#ECECEC; | 36 | background:#ECECEC; |
37 | color:#777; | 37 | color:#777; |
38 | padding:10px 0px 0px 10px; | 38 | padding:10px 0px 0px 10px; |
@@ -42,7 +42,7 @@ td.linenos { | @@ -42,7 +42,7 @@ td.linenos { | ||
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | -td.code .highlight { | 45 | +td.code .highlight { |
46 | overflow: auto; | 46 | overflow: auto; |
47 | } | 47 | } |
48 | table.highlighttable pre{ | 48 | table.highlighttable pre{ |
@@ -53,9 +53,8 @@ table.highlighttable pre{ | @@ -53,9 +53,8 @@ table.highlighttable pre{ | ||
53 | text-align:left; | 53 | text-align:left; |
54 | } | 54 | } |
55 | 55 | ||
56 | - | ||
57 | .git-empty .highlight { | 56 | .git-empty .highlight { |
58 | - @include round-borders-all(4px); | 57 | + @include round-borders-all(4px); |
59 | background:#eee; | 58 | background:#eee; |
60 | padding:5px; | 59 | padding:5px; |
61 | //overflow-x:scroll; | 60 | //overflow-x:scroll; |
@@ -71,10 +70,9 @@ table.highlighttable pre{ | @@ -71,10 +70,9 @@ table.highlighttable pre{ | ||
71 | .shadow{ | 70 | .shadow{ |
72 | -webkit-box-shadow:0 5px 15px #000; | 71 | -webkit-box-shadow:0 5px 15px #000; |
73 | -moz-box-shadow:0 5px 15px #000; | 72 | -moz-box-shadow:0 5px 15px #000; |
74 | - box-shadow:0 5px 15px #000; | 73 | + box-shadow:0 5px 15px #000; |
75 | } | 74 | } |
76 | 75 | ||
77 | - | ||
78 | .hll { background-color: #ffffff } | 76 | .hll { background-color: #ffffff } |
79 | .c { color: #888888; font-style: italic } /* Comment */ | 77 | .c { color: #888888; font-style: italic } /* Comment */ |
80 | .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | 78 | .err { color: #a61717; background-color: #e3d2d2 } /* Error */ |
@@ -105,7 +103,7 @@ table.highlighttable pre{ | @@ -105,7 +103,7 @@ table.highlighttable pre{ | ||
105 | .highlight .nb{color:#0086B3;} /* Name.Builtin */ | 103 | .highlight .nb{color:#0086B3;} /* Name.Builtin */ |
106 | .highlight .nc{color:#458;font-weight:bold;} /* Name.Class */ | 104 | .highlight .nc{color:#458;font-weight:bold;} /* Name.Class */ |
107 | .highlight .no{color:#008080;} /* Name.Constant */ | 105 | .highlight .no{color:#008080;} /* Name.Constant */ |
108 | -.highlight .ni{color:#800080;} | 106 | +.highlight .ni{color:#800080;} |
109 | .highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */ | 107 | .highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */ |
110 | .highlight .nf{color:#900;font-weight:bold;} /* Name.Function */ | 108 | .highlight .nf{color:#900;font-weight:bold;} /* Name.Function */ |
111 | .highlight .nn{color:#005;font-weight:bold;} /* Name.Namespace */ | 109 | .highlight .nn{color:#005;font-weight:bold;} /* Name.Namespace */ |
app/assets/stylesheets/jquery.ui.selectmenu.css
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | .ui-selectmenu { background:none; font-size:12px;display: block; display: inline-block; position: relative; height: 2.2em; vertical-align: middle; text-decoration: none; overflow: hidden; zoom: 1; } | 3 | .ui-selectmenu { background:none; font-size:12px;display: block; display: inline-block; position: relative; height: 2.2em; vertical-align: middle; text-decoration: none; overflow: hidden; zoom: 1; } |
4 | .ui-selectmenu-icon { position:absolute; right:6px; margin-top:-8px; top: 50%; } | 4 | .ui-selectmenu-icon { position:absolute; right:6px; margin-top:-8px; top: 50%; } |
5 | .ui-selectmenu-menu { padding:0; margin:0; position:absolute; top: 0; display: none; z-index: 1005;} /* z-index: 1005 to make selectmenu work with dialog */ | 5 | .ui-selectmenu-menu { padding:0; margin:0; position:absolute; top: 0; display: none; z-index: 1005;} /* z-index: 1005 to make selectmenu work with dialog */ |
6 | -.ui-selectmenu-menu ul { padding:0; margin:0; list-style:none; position: relative; overflow: auto; overflow-y: auto ; overflow-x: hidden; } | 6 | +.ui-selectmenu-menu ul { padding:0; margin:0; list-style:none; position: relative; overflow: auto; overflow-y: auto ; overflow-x: hidden; } |
7 | .ui-selectmenu-open { display: block; } | 7 | .ui-selectmenu-open { display: block; } |
8 | .ui-selectmenu.ui-widget { background:none; } | 8 | .ui-selectmenu.ui-widget { background:none; } |
9 | .ui-selectmenu-menu-popup { margin-top: -1px; } | 9 | .ui-selectmenu-menu-popup { margin-top: -1px; } |
app/assets/stylesheets/projects.css.scss
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | // They will automatically be included in application.css. | 2 | // They will automatically be included in application.css. |
3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ |
4 | 4 | ||
5 | -@mixin round-borders-bottom($radius) { | 5 | +@mixin round-borders-bottom($radius) { |
6 | border-top: 1px solid #eaeaea; | 6 | border-top: 1px solid #eaeaea; |
7 | 7 | ||
8 | -moz-border-radius-bottomright: $radius; | 8 | -moz-border-radius-bottomright: $radius; |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | -webkit-border-bottom-right-radius: $radius; | 15 | -webkit-border-bottom-right-radius: $radius; |
16 | } | 16 | } |
17 | 17 | ||
18 | -@mixin round-borders-top($radius) { | 18 | +@mixin round-borders-top($radius) { |
19 | border-top: 1px solid #eaeaea; | 19 | border-top: 1px solid #eaeaea; |
20 | 20 | ||
21 | -moz-border-radius-topright: $radius; | 21 | -moz-border-radius-topright: $radius; |
@@ -28,14 +28,14 @@ | @@ -28,14 +28,14 @@ | ||
28 | -webkit-border-top-right-radius: $radius; | 28 | -webkit-border-top-right-radius: $radius; |
29 | } | 29 | } |
30 | 30 | ||
31 | -@mixin round-borders-all($radius) { | 31 | +@mixin round-borders-all($radius) { |
32 | border: 1px solid #eaeaea; | 32 | border: 1px solid #eaeaea; |
33 | -moz-border-radius: $radius; | 33 | -moz-border-radius: $radius; |
34 | -webkit-border-radius: $radius; | 34 | -webkit-border-radius: $radius; |
35 | border-radius: $radius; | 35 | border-radius: $radius; |
36 | } | 36 | } |
37 | 37 | ||
38 | -@mixin hover-color { | 38 | +@mixin hover-color { |
39 | background: #fff !important; | 39 | background: #fff !important; |
40 | background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#FFF6BF)) !important; | 40 | background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#FFF6BF)) !important; |
41 | background: -moz-linear-gradient(top,#fff,#FFF6BF) !important; | 41 | background: -moz-linear-gradient(top,#fff,#FFF6BF) !important; |
@@ -46,47 +46,47 @@ | @@ -46,47 +46,47 @@ | ||
46 | border:1px solid #CCC; | 46 | border:1px solid #CCC; |
47 | margin-bottom:1em; | 47 | margin-bottom:1em; |
48 | 48 | ||
49 | - .diff_file_header { | 49 | + .diff_file_header { |
50 | padding:5px 5px; | 50 | padding:5px 5px; |
51 | border-bottom:1px solid #CCC; | 51 | border-bottom:1px solid #CCC; |
52 | background: #eee; | 52 | background: #eee; |
53 | } | 53 | } |
54 | - .diff_file_content { | 54 | + .diff_file_content { |
55 | overflow-x: scroll; | 55 | overflow-x: scroll; |
56 | background:#fff; | 56 | background:#fff; |
57 | color:#333; | 57 | color:#333; |
58 | font-size: 12px; | 58 | font-size: 12px; |
59 | font-family: 'Courier New', 'andale mono','lucida console',monospace; | 59 | font-family: 'Courier New', 'andale mono','lucida console',monospace; |
60 | } | 60 | } |
61 | - .diff_file_content_image { | 61 | + .diff_file_content_image { |
62 | background:#eee; | 62 | background:#eee; |
63 | text-align:center; | 63 | text-align:center; |
64 | - img { | 64 | + img { |
65 | padding:100px; | 65 | padding:100px; |
66 | max-width:300px; | 66 | max-width:300px; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | -#logo { | ||
72 | - &:hover { | 71 | +#logo { |
72 | + &:hover { | ||
73 | background:none; | 73 | background:none; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | -.file_stats { | 77 | +.file_stats { |
78 | margin-bottom:10px; | 78 | margin-bottom:10px; |
79 | @include round-borders-all(4px); | 79 | @include round-borders-all(4px); |
80 | 80 | ||
81 | - span { | 81 | + span { |
82 | border-top: 1px solid #eaeaea; | 82 | border-top: 1px solid #eaeaea; |
83 | padding:5px 5px; | 83 | padding:5px 5px; |
84 | display:block; | 84 | display:block; |
85 | - &:first-child { | 85 | + &:first-child { |
86 | border-top:none; | 86 | border-top:none; |
87 | } | 87 | } |
88 | 88 | ||
89 | - img { | 89 | + img { |
90 | width:18px; | 90 | width:18px; |
91 | float:left; | 91 | float:left; |
92 | margin-right: 6px; | 92 | margin-right: 6px; |
@@ -94,15 +94,15 @@ | @@ -94,15 +94,15 @@ | ||
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | -.round-borders { | 97 | +.round-borders { |
98 | @include round-borders-all(4px); | 98 | @include round-borders-all(4px); |
99 | padding: 4px 0px; | 99 | padding: 4px 0px; |
100 | } | 100 | } |
101 | -table.round-borders { | 101 | +table.round-borders { |
102 | float:left; | 102 | float:left; |
103 | } | 103 | } |
104 | 104 | ||
105 | -.day-commits-table { | 105 | +.day-commits-table { |
106 | @include round-borders-all(4px); | 106 | @include round-borders-all(4px); |
107 | padding: 4px 0px; | 107 | padding: 4px 0px; |
108 | margin-bottom:10px; | 108 | margin-bottom:10px; |
@@ -110,55 +110,54 @@ table.round-borders { | @@ -110,55 +110,54 @@ table.round-borders { | ||
110 | width:100%; | 110 | width:100%; |
111 | background: #E6F1F6; | 111 | background: #E6F1F6; |
112 | 112 | ||
113 | - .day-header { | 113 | + .day-header { |
114 | padding:10px; | 114 | padding:10px; |
115 | h3 { | 115 | h3 { |
116 | margin:0px; | 116 | margin:0px; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | - ul { | 120 | + ul { |
121 | display:block; | 121 | display:block; |
122 | list-style:none; | 122 | list-style:none; |
123 | margin:0px; | 123 | margin:0px; |
124 | padding:0px; | 124 | padding:0px; |
125 | 125 | ||
126 | - li.commit { | 126 | + li.commit { |
127 | display:list-item; | 127 | display:list-item; |
128 | padding:8px; | 128 | padding:8px; |
129 | margin:0px; | 129 | margin:0px; |
130 | background: #F7FBFC; | 130 | background: #F7FBFC; |
131 | border-top: 1px solid #E2EAEE; | 131 | border-top: 1px solid #E2EAEE; |
132 | 132 | ||
133 | - &:first-child { | 133 | + &:first-child { |
134 | border-top: 1px solid #E2EAEE; | 134 | border-top: 1px solid #E2EAEE; |
135 | } | 135 | } |
136 | &:nth-child(2n+1) { | 136 | &:nth-child(2n+1) { |
137 | background: white; | 137 | background: white; |
138 | } | 138 | } |
139 | 139 | ||
140 | - a.button { | 140 | + a.button { |
141 | width:85px; | 141 | width:85px; |
142 | padding:10px; | 142 | padding:10px; |
143 | margin:0px; | 143 | margin:0px; |
144 | float:right; | 144 | float:right; |
145 | } | 145 | } |
146 | - p { | 146 | + p { |
147 | margin-bottom: 3px; | 147 | margin-bottom: 3px; |
148 | font-size: 13px; | 148 | font-size: 13px; |
149 | } | 149 | } |
150 | } | 150 | } |
151 | } | 151 | } |
152 | } | 152 | } |
153 | -@mixin panel-color { | 153 | +@mixin panel-color { |
154 | background: #111 !important; | 154 | background: #111 !important; |
155 | background: -webkit-gradient(linear,left top,left bottom,from(#333),to(#111)) !important; | 155 | background: -webkit-gradient(linear,left top,left bottom,from(#333),to(#111)) !important; |
156 | background: -moz-linear-gradient(top,#333,#111) !important; | 156 | background: -moz-linear-gradient(top,#333,#111) !important; |
157 | background: transparent 9 !important; | 157 | background: transparent 9 !important; |
158 | } | 158 | } |
159 | 159 | ||
160 | - | ||
161 | -#header-panel { | 160 | +#header-panel { |
162 | @include panel-color; | 161 | @include panel-color; |
163 | height:40px; | 162 | height:40px; |
164 | position:fixed; | 163 | position:fixed; |
@@ -178,23 +177,23 @@ table.round-borders { | @@ -178,23 +177,23 @@ table.round-borders { | ||
178 | color:white; | 177 | color:white; |
179 | } | 178 | } |
180 | 179 | ||
181 | - &.current { | 180 | + &.current { |
182 | border-bottom: 3px solid #EAEAEA !important; | 181 | border-bottom: 3px solid #EAEAEA !important; |
183 | padding: 10px 20px 0; | 182 | padding: 10px 20px 0; |
184 | color: #eaeaea; | 183 | color: #eaeaea; |
185 | } | 184 | } |
186 | } | 185 | } |
187 | - .search-holder { | 186 | + .search-holder { |
188 | float:left; | 187 | float:left; |
189 | - width:290px; | 188 | + width:290px; |
190 | input { | 189 | input { |
191 | @include round-borders-all(4px); | 190 | @include round-borders-all(4px); |
192 | - width:290px; | 191 | + width:290px; |
193 | border-color:#888; | 192 | border-color:#888; |
194 | padding:5px; | 193 | padding:5px; |
195 | background:#666; | 194 | background:#666; |
196 | color:#222; | 195 | color:#222; |
197 | - &:focus { | 196 | + &:focus { |
198 | background:#fff; | 197 | background:#fff; |
199 | color:#000; | 198 | color:#000; |
200 | } | 199 | } |
@@ -211,7 +210,7 @@ table.round-borders { | @@ -211,7 +210,7 @@ table.round-borders { | ||
211 | padding:20px; | 210 | padding:20px; |
212 | } | 211 | } |
213 | 212 | ||
214 | -body { | 213 | +body { |
215 | background: #eaeaea; | 214 | background: #eaeaea; |
216 | } | 215 | } |
217 | 216 | ||
@@ -220,7 +219,7 @@ a { | @@ -220,7 +219,7 @@ a { | ||
220 | } | 219 | } |
221 | 220 | ||
222 | .diff_file_content{ | 221 | .diff_file_content{ |
223 | - .old_line, .new_line { | 222 | + .old_line, .new_line { |
224 | background:#ECECEC; | 223 | background:#ECECEC; |
225 | color:#777; | 224 | color:#777; |
226 | width:15px; | 225 | width:15px; |
@@ -230,9 +229,8 @@ a { | @@ -230,9 +229,8 @@ a { | ||
230 | } | 229 | } |
231 | } | 230 | } |
232 | 231 | ||
233 | - | ||
234 | .view_file_content{ | 232 | .view_file_content{ |
235 | - .old_line, .new_line { | 233 | + .old_line, .new_line { |
236 | background:#ECECEC; | 234 | background:#ECECEC; |
237 | color:#777; | 235 | color:#777; |
238 | width:15px; | 236 | width:15px; |
@@ -249,20 +247,20 @@ a { | @@ -249,20 +247,20 @@ a { | ||
249 | border:1px solid #CCC; | 247 | border:1px solid #CCC; |
250 | margin-bottom:1em; | 248 | margin-bottom:1em; |
251 | 249 | ||
252 | - .view_file_header { | 250 | + .view_file_header { |
253 | padding:5px 5px; | 251 | padding:5px 5px; |
254 | border-bottom:1px solid #CCC; | 252 | border-bottom:1px solid #CCC; |
255 | background: #eee; | 253 | background: #eee; |
256 | } | 254 | } |
257 | - .view_file_content { | 255 | + .view_file_content { |
258 | background:#fff; | 256 | background:#fff; |
259 | color:#514721; | 257 | color:#514721; |
260 | font-size: 11px; | 258 | font-size: 11px; |
261 | } | 259 | } |
262 | - .view_file_content_image { | 260 | + .view_file_content_image { |
263 | background:#eee; | 261 | background:#eee; |
264 | text-align:center; | 262 | text-align:center; |
265 | - img { | 263 | + img { |
266 | padding:100px; | 264 | padding:100px; |
267 | max-width:300px; | 265 | max-width:300px; |
268 | } | 266 | } |
@@ -273,7 +271,7 @@ a { | @@ -273,7 +271,7 @@ a { | ||
273 | 271 | ||
274 | } | 272 | } |
275 | 273 | ||
276 | -input.ssh_project_url { | 274 | +input.ssh_project_url { |
277 | padding:5px; | 275 | padding:5px; |
278 | margin:0px; | 276 | margin:0px; |
279 | float:right; | 277 | float:right; |
@@ -281,12 +279,10 @@ input.ssh_project_url { | @@ -281,12 +279,10 @@ input.ssh_project_url { | ||
281 | text-align:center; | 279 | text-align:center; |
282 | } | 280 | } |
283 | 281 | ||
284 | - | ||
285 | - | ||
286 | -.day-commits-table li.commit { | 282 | +.day-commits-table li.commit { |
287 | cursor:pointer; | 283 | cursor:pointer; |
288 | 284 | ||
289 | - &:hover { | 285 | + &:hover { |
290 | @include hover-color; | 286 | @include hover-color; |
291 | } | 287 | } |
292 | } | 288 | } |
@@ -295,39 +291,39 @@ input.ssh_project_url { | @@ -295,39 +291,39 @@ input.ssh_project_url { | ||
295 | #FFF6BF | 291 | #FFF6BF |
296 | #FFD324 | 292 | #FFD324 |
297 | */ | 293 | */ |
298 | -#tree-slider tr.tree-item { | 294 | +#tree-slider tr.tree-item { |
299 | cursor:pointer; | 295 | cursor:pointer; |
300 | 296 | ||
301 | - &:hover { | 297 | + &:hover { |
302 | @include hover-color; | 298 | @include hover-color; |
303 | - td { | 299 | + td { |
304 | @include hover-color; | 300 | @include hover-color; |
305 | } | 301 | } |
306 | } | 302 | } |
307 | } | 303 | } |
308 | -#projects-list .project { | 304 | +#projects-list .project { |
309 | height:50px; | 305 | height:50px; |
310 | } | 306 | } |
311 | 307 | ||
312 | #projects-list .project, | 308 | #projects-list .project, |
313 | #snippets-table .snippet, | 309 | #snippets-table .snippet, |
314 | -#issues-table .issue{ | 310 | +#issues-table .issue{ |
315 | cursor:pointer; | 311 | cursor:pointer; |
316 | 312 | ||
317 | - &:hover { | 313 | + &:hover { |
318 | @include hover-color; | 314 | @include hover-color; |
319 | - td { | 315 | + td { |
320 | @include hover-color; | 316 | @include hover-color; |
321 | } | 317 | } |
322 | } | 318 | } |
323 | } | 319 | } |
324 | 320 | ||
325 | -.clear { | 321 | +.clear { |
326 | clear: both; | 322 | clear: both; |
327 | } | 323 | } |
328 | 324 | ||
329 | -.top_project_menu { | ||
330 | - a { | 325 | +.top_project_menu { |
326 | + a { | ||
331 | border-right: 1px solid #FFFFFF; | 327 | border-right: 1px solid #FFFFFF; |
332 | box-shadow: -1px 0 #DDDDDD inset; | 328 | box-shadow: -1px 0 #DDDDDD inset; |
333 | color: #666; | 329 | color: #666; |
@@ -339,7 +335,7 @@ input.ssh_project_url { | @@ -339,7 +335,7 @@ input.ssh_project_url { | ||
339 | text-shadow: 0 1px 0 #FFFFFF; | 335 | text-shadow: 0 1px 0 #FFFFFF; |
340 | float:left; | 336 | float:left; |
341 | 337 | ||
342 | - &.current { | 338 | + &.current { |
343 | background-color: #FFFFFF; | 339 | background-color: #FFFFFF; |
344 | color: #222222; | 340 | color: #222222; |
345 | } | 341 | } |
@@ -363,11 +359,11 @@ input.ssh_project_url { | @@ -363,11 +359,11 @@ input.ssh_project_url { | ||
363 | .new_project, | 359 | .new_project, |
364 | .new_snippet, | 360 | .new_snippet, |
365 | .edit_snippet, | 361 | .edit_snippet, |
366 | -.edit_project { | 362 | +.edit_project { |
367 | input[type='text'], | 363 | input[type='text'], |
368 | input[type='email'], | 364 | input[type='email'], |
369 | input[type='password'], | 365 | input[type='password'], |
370 | - textarea { | 366 | + textarea { |
371 | width:400px; | 367 | width:400px; |
372 | padding:8px; | 368 | padding:8px; |
373 | font-size:14px; | 369 | font-size:14px; |
@@ -375,7 +371,7 @@ input.ssh_project_url { | @@ -375,7 +371,7 @@ input.ssh_project_url { | ||
375 | } | 371 | } |
376 | } | 372 | } |
377 | 373 | ||
378 | -.input_button { | 374 | +.input_button { |
379 | //@include round-borders-all(4px); | 375 | //@include round-borders-all(4px); |
380 | padding:8px; | 376 | padding:8px; |
381 | font-size:14px; | 377 | font-size:14px; |
@@ -393,7 +389,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -393,7 +389,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
393 | border-bottom: 1px solid #E2EAEE; | 389 | border-bottom: 1px solid #E2EAEE; |
394 | } | 390 | } |
395 | 391 | ||
396 | -.top_menu_count { | 392 | +.top_menu_count { |
397 | background: none repeat scroll 0 0 #FFF6BF; | 393 | background: none repeat scroll 0 0 #FFF6BF; |
398 | border-color: #FFD324; | 394 | border-color: #FFD324; |
399 | color: #514721; | 395 | color: #514721; |
@@ -417,7 +413,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -417,7 +413,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
417 | 413 | ||
418 | /** FALSH **/ | 414 | /** FALSH **/ |
419 | 415 | ||
420 | -#flash_container { | 416 | +#flash_container { |
421 | height:40px; | 417 | height:40px; |
422 | position:fixed; | 418 | position:fixed; |
423 | z-index:1009; | 419 | z-index:1009; |
@@ -429,7 +425,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -429,7 +425,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
429 | cursor:pointer; | 425 | cursor:pointer; |
430 | border-bottom:1px solid #777; | 426 | border-bottom:1px solid #777; |
431 | 427 | ||
432 | - h4 { | 428 | + h4 { |
433 | color:#444; | 429 | color:#444; |
434 | font-size:22px; | 430 | font-size:22px; |
435 | padding-top:5px; | 431 | padding-top:5px; |
@@ -460,50 +456,50 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -460,50 +456,50 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
460 | color: #0099FF; | 456 | color: #0099FF; |
461 | } | 457 | } |
462 | 458 | ||
463 | - &.hm { | 459 | + &.hm { |
464 | margin: 0px 0px; | 460 | margin: 0px 0px; |
465 | } | 461 | } |
466 | 462 | ||
467 | - &.vm { | 463 | + &.vm { |
468 | margin: 5px 0px; | 464 | margin: 5px 0px; |
469 | } | 465 | } |
470 | } | 466 | } |
471 | 467 | ||
472 | /** Notes **/ | 468 | /** Notes **/ |
473 | 469 | ||
474 | -#notes-list { | 470 | +#notes-list { |
475 | display:block; | 471 | display:block; |
476 | list-style:none; | 472 | list-style:none; |
477 | margin:0px; | 473 | margin:0px; |
478 | padding:0px; | 474 | padding:0px; |
479 | 475 | ||
480 | - li { | 476 | + li { |
481 | display:list-item; | 477 | display:list-item; |
482 | padding:8px; | 478 | padding:8px; |
483 | margin:0px; | 479 | margin:0px; |
484 | background: #F7FBFC; | 480 | background: #F7FBFC; |
485 | border-top: 1px solid #E2EAEE; | 481 | border-top: 1px solid #E2EAEE; |
486 | 482 | ||
487 | - &:first-child { | 483 | + &:first-child { |
488 | border-top: none; | 484 | border-top: none; |
489 | } | 485 | } |
490 | &:nth-child(2n+1) { | 486 | &:nth-child(2n+1) { |
491 | background: white; | 487 | background: white; |
492 | } | 488 | } |
493 | - p { | 489 | + p { |
494 | margin-bottom: 4px; | 490 | margin-bottom: 4px; |
495 | font-size: 13px; | 491 | font-size: 13px; |
496 | color:#111; | 492 | color:#111; |
497 | } | 493 | } |
498 | } | 494 | } |
499 | - cite { | ||
500 | - &.ago { | 495 | + cite { |
496 | + &.ago { | ||
501 | color:#666; | 497 | color:#666; |
502 | } | 498 | } |
503 | } | 499 | } |
504 | } | 500 | } |
505 | 501 | ||
506 | -.notes_count { | 502 | +.notes_count { |
507 | background: none repeat scroll 0 0 #FFF6BF; | 503 | background: none repeat scroll 0 0 #FFF6BF; |
508 | border-color: #FFD324; | 504 | border-color: #FFD324; |
509 | color: #514721; | 505 | color: #514721; |
@@ -515,36 +511,36 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -515,36 +511,36 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
515 | right: 6px; | 511 | right: 6px; |
516 | top: 6px; | 512 | top: 6px; |
517 | } | 513 | } |
518 | -.note_author { | 514 | +.note_author { |
519 | float:left; | 515 | float:left; |
520 | width:60px; | 516 | width:60px; |
521 | } | 517 | } |
522 | -.note_content { | 518 | +.note_content { |
523 | float:left; | 519 | float:left; |
524 | width:650px; | 520 | width:650px; |
525 | } | 521 | } |
526 | 522 | ||
527 | -.issue_notes { | ||
528 | - .note_content { | 523 | +.issue_notes { |
524 | + .note_content { | ||
529 | float:left; | 525 | float:left; |
530 | width:400px; | 526 | width:400px; |
531 | } | 527 | } |
532 | } | 528 | } |
533 | 529 | ||
534 | #user_projects_limit{ | 530 | #user_projects_limit{ |
535 | - width: 60px; | 531 | + width: 60px; |
536 | } | 532 | } |
537 | 533 | ||
538 | -.project_thumb { | 534 | +.project_thumb { |
539 | margin:20px 0; | 535 | margin:20px 0; |
540 | width: 250px; | 536 | width: 250px; |
541 | float:left; | 537 | float:left; |
542 | padding:20px; | 538 | padding:20px; |
543 | text-align:center; | 539 | text-align:center; |
544 | - p, h4 { | 540 | + p, h4 { |
545 | text-align:left; | 541 | text-align:left; |
546 | } | 542 | } |
547 | - .lbutton { | 543 | + .lbutton { |
548 | float:left; | 544 | float:left; |
549 | } | 545 | } |
550 | } | 546 | } |
@@ -559,8 +555,8 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -559,8 +555,8 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
559 | padding: 10px; | 555 | padding: 10px; |
560 | } | 556 | } |
561 | 557 | ||
562 | -.recent_message_parent { | ||
563 | - img { | 558 | +.recent_message_parent { |
559 | + img { | ||
564 | padding-right:10px; | 560 | padding-right:10px; |
565 | } | 561 | } |
566 | 562 | ||
@@ -571,7 +567,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -571,7 +567,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
571 | 567 | ||
572 | &.dash_wall{ | 568 | &.dash_wall{ |
573 | border-bottom: 2px solid orange; | 569 | border-bottom: 2px solid orange; |
574 | - span { | 570 | + span { |
575 | background: orange; | 571 | background: orange; |
576 | color:black; | 572 | color:black; |
577 | } | 573 | } |
@@ -579,14 +575,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -579,14 +575,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
579 | 575 | ||
580 | &.dash_issue{ | 576 | &.dash_issue{ |
581 | border-bottom: 2px solid #ffbbbb; | 577 | border-bottom: 2px solid #ffbbbb; |
582 | - span { | 578 | + span { |
583 | background: #ffbbbb; | 579 | background: #ffbbbb; |
584 | } | 580 | } |
585 | } | 581 | } |
586 | &.dash_commit{ | 582 | &.dash_commit{ |
587 | border-bottom: 2px solid #bbbbff; | 583 | border-bottom: 2px solid #bbbbff; |
588 | 584 | ||
589 | - span{ | 585 | + span{ |
590 | background: #bbbbff; | 586 | background: #bbbbff; |
591 | } | 587 | } |
592 | } | 588 | } |
@@ -594,27 +590,26 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -594,27 +590,26 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
594 | &.dash_snippet{ | 590 | &.dash_snippet{ |
595 | border-bottom: 2px solid #bbffbb; | 591 | border-bottom: 2px solid #bbffbb; |
596 | 592 | ||
597 | - span{ | 593 | + span{ |
598 | background: #bbffbb; | 594 | background: #bbffbb; |
599 | } | 595 | } |
600 | } | 596 | } |
601 | 597 | ||
602 | - | ||
603 | - span{ | 598 | + span{ |
604 | border: 1px solid #aaa; | 599 | border: 1px solid #aaa; |
605 | color:black; | 600 | color:black; |
606 | padding:1px 4px; | 601 | padding:1px 4px; |
607 | } | 602 | } |
608 | 603 | ||
609 | - h4 { | 604 | + h4 { |
610 | margin-bottom:3px; | 605 | margin-bottom:3px; |
611 | } | 606 | } |
612 | 607 | ||
613 | } | 608 | } |
614 | .commit, | 609 | .commit, |
615 | -.message, | 610 | +.message, |
616 | #notes-list{ | 611 | #notes-list{ |
617 | - .author { | 612 | + .author { |
618 | background: #eaeaea; | 613 | background: #eaeaea; |
619 | color: #333; | 614 | color: #333; |
620 | border: 1px solid #aaa; | 615 | border: 1px solid #aaa; |
@@ -624,17 +619,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -624,17 +619,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
624 | } | 619 | } |
625 | 620 | ||
626 | /* Note textare */ | 621 | /* Note textare */ |
627 | -#note_note { | 622 | +#note_note { |
628 | height:100px; | 623 | height:100px; |
629 | width:97%; | 624 | width:97%; |
630 | font-size:14px; | 625 | font-size:14px; |
631 | } | 626 | } |
632 | 627 | ||
633 | -.wall_page { | ||
634 | - #note_note { | 628 | +.wall_page { |
629 | + #note_note { | ||
635 | height:25px; | 630 | height:25px; |
636 | } | 631 | } |
637 | - .attach_holder { | 632 | + .attach_holder { |
638 | display:none; | 633 | display:none; |
639 | } | 634 | } |
640 | } | 635 | } |
@@ -653,17 +648,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -653,17 +648,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
653 | padding:2px 4px; | 648 | padding:2px 4px; |
654 | border:none; | 649 | border:none; |
655 | 650 | ||
656 | - &.high { | 651 | + &.high { |
657 | background: #D12F19; | 652 | background: #D12F19; |
658 | color:white; | 653 | color:white; |
659 | } | 654 | } |
660 | 655 | ||
661 | - &.today { | 656 | + &.today { |
662 | background: #44aa22; | 657 | background: #44aa22; |
663 | color:white; | 658 | color:white; |
664 | } | 659 | } |
665 | 660 | ||
666 | - &.yours { | 661 | + &.yours { |
667 | background: #4466cc; | 662 | background: #4466cc; |
668 | color:white; | 663 | color:white; |
669 | } | 664 | } |
@@ -673,8 +668,8 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -673,8 +668,8 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
673 | } | 668 | } |
674 | } | 669 | } |
675 | 670 | ||
676 | -#issues-table .issue { | ||
677 | - &.critical { | 671 | +#issues-table .issue { |
672 | + &.critical { | ||
678 | td { | 673 | td { |
679 | //background: #D12F19; | 674 | //background: #D12F19; |
680 | //color:#fff; | 675 | //color:#fff; |
app/controllers/admin/mailer_controller.rb
@@ -20,7 +20,7 @@ class Admin::MailerController < ApplicationController | @@ -20,7 +20,7 @@ class Admin::MailerController < ApplicationController | ||
20 | else | 20 | else |
21 | render :file => 'notify/note_wall_email.html.haml', :layout => 'notify' | 21 | render :file => 'notify/note_wall_email.html.haml', :layout => 'notify' |
22 | end | 22 | end |
23 | - rescue | 23 | + rescue |
24 | render :text => "Preview not avaialble" | 24 | render :text => "Preview not avaialble" |
25 | end | 25 | end |
26 | 26 | ||
@@ -29,7 +29,7 @@ class Admin::MailerController < ApplicationController | @@ -29,7 +29,7 @@ class Admin::MailerController < ApplicationController | ||
29 | @password = "DHasJKDHAS!" | 29 | @password = "DHasJKDHAS!" |
30 | 30 | ||
31 | render :file => 'notify/new_user_email.html.haml', :layout => 'notify' | 31 | render :file => 'notify/new_user_email.html.haml', :layout => 'notify' |
32 | - rescue | 32 | + rescue |
33 | render :text => "Preview not avaialble" | 33 | render :text => "Preview not avaialble" |
34 | end | 34 | end |
35 | 35 | ||
@@ -38,7 +38,7 @@ class Admin::MailerController < ApplicationController | @@ -38,7 +38,7 @@ class Admin::MailerController < ApplicationController | ||
38 | @user = @issue.assignee | 38 | @user = @issue.assignee |
39 | @project = @issue.project | 39 | @project = @issue.project |
40 | render :file => 'notify/new_issue_email.html.haml', :layout => 'notify' | 40 | render :file => 'notify/new_issue_email.html.haml', :layout => 'notify' |
41 | - rescue | 41 | + rescue |
42 | render :text => "Preview not avaialble" | 42 | render :text => "Preview not avaialble" |
43 | end | 43 | end |
44 | end | 44 | end |
app/controllers/admin/users_controller.rb
@@ -36,7 +36,7 @@ class Admin::UsersController < ApplicationController | @@ -36,7 +36,7 @@ class Admin::UsersController < ApplicationController | ||
36 | def create | 36 | def create |
37 | admin = params[:user].delete("admin") | 37 | admin = params[:user].delete("admin") |
38 | 38 | ||
39 | - @admin_user = User.new(params[:user]) | 39 | + @admin_user = User.new(params[:user]) |
40 | @admin_user.admin = (admin && admin.to_i > 0) | 40 | @admin_user.admin = (admin && admin.to_i > 0) |
41 | 41 | ||
42 | respond_to do |format| | 42 | respond_to do |format| |
@@ -54,8 +54,8 @@ class Admin::UsersController < ApplicationController | @@ -54,8 +54,8 @@ class Admin::UsersController < ApplicationController | ||
54 | def update | 54 | def update |
55 | admin = params[:user].delete("admin") | 55 | admin = params[:user].delete("admin") |
56 | if params[:user][:password].empty? | 56 | if params[:user][:password].empty? |
57 | - params[:user].delete(:password) | ||
58 | - params[:user].delete(:password_confirmation) | 57 | + params[:user].delete(:password) |
58 | + params[:user].delete(:password_confirmation) | ||
59 | end | 59 | end |
60 | 60 | ||
61 | @admin_user = User.find(params[:id]) | 61 | @admin_user = User.find(params[:id]) |
app/controllers/application_controller.rb
@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base | @@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base | ||
8 | render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false | 8 | render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false |
9 | end | 9 | end |
10 | 10 | ||
11 | - protected | 11 | + protected |
12 | 12 | ||
13 | def abilities | 13 | def abilities |
14 | @abilities ||= Six.new | 14 | @abilities ||= Six.new |
@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base | @@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base | ||
18 | abilities.allowed?(object, action, subject) | 18 | abilities.allowed?(object, action, subject) |
19 | end | 19 | end |
20 | 20 | ||
21 | - def project | 21 | + def project |
22 | @project ||= Project.find_by_code(params[:project_id]) | 22 | @project ||= Project.find_by_code(params[:project_id]) |
23 | end | 23 | end |
24 | 24 | ||
@@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base | @@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base | ||
55 | 55 | ||
56 | @tag = unless params[:tag].blank? | 56 | @tag = unless params[:tag].blank? |
57 | params[:tag] | 57 | params[:tag] |
58 | - else | 58 | + else |
59 | nil | 59 | nil |
60 | end | 60 | end |
61 | 61 |
app/controllers/issues_controller.rb
1 | class IssuesController < ApplicationController | 1 | class IssuesController < ApplicationController |
2 | before_filter :authenticate_user! | 2 | before_filter :authenticate_user! |
3 | - before_filter :project | 3 | + before_filter :project |
4 | before_filter :issue, :only => [:edit, :update, :destroy, :show] | 4 | before_filter :issue, :only => [:edit, :update, :destroy, :show] |
5 | 5 | ||
6 | # Authorize | 6 | # Authorize |
7 | before_filter :add_project_abilities | 7 | before_filter :add_project_abilities |
8 | before_filter :authorize_read_issue! | 8 | before_filter :authorize_read_issue! |
9 | - before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] | 9 | + before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] |
10 | 10 | ||
11 | respond_to :js | 11 | respond_to :js |
12 | 12 | ||
@@ -57,14 +57,13 @@ class IssuesController < ApplicationController | @@ -57,14 +57,13 @@ class IssuesController < ApplicationController | ||
57 | end | 57 | end |
58 | end | 58 | end |
59 | 59 | ||
60 | - | ||
61 | def destroy | 60 | def destroy |
62 | return access_denied! unless can?(current_user, :admin_issue, @issue) | 61 | return access_denied! unless can?(current_user, :admin_issue, @issue) |
63 | 62 | ||
64 | @issue.destroy | 63 | @issue.destroy |
65 | 64 | ||
66 | respond_to do |format| | 65 | respond_to do |format| |
67 | - format.js { render :nothing => true } | 66 | + format.js { render :nothing => true } |
68 | end | 67 | end |
69 | end | 68 | end |
70 | 69 | ||
@@ -78,7 +77,7 @@ class IssuesController < ApplicationController | @@ -78,7 +77,7 @@ class IssuesController < ApplicationController | ||
78 | render :nothing => true | 77 | render :nothing => true |
79 | end | 78 | end |
80 | 79 | ||
81 | - protected | 80 | + protected |
82 | 81 | ||
83 | def issue | 82 | def issue |
84 | @issue ||= @project.issues.find(params[:id]) | 83 | @issue ||= @project.issues.find(params[:id]) |
app/controllers/keys_controller.rb
@@ -24,7 +24,7 @@ class KeysController < ApplicationController | @@ -24,7 +24,7 @@ class KeysController < ApplicationController | ||
24 | 24 | ||
25 | respond_to do |format| | 25 | respond_to do |format| |
26 | format.html { redirect_to keys_url } | 26 | format.html { redirect_to keys_url } |
27 | - format.js { render :nothing => true } | 27 | + format.js { render :nothing => true } |
28 | end | 28 | end |
29 | end | 29 | end |
30 | end | 30 | end |
app/controllers/notes_controller.rb
1 | class NotesController < ApplicationController | 1 | class NotesController < ApplicationController |
2 | - before_filter :project | 2 | + before_filter :project |
3 | 3 | ||
4 | # Authorize | 4 | # Authorize |
5 | before_filter :add_project_abilities | 5 | before_filter :add_project_abilities |
6 | - before_filter :authorize_write_note!, :only => [:create] | 6 | + before_filter :authorize_write_note!, :only => [:create] |
7 | 7 | ||
8 | respond_to :js | 8 | respond_to :js |
9 | 9 | ||
@@ -15,10 +15,9 @@ class NotesController < ApplicationController | @@ -15,10 +15,9 @@ class NotesController < ApplicationController | ||
15 | notify if params[:notify] == '1' | 15 | notify if params[:notify] == '1' |
16 | end | 16 | end |
17 | 17 | ||
18 | - | ||
19 | respond_to do |format| | 18 | respond_to do |format| |
20 | format.html {redirect_to :back} | 19 | format.html {redirect_to :back} |
21 | - format.js | 20 | + format.js |
22 | end | 21 | end |
23 | end | 22 | end |
24 | 23 | ||
@@ -30,11 +29,11 @@ class NotesController < ApplicationController | @@ -30,11 +29,11 @@ class NotesController < ApplicationController | ||
30 | @note.destroy | 29 | @note.destroy |
31 | 30 | ||
32 | respond_to do |format| | 31 | respond_to do |format| |
33 | - format.js { render :nothing => true } | 32 | + format.js { render :nothing => true } |
34 | end | 33 | end |
35 | end | 34 | end |
36 | 35 | ||
37 | - protected | 36 | + protected |
38 | 37 | ||
39 | def notify | 38 | def notify |
40 | @project.users.reject { |u| u.id == current_user.id } .each do |u| | 39 | @project.users.reject { |u| u.id == current_user.id } .each do |u| |
app/controllers/profile_controller.rb
@@ -14,7 +14,7 @@ class ProfileController < ApplicationController | @@ -14,7 +14,7 @@ class ProfileController < ApplicationController | ||
14 | end | 14 | end |
15 | 15 | ||
16 | def password_update | 16 | def password_update |
17 | - params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"} | 17 | + params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"} |
18 | @user = current_user | 18 | @user = current_user |
19 | 19 | ||
20 | if @user.update_attributes(params[:user]) | 20 | if @user.update_attributes(params[:user]) |
app/controllers/projects_controller.rb
1 | class ProjectsController < ApplicationController | 1 | class ProjectsController < ApplicationController |
2 | - before_filter :project, :except => [:index, :new, :create] | 2 | + before_filter :project, :except => [:index, :new, :create] |
3 | 3 | ||
4 | # Authorize | 4 | # Authorize |
5 | before_filter :add_project_abilities | 5 | before_filter :add_project_abilities |
6 | - before_filter :authorize_read_project!, :except => [:index, :new, :create] | ||
7 | - before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] | 6 | + before_filter :authorize_read_project!, :except => [:index, :new, :create] |
7 | + before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] | ||
8 | 8 | ||
9 | before_filter :require_non_empty_project, :only => [:blob, :tree] | 9 | before_filter :require_non_empty_project, :only => [:blob, :tree] |
10 | 10 | ||
@@ -23,7 +23,7 @@ class ProjectsController < ApplicationController | @@ -23,7 +23,7 @@ class ProjectsController < ApplicationController | ||
23 | @project = Project.new(params[:project]) | 23 | @project = Project.new(params[:project]) |
24 | @project.owner = current_user | 24 | @project.owner = current_user |
25 | 25 | ||
26 | - Project.transaction do | 26 | + Project.transaction do |
27 | @project.save! | 27 | @project.save! |
28 | @project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user) | 28 | @project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user) |
29 | end | 29 | end |
@@ -31,7 +31,7 @@ class ProjectsController < ApplicationController | @@ -31,7 +31,7 @@ class ProjectsController < ApplicationController | ||
31 | respond_to do |format| | 31 | respond_to do |format| |
32 | if @project.valid? | 32 | if @project.valid? |
33 | format.html { redirect_to @project, notice: 'Project was successfully created.' } | 33 | format.html { redirect_to @project, notice: 'Project was successfully created.' } |
34 | - format.js | 34 | + format.js |
35 | else | 35 | else |
36 | format.html { render action: "new" } | 36 | format.html { render action: "new" } |
37 | format.js | 37 | format.js |
@@ -51,10 +51,10 @@ class ProjectsController < ApplicationController | @@ -51,10 +51,10 @@ class ProjectsController < ApplicationController | ||
51 | respond_to do |format| | 51 | respond_to do |format| |
52 | if project.update_attributes(params[:project]) | 52 | if project.update_attributes(params[:project]) |
53 | format.html { redirect_to project, :notice => 'Project was successfully updated.' } | 53 | format.html { redirect_to project, :notice => 'Project was successfully updated.' } |
54 | - format.js | 54 | + format.js |
55 | else | 55 | else |
56 | format.html { render action: "edit" } | 56 | format.html { render action: "edit" } |
57 | - format.js | 57 | + format.js |
58 | end | 58 | end |
59 | end | 59 | end |
60 | end | 60 | end |
@@ -105,7 +105,7 @@ class ProjectsController < ApplicationController | @@ -105,7 +105,7 @@ class ProjectsController < ApplicationController | ||
105 | 105 | ||
106 | if params[:commit_id] | 106 | if params[:commit_id] |
107 | @commit = @repo.commits(params[:commit_id]).first | 107 | @commit = @repo.commits(params[:commit_id]).first |
108 | - else | 108 | + else |
109 | @commit = @repo.commits(@ref || "master").first | 109 | @commit = @repo.commits(@ref || "master").first |
110 | end | 110 | end |
111 | 111 | ||
@@ -114,7 +114,7 @@ class ProjectsController < ApplicationController | @@ -114,7 +114,7 @@ class ProjectsController < ApplicationController | ||
114 | 114 | ||
115 | respond_to do |format| | 115 | respond_to do |format| |
116 | format.html # show.html.erb | 116 | format.html # show.html.erb |
117 | - format.js do | 117 | + format.js do |
118 | # diasbale cache to allow back button works | 118 | # diasbale cache to allow back button works |
119 | response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" | 119 | response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" |
120 | response.headers["Pragma"] = "no-cache" | 120 | response.headers["Pragma"] = "no-cache" |
@@ -132,7 +132,7 @@ class ProjectsController < ApplicationController | @@ -132,7 +132,7 @@ class ProjectsController < ApplicationController | ||
132 | 132 | ||
133 | if @tree.is_a?(Grit::Blob) | 133 | if @tree.is_a?(Grit::Blob) |
134 | send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name) | 134 | send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name) |
135 | - else | 135 | + else |
136 | head(404) | 136 | head(404) |
137 | end | 137 | end |
138 | rescue | 138 | rescue |
@@ -147,9 +147,9 @@ class ProjectsController < ApplicationController | @@ -147,9 +147,9 @@ class ProjectsController < ApplicationController | ||
147 | end | 147 | end |
148 | end | 148 | end |
149 | 149 | ||
150 | - protected | 150 | + protected |
151 | 151 | ||
152 | - def project | 152 | + def project |
153 | @project ||= Project.find_by_code(params[:id]) | 153 | @project ||= Project.find_by_code(params[:id]) |
154 | end | 154 | end |
155 | end | 155 | end |
app/controllers/snippets_controller.rb
1 | class SnippetsController < ApplicationController | 1 | class SnippetsController < ApplicationController |
2 | before_filter :authenticate_user! | 2 | before_filter :authenticate_user! |
3 | - before_filter :project | 3 | + before_filter :project |
4 | 4 | ||
5 | # Authorize | 5 | # Authorize |
6 | before_filter :add_project_abilities | 6 | before_filter :add_project_abilities |
7 | before_filter :authorize_read_snippet! | 7 | before_filter :authorize_read_snippet! |
8 | - before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort] | 8 | + before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort] |
9 | 9 | ||
10 | respond_to :html | 10 | respond_to :html |
11 | 11 | ||
@@ -13,7 +13,7 @@ class SnippetsController < ApplicationController | @@ -13,7 +13,7 @@ class SnippetsController < ApplicationController | ||
13 | @snippets = @project.snippets | 13 | @snippets = @project.snippets |
14 | end | 14 | end |
15 | 15 | ||
16 | - def new | 16 | + def new |
17 | @snippet = @project.snippets.new | 17 | @snippet = @project.snippets.new |
18 | end | 18 | end |
19 | 19 |
app/controllers/team_members_controller.rb
1 | class TeamMembersController < ApplicationController | 1 | class TeamMembersController < ApplicationController |
2 | - before_filter :project | 2 | + before_filter :project |
3 | 3 | ||
4 | # Authorize | 4 | # Authorize |
5 | before_filter :add_project_abilities | 5 | before_filter :add_project_abilities |
6 | before_filter :authorize_read_project! | 6 | before_filter :authorize_read_project! |
7 | - before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update] | 7 | + before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update] |
8 | 8 | ||
9 | def show | 9 | def show |
10 | @team_member = project.users_projects.find(params[:id]) | 10 | @team_member = project.users_projects.find(params[:id]) |
@@ -26,7 +26,7 @@ class TeamMembersController < ApplicationController | @@ -26,7 +26,7 @@ class TeamMembersController < ApplicationController | ||
26 | 26 | ||
27 | respond_to do |format| | 27 | respond_to do |format| |
28 | format.js | 28 | format.js |
29 | - format.html do | 29 | + format.html do |
30 | unless @team_member.valid? | 30 | unless @team_member.valid? |
31 | flash[:alert] = "User should have at least one role" | 31 | flash[:alert] = "User should have at least one role" |
32 | end | 32 | end |
@@ -41,7 +41,7 @@ class TeamMembersController < ApplicationController | @@ -41,7 +41,7 @@ class TeamMembersController < ApplicationController | ||
41 | 41 | ||
42 | respond_to do |format| | 42 | respond_to do |format| |
43 | format.html { redirect_to root_path } | 43 | format.html { redirect_to root_path } |
44 | - format.js { render :nothing => true } | 44 | + format.js { render :nothing => true } |
45 | end | 45 | end |
46 | end | 46 | end |
47 | end | 47 | end |
app/helpers/application_helper.rb
@@ -23,9 +23,9 @@ module ApplicationHelper | @@ -23,9 +23,9 @@ module ApplicationHelper | ||
23 | end | 23 | end |
24 | 24 | ||
25 | def last_commit(project) | 25 | def last_commit(project) |
26 | - if project.repo_exists? | 26 | + if project.repo_exists? |
27 | time_ago_in_words(project.commit.committed_date) + " ago" | 27 | time_ago_in_words(project.commit.committed_date) + " ago" |
28 | - else | 28 | + else |
29 | "Never" | 29 | "Never" |
30 | end | 30 | end |
31 | end | 31 | end |
@@ -33,8 +33,8 @@ module ApplicationHelper | @@ -33,8 +33,8 @@ module ApplicationHelper | ||
33 | def search_autocomplete_source | 33 | def search_autocomplete_source |
34 | projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } | 34 | projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } |
35 | default_nav = [ | 35 | default_nav = [ |
36 | - { :label => "Keys", :url => keys_path }, | ||
37 | - { :label => "Projects", :url => projects_path }, | 36 | + { :label => "Keys", :url => keys_path }, |
37 | + { :label => "Projects", :url => projects_path }, | ||
38 | { :label => "Admin", :url => admin_root_path } | 38 | { :label => "Admin", :url => admin_root_path } |
39 | ] | 39 | ] |
40 | 40 | ||
@@ -42,10 +42,10 @@ module ApplicationHelper | @@ -42,10 +42,10 @@ module ApplicationHelper | ||
42 | 42 | ||
43 | if @project && !@project.new_record? | 43 | if @project && !@project.new_record? |
44 | project_nav = [ | 44 | project_nav = [ |
45 | - { :label => "#{@project.code} / Issues", :url => project_issues_path(@project) }, | ||
46 | - { :label => "#{@project.code} / Wall", :url => wall_project_path(@project) }, | ||
47 | - { :label => "#{@project.code} / Tree", :url => tree_project_path(@project) }, | ||
48 | - { :label => "#{@project.code} / Commits", :url => project_commits_path(@project) }, | 45 | + { :label => "#{@project.code} / Issues", :url => project_issues_path(@project) }, |
46 | + { :label => "#{@project.code} / Wall", :url => wall_project_path(@project) }, | ||
47 | + { :label => "#{@project.code} / Tree", :url => tree_project_path(@project) }, | ||
48 | + { :label => "#{@project.code} / Commits", :url => project_commits_path(@project) }, | ||
49 | { :label => "#{@project.code} / Team", :url => team_project_path(@project) } | 49 | { :label => "#{@project.code} / Team", :url => team_project_path(@project) } |
50 | ] | 50 | ] |
51 | end | 51 | end |
app/helpers/commits_helper.rb
1 | module CommitsHelper | 1 | module CommitsHelper |
2 | def diff_line(line, line_new = 0, line_old = 0) | 2 | def diff_line(line, line_new = 0, line_old = 0) |
3 | full_line = html_escape(line.gsub(/\n/, '')) | 3 | full_line = html_escape(line.gsub(/\n/, '')) |
4 | - color = if line[0] == "+" | 4 | + color = if line[0] == "+" |
5 | full_line = "<span class=\"old_line\"> </span><span class=\"new_line\">#{line_new}</span> " + full_line | 5 | full_line = "<span class=\"old_line\"> </span><span class=\"new_line\">#{line_new}</span> " + full_line |
6 | "#DFD" | 6 | "#DFD" |
7 | - elsif line[0] == "-" | 7 | + elsif line[0] == "-" |
8 | full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\"> </span> " + full_line | 8 | full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\"> </span> " + full_line |
9 | "#FDD" | 9 | "#FDD" |
10 | - else | 10 | + else |
11 | full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line | 11 | full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line |
12 | "none" | 12 | "none" |
13 | end | 13 | end |
app/helpers/projects_helper.rb
app/models/ability.rb
@@ -17,14 +17,14 @@ class Ability | @@ -17,14 +17,14 @@ class Ability | ||
17 | :read_issue, | 17 | :read_issue, |
18 | :read_snippet, | 18 | :read_snippet, |
19 | :read_team_member, | 19 | :read_team_member, |
20 | - :read_note | 20 | + :read_note |
21 | ] if project.readers.include?(user) | 21 | ] if project.readers.include?(user) |
22 | 22 | ||
23 | rules << [ | 23 | rules << [ |
24 | :write_project, | 24 | :write_project, |
25 | :write_issue, | 25 | :write_issue, |
26 | :write_snippet, | 26 | :write_snippet, |
27 | - :write_note | 27 | + :write_note |
28 | ] if project.writers.include?(user) | 28 | ] if project.writers.include?(user) |
29 | 29 | ||
30 | rules << [ | 30 | rules << [ |
@@ -32,13 +32,13 @@ class Ability | @@ -32,13 +32,13 @@ class Ability | ||
32 | :admin_issue, | 32 | :admin_issue, |
33 | :admin_snippet, | 33 | :admin_snippet, |
34 | :admin_team_member, | 34 | :admin_team_member, |
35 | - :admin_note | 35 | + :admin_note |
36 | ] if project.admins.include?(user) | 36 | ] if project.admins.include?(user) |
37 | 37 | ||
38 | rules.flatten | 38 | rules.flatten |
39 | end | 39 | end |
40 | 40 | ||
41 | - class << self | 41 | + class << self |
42 | [:issue, :note, :snippet].each do |name| | 42 | [:issue, :note, :snippet].each do |name| |
43 | define_method "#{name}_abilities" do |user, subject| | 43 | define_method "#{name}_abilities" do |user, subject| |
44 | if subject.author == user | 44 | if subject.author == user |
@@ -48,7 +48,7 @@ class Ability | @@ -48,7 +48,7 @@ class Ability | ||
48 | :"admin_#{name}" | 48 | :"admin_#{name}" |
49 | ] | 49 | ] |
50 | else | 50 | else |
51 | - subject.respond_to?(:project) ? | 51 | + subject.respond_to?(:project) ? |
52 | project_abilities(user, subject.project) : [] | 52 | project_abilities(user, subject.project) : [] |
53 | end | 53 | end |
54 | end | 54 | end |
app/models/issue.rb
@@ -13,7 +13,7 @@ class Issue < ActiveRecord::Base | @@ -13,7 +13,7 @@ class Issue < ActiveRecord::Base | ||
13 | validates :title, | 13 | validates :title, |
14 | :presence => true, | 14 | :presence => true, |
15 | :length => { :within => 0..255 } | 15 | :length => { :within => 0..255 } |
16 | - | 16 | + |
17 | validates :content, | 17 | validates :content, |
18 | :presence => true, | 18 | :presence => true, |
19 | :length => { :within => 0..2000 } | 19 | :length => { :within => 0..2000 } |
@@ -30,7 +30,7 @@ class Issue < ActiveRecord::Base | @@ -30,7 +30,7 @@ class Issue < ActiveRecord::Base | ||
30 | def today? | 30 | def today? |
31 | Date.today == created_at.to_date | 31 | Date.today == created_at.to_date |
32 | end | 32 | end |
33 | - | 33 | + |
34 | def new? | 34 | def new? |
35 | today? && created_at == updated_at | 35 | today? && created_at == updated_at |
36 | end | 36 | end |
app/models/key.rb
@@ -17,11 +17,11 @@ class Key < ActiveRecord::Base | @@ -17,11 +17,11 @@ class Key < ActiveRecord::Base | ||
17 | def set_identifier | 17 | def set_identifier |
18 | self.identifier = "#{user.identifier}_#{Time.now.to_i}" | 18 | self.identifier = "#{user.identifier}_#{Time.now.to_i}" |
19 | end | 19 | end |
20 | - | 20 | + |
21 | def update_gitosis | 21 | def update_gitosis |
22 | Gitosis.new.configure do |c| | 22 | Gitosis.new.configure do |c| |
23 | c.update_keys(identifier, key) | 23 | c.update_keys(identifier, key) |
24 | - | 24 | + |
25 | projects.each do |project| | 25 | projects.each do |project| |
26 | c.update_project(project.path, project.gitosis_writers) | 26 | c.update_project(project.path, project.gitosis_writers) |
27 | end | 27 | end |
app/models/note.rb
@@ -7,7 +7,7 @@ class Note < ActiveRecord::Base | @@ -7,7 +7,7 @@ class Note < ActiveRecord::Base | ||
7 | belongs_to :author, | 7 | belongs_to :author, |
8 | :class_name => "User" | 8 | :class_name => "User" |
9 | 9 | ||
10 | - attr_protected :author, :author_id | 10 | + attr_protected :author, :author_id |
11 | 11 | ||
12 | validates_presence_of :project | 12 | validates_presence_of :project |
13 | 13 | ||
@@ -15,10 +15,10 @@ class Note < ActiveRecord::Base | @@ -15,10 +15,10 @@ class Note < ActiveRecord::Base | ||
15 | :presence => true, | 15 | :presence => true, |
16 | :length => { :within => 0..255 } | 16 | :length => { :within => 0..255 } |
17 | 17 | ||
18 | - validates :attachment, | ||
19 | - :file_size => { | ||
20 | - :maximum => 10.megabytes.to_i | ||
21 | - } | 18 | + validates :attachment, |
19 | + :file_size => { | ||
20 | + :maximum => 10.megabytes.to_i | ||
21 | + } | ||
22 | 22 | ||
23 | scope :common, where(:noteable_id => nil) | 23 | scope :common, where(:noteable_id => nil) |
24 | 24 |
app/models/project.rb
@@ -20,7 +20,7 @@ class Project < ActiveRecord::Base | @@ -20,7 +20,7 @@ class Project < ActiveRecord::Base | ||
20 | :format => { :with => /^[a-zA-Z0-9_\-]*$/, | 20 | :format => { :with => /^[a-zA-Z0-9_\-]*$/, |
21 | :message => "only letters, digits & '_' '-' allowed" }, | 21 | :message => "only letters, digits & '_' '-' allowed" }, |
22 | :length => { :within => 0..255 } | 22 | :length => { :within => 0..255 } |
23 | - | 23 | + |
24 | validates :description, | 24 | validates :description, |
25 | :length => { :within => 0..2000 } | 25 | :length => { :within => 0..2000 } |
26 | 26 | ||
@@ -57,13 +57,13 @@ class Project < ActiveRecord::Base | @@ -57,13 +57,13 @@ class Project < ActiveRecord::Base | ||
57 | c.update_project(path, gitosis_writers) | 57 | c.update_project(path, gitosis_writers) |
58 | end | 58 | end |
59 | end | 59 | end |
60 | - | 60 | + |
61 | def destroy_gitosis_project | 61 | def destroy_gitosis_project |
62 | Gitosis.new.configure do |c| | 62 | Gitosis.new.configure do |c| |
63 | c.destroy_project(self) | 63 | c.destroy_project(self) |
64 | end | 64 | end |
65 | end | 65 | end |
66 | - | 66 | + |
67 | def add_access(user, *access) | 67 | def add_access(user, *access) |
68 | opts = { :user => user } | 68 | opts = { :user => user } |
69 | access.each { |name| opts.merge!(name => true) } | 69 | access.each { |name| opts.merge!(name => true) } |
@@ -102,12 +102,12 @@ class Project < ActiveRecord::Base | @@ -102,12 +102,12 @@ class Project < ActiveRecord::Base | ||
102 | def url_to_repo | 102 | def url_to_repo |
103 | "#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git" | 103 | "#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git" |
104 | end | 104 | end |
105 | - | 105 | + |
106 | def path_to_repo | 106 | def path_to_repo |
107 | GITOSIS["base_path"] + path + ".git" | 107 | GITOSIS["base_path"] + path + ".git" |
108 | end | 108 | end |
109 | 109 | ||
110 | - def repo | 110 | + def repo |
111 | @repo ||= Grit::Repo.new(path_to_repo) | 111 | @repo ||= Grit::Repo.new(path_to_repo) |
112 | end | 112 | end |
113 | 113 | ||
@@ -122,17 +122,17 @@ class Project < ActiveRecord::Base | @@ -122,17 +122,17 @@ class Project < ActiveRecord::Base | ||
122 | def commit(commit_id = nil) | 122 | def commit(commit_id = nil) |
123 | if commit_id | 123 | if commit_id |
124 | repo.commits(commit_id).first | 124 | repo.commits(commit_id).first |
125 | - else | 125 | + else |
126 | repo.commits.first | 126 | repo.commits.first |
127 | end | 127 | end |
128 | end | 128 | end |
129 | 129 | ||
130 | - def heads | 130 | + def heads |
131 | @heads ||= repo.heads | 131 | @heads ||= repo.heads |
132 | end | 132 | end |
133 | 133 | ||
134 | def fresh_commits | 134 | def fresh_commits |
135 | - commits = heads.map do |h| | 135 | + commits = heads.map do |h| |
136 | repo.commits(h.name, 10) | 136 | repo.commits(h.name, 10) |
137 | end.flatten.uniq { |c| c.id } | 137 | end.flatten.uniq { |c| c.id } |
138 | 138 | ||
@@ -144,7 +144,7 @@ class Project < ActiveRecord::Base | @@ -144,7 +144,7 @@ class Project < ActiveRecord::Base | ||
144 | end | 144 | end |
145 | 145 | ||
146 | def commits_since(date) | 146 | def commits_since(date) |
147 | - commits = heads.map do |h| | 147 | + commits = heads.map do |h| |
148 | repo.log(h.name, nil, :since => date) | 148 | repo.log(h.name, nil, :since => date) |
149 | end.flatten.uniq { |c| c.id } | 149 | end.flatten.uniq { |c| c.id } |
150 | 150 | ||
@@ -165,7 +165,7 @@ class Project < ActiveRecord::Base | @@ -165,7 +165,7 @@ class Project < ActiveRecord::Base | ||
165 | unless owner.can_create_project? | 165 | unless owner.can_create_project? |
166 | errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it") | 166 | errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it") |
167 | end | 167 | end |
168 | - rescue | 168 | + rescue |
169 | errors[:base] << ("Cant check your ability to create project") | 169 | errors[:base] << ("Cant check your ability to create project") |
170 | end | 170 | end |
171 | 171 |
app/models/snippet.rb
@@ -13,7 +13,7 @@ class Snippet < ActiveRecord::Base | @@ -13,7 +13,7 @@ class Snippet < ActiveRecord::Base | ||
13 | validates :title, | 13 | validates :title, |
14 | :presence => true, | 14 | :presence => true, |
15 | :length => { :within => 0..255 } | 15 | :length => { :within => 0..255 } |
16 | - | 16 | + |
17 | validates :file_name, | 17 | validates :file_name, |
18 | :presence => true, | 18 | :presence => true, |
19 | :length => { :within => 0..255 } | 19 | :length => { :within => 0..255 } |
@@ -22,9 +22,8 @@ class Snippet < ActiveRecord::Base | @@ -22,9 +22,8 @@ class Snippet < ActiveRecord::Base | ||
22 | :presence => true, | 22 | :presence => true, |
23 | :length => { :within => 0..10000 } | 23 | :length => { :within => 0..10000 } |
24 | 24 | ||
25 | - | ||
26 | def self.content_types | 25 | def self.content_types |
27 | - [ | 26 | + [ |
28 | ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", | 27 | ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", |
29 | ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb", | 28 | ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb", |
30 | ".js", ".sh", ".coffee", ".yml", ".md" | 29 | ".js", ".sh", ".coffee", ".yml", ".md" |
app/models/user.rb
@@ -5,7 +5,7 @@ class User < ActiveRecord::Base | @@ -5,7 +5,7 @@ class User < ActiveRecord::Base | ||
5 | :recoverable, :rememberable, :trackable, :validatable | 5 | :recoverable, :rememberable, :trackable, :validatable |
6 | 6 | ||
7 | # Setup accessible (or protected) attributes for your model | 7 | # Setup accessible (or protected) attributes for your model |
8 | - attr_accessible :email, :password, :password_confirmation, :remember_me, | 8 | + attr_accessible :email, :password, :password_confirmation, :remember_me, |
9 | :name, :projects_limit, :skype, :linkedin, :twitter | 9 | :name, :projects_limit, :skype, :linkedin, :twitter |
10 | 10 | ||
11 | has_many :users_projects, :dependent => :destroy | 11 | has_many :users_projects, :dependent => :destroy |
app/views/admin/mailer/preview.html.haml
1 | %p This is page with preview for all system emails that are sent to user | 1 | %p This is page with preview for all system emails that are sent to user |
2 | -%p Email previews built based on existing Project/Commit/Issue base - so some preview maybe unavailable unless object appear in system | 2 | +%p Email previews built based on existing Project/Commit/Issue base - so some preview maybe unavailable unless object appear in system |
3 | 3 | ||
4 | #accordion | 4 | #accordion |
5 | %h3 | 5 | %h3 |
6 | %a New user | 6 | %a New user |
7 | - %div | 7 | + %div |
8 | %iframe{ :src=> admin_mailer_preview_user_new_path, :width=>"100%", :height=>"350"} | 8 | %iframe{ :src=> admin_mailer_preview_user_new_path, :width=>"100%", :height=>"350"} |
9 | %h3 | 9 | %h3 |
10 | %a New issue | 10 | %a New issue |
11 | - %div | 11 | + %div |
12 | %iframe{ :src=> admin_mailer_preview_issue_new_path, :width=>"100%", :height=>"350"} | 12 | %iframe{ :src=> admin_mailer_preview_issue_new_path, :width=>"100%", :height=>"350"} |
13 | - %h3 | 13 | + %h3 |
14 | %a Commit note | 14 | %a Commit note |
15 | %div | 15 | %div |
16 | %iframe{ :src=> admin_mailer_preview_note_path(:type => "Commit"), :width=>"100%", :height=>"350"} | 16 | %iframe{ :src=> admin_mailer_preview_note_path(:type => "Commit"), :width=>"100%", :height=>"350"} |
17 | %h3 | 17 | %h3 |
18 | %a Issue note | 18 | %a Issue note |
19 | - %div | 19 | + %div |
20 | %iframe{ :src=> admin_mailer_preview_note_path(:type => "Issue"), :width=>"100%", :height=>"350"} | 20 | %iframe{ :src=> admin_mailer_preview_note_path(:type => "Issue"), :width=>"100%", :height=>"350"} |
21 | %h3 | 21 | %h3 |
22 | %a Wall note | 22 | %a Wall note |
23 | - %div | 23 | + %div |
24 | %iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"} | 24 | %iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"} |
25 | 25 | ||
26 | - | ||
27 | -:javascript | 26 | +:javascript |
28 | $(function() { | 27 | $(function() { |
29 | $( "#accordion" ).accordion(); }); | 28 | $( "#accordion" ).accordion(); }); |
app/views/admin/projects/show.html.haml
1 | %p#notice= notice | 1 | %p#notice= notice |
2 | 2 | ||
3 | .span-8.colborder | 3 | .span-8.colborder |
4 | - %h2= @admin_project.name | 4 | + %h2= @admin_project.name |
5 | 5 | ||
6 | %p | 6 | %p |
7 | %b Name: | 7 | %b Name: |
@@ -22,16 +22,16 @@ | @@ -22,16 +22,16 @@ | ||
22 | 22 | ||
23 | .span-14 | 23 | .span-14 |
24 | 24 | ||
25 | - %h2 Team | 25 | + %h2 Team |
26 | 26 | ||
27 | %table.round-borders | 27 | %table.round-borders |
28 | %tr | 28 | %tr |
29 | %th Name | 29 | %th Name |
30 | - %th Added | 30 | + %th Added |
31 | %th Web | 31 | %th Web |
32 | %th Git | 32 | %th Git |
33 | %th Admin | 33 | %th Admin |
34 | - %th | 34 | + %th |
35 | 35 | ||
36 | - @admin_project.users_projects.each do |tm| | 36 | - @admin_project.users_projects.each do |tm| |
37 | %tr | 37 | %tr |
app/views/admin/team_members/index.html.haml
app/views/admin/team_members/show.html.haml
app/views/admin/users/_form.html.haml
app/views/admin/users/new.html.haml
app/views/admin/users/show.html.haml
@@ -19,28 +19,27 @@ | @@ -19,28 +19,27 @@ | ||
19 | = @admin_user.skype | 19 | = @admin_user.skype |
20 | %p | 20 | %p |
21 | %b LinkedIn: | 21 | %b LinkedIn: |
22 | - = @admin_user.linkedin | 22 | + = @admin_user.linkedin |
23 | %p | 23 | %p |
24 | %b Twitter: | 24 | %b Twitter: |
25 | = @admin_user.twitter | 25 | = @admin_user.twitter |
26 | 26 | ||
27 | - | ||
28 | .clear | 27 | .clear |
29 | = link_to 'Edit', edit_admin_user_path(@admin_user) | 28 | = link_to 'Edit', edit_admin_user_path(@admin_user) |
30 | \| | 29 | \| |
31 | = link_to 'Back', admin_users_path | 30 | = link_to 'Back', admin_users_path |
32 | 31 | ||
33 | .span-14 | 32 | .span-14 |
34 | - %h2 Projects | 33 | + %h2 Projects |
35 | 34 | ||
36 | %table.round-borders | 35 | %table.round-borders |
37 | %tr | 36 | %tr |
38 | %th Name | 37 | %th Name |
39 | - %th Added | 38 | + %th Added |
40 | %th Web | 39 | %th Web |
41 | %th Git | 40 | %th Git |
42 | %th Admin | 41 | %th Admin |
43 | - %th | 42 | + %th |
44 | 43 | ||
45 | - @admin_user.users_projects.each do |tm| | 44 | - @admin_user.users_projects.each do |tm| |
46 | - project = tm.project | 45 | - project = tm.project |
app/views/commits/_diff.html.haml
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | .diff_file_header | 8 | .diff_file_header |
9 | - if diff.deleted_file | 9 | - if diff.deleted_file |
10 | %strong{:id => "#{diff.b_path}"}= diff.a_path | 10 | %strong{:id => "#{diff.b_path}"}= diff.a_path |
11 | - - else | 11 | + - else |
12 | = link_to tree_file_project_path(@project, @commit.id, diff.b_path) do | 12 | = link_to tree_file_project_path(@project, @commit.id, diff.b_path) do |
13 | %strong{:id => "#{diff.b_path}"}= diff.b_path | 13 | %strong{:id => "#{diff.b_path}"}= diff.b_path |
14 | %br/ | 14 | %br/ |
@@ -19,5 +19,5 @@ | @@ -19,5 +19,5 @@ | ||
19 | .diff_file_content_image | 19 | .diff_file_content_image |
20 | %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | 20 | %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} |
21 | - else | 21 | - else |
22 | - %p | 22 | + %p |
23 | %center No preview for this file type | 23 | %center No preview for this file type |
app/views/commits/_index.html.haml
app/views/commits/_text_file.html.haml
@@ -12,10 +12,10 @@ | @@ -12,10 +12,10 @@ | ||
12 | = diff_line(line, line_new, line_old) | 12 | = diff_line(line, line_new, line_old) |
13 | - if line[0] == "+" | 13 | - if line[0] == "+" |
14 | - line_new += 1 | 14 | - line_new += 1 |
15 | - - elsif | 15 | + - elsif |
16 | - line[0] == "-" | 16 | - line[0] == "-" |
17 | - line_old += 1 | 17 | - line_old += 1 |
18 | - - else | 18 | + - else |
19 | - line_new += 1 | 19 | - line_new += 1 |
20 | - line_old += 1 | 20 | - line_old += 1 |
21 | 21 |
app/views/commits/show.js.haml
@@ -4,5 +4,5 @@ | @@ -4,5 +4,5 @@ | ||
4 | side.html("#{escape_javascript(render "commits/show")}"); | 4 | side.html("#{escape_javascript(render "commits/show")}"); |
5 | $("##{dom_id(@project)}").parent().append(side); | 5 | $("##{dom_id(@project)}").parent().append(side); |
6 | $("##{dom_id(@project)}").addClass("span-14"); | 6 | $("##{dom_id(@project)}").addClass("span-14"); |
7 | -:plain | 7 | +:plain |
8 | $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); | 8 | $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); |
app/views/devise/confirmations/new.html.erb
@@ -9,4 +9,4 @@ | @@ -9,4 +9,4 @@ | ||
9 | <div><%= f.submit "Resend confirmation instructions" %></div> | 9 | <div><%= f.submit "Resend confirmation instructions" %></div> |
10 | <% end %> | 10 | <% end %> |
11 | 11 | ||
12 | -<%= render :partial => "devise/shared/links" %> | ||
13 | \ No newline at end of file | 12 | \ No newline at end of file |
13 | +<%= render :partial => "devise/shared/links" %> |
app/views/devise/passwords/edit.html.erb
@@ -13,4 +13,4 @@ | @@ -13,4 +13,4 @@ | ||
13 | <div><%= f.submit "Change my password" %></div> | 13 | <div><%= f.submit "Change my password" %></div> |
14 | <% end %> | 14 | <% end %> |
15 | 15 | ||
16 | -<%= render :partial => "devise/shared/links" %> | ||
17 | \ No newline at end of file | 16 | \ No newline at end of file |
17 | +<%= render :partial => "devise/shared/links" %> |
app/views/devise/shared/_links.erb
@@ -22,4 +22,4 @@ | @@ -22,4 +22,4 @@ | ||
22 | <%- resource_class.omniauth_providers.each do |provider| %> | 22 | <%- resource_class.omniauth_providers.each do |provider| %> |
23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br /> | 23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br /> |
24 | <% end -%> | 24 | <% end -%> |
25 | -<% end -%> | ||
26 | \ No newline at end of file | 25 | \ No newline at end of file |
26 | +<% end -%> |
app/views/devise/unlocks/new.html.erb
@@ -9,4 +9,4 @@ | @@ -9,4 +9,4 @@ | ||
9 | <div><%= f.submit "Resend unlock instructions" %></div> | 9 | <div><%= f.submit "Resend unlock instructions" %></div> |
10 | <% end %> | 10 | <% end %> |
11 | 11 | ||
12 | -<%= render :partial => "devise/shared/links" %> | ||
13 | \ No newline at end of file | 12 | \ No newline at end of file |
13 | +<%= render :partial => "devise/shared/links" %> |
app/views/issues/_issues.html.haml
1 | %table.round-borders#issues-table | 1 | %table.round-borders#issues-table |
2 | %tr | 2 | %tr |
3 | - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0" | 3 | - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0" |
4 | - %th | 4 | + %th |
5 | %th Assignee | 5 | %th Assignee |
6 | %th ID | 6 | %th ID |
7 | %th Title | 7 | %th Title |
app/views/issues/_show.html.haml
@@ -21,10 +21,10 @@ | @@ -21,10 +21,10 @@ | ||
21 | -#notes | 21 | -#notes |
22 | %td | 22 | %td |
23 | - if can? current_user, :write_issue, @project | 23 | - if can? current_user, :write_issue, @project |
24 | - = form_for([@project, issue], :remote => true) do |f| | 24 | + = form_for([@project, issue], :remote => true) do |f| |
25 | = f.check_box :closed, :onclick => "$(this).parent().submit();" | 25 | = f.check_box :closed, :onclick => "$(this).parent().submit();" |
26 | = hidden_field_tag :status_only, true | 26 | = hidden_field_tag :status_only, true |
27 | - - else | 27 | + - else |
28 | = check_box_tag "closed", 1, issue.closed, :disabled => true | 28 | = check_box_tag "closed", 1, issue.closed, :disabled => true |
29 | %td | 29 | %td |
30 | - if can?(current_user, :admin_issue, @project) || issue.author == current_user | 30 | - if can?(current_user, :admin_issue, @project) || issue.author == current_user |
app/views/issues/index.html.haml
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | .span-2 | 12 | .span-2 |
13 | = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues" | 13 | = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues" |
14 | = label_tag "my_issues","To Me" | 14 | = label_tag "my_issues","To Me" |
15 | - | 15 | + |
16 | .span-2 | 16 | .span-2 |
17 | = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues" | 17 | = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues" |
18 | = label_tag "all_issues","All" | 18 | = label_tag "all_issues","All" |
@@ -20,9 +20,9 @@ | @@ -20,9 +20,9 @@ | ||
20 | #issues-table-holder= render "issues" | 20 | #issues-table-holder= render "issues" |
21 | %br | 21 | %br |
22 | :javascript | 22 | :javascript |
23 | - $('.delete-issue').live('ajax:success', function() { | ||
24 | - $(this).closest('tr').fadeOut(); }); | ||
25 | - | 23 | + $('.delete-issue').live('ajax:success', function() { |
24 | + $(this).closest('tr').fadeOut(); }); | ||
25 | + | ||
26 | function setSortable(){ | 26 | function setSortable(){ |
27 | $('#issues-table>tbody').sortable({ | 27 | $('#issues-table>tbody').sortable({ |
28 | axis: 'y', | 28 | axis: 'y', |
app/views/issues/show.html.haml
@@ -8,24 +8,24 @@ | @@ -8,24 +8,24 @@ | ||
8 | .span-8 | 8 | .span-8 |
9 | - if @issue.closed | 9 | - if @issue.closed |
10 | %center.success Closed | 10 | %center.success Closed |
11 | - - else | 11 | + - else |
12 | %center.error Open | 12 | %center.error Open |
13 | %table.round-borders | 13 | %table.round-borders |
14 | %tr | 14 | %tr |
15 | - %td Title: | 15 | + %td Title: |
16 | %td | 16 | %td |
17 | = truncate html_escape(@issue.title) | 17 | = truncate html_escape(@issue.title) |
18 | %tr | 18 | %tr |
19 | - %td Project | 19 | + %td Project |
20 | %td | 20 | %td |
21 | %strong= @issue.project.name | 21 | %strong= @issue.project.name |
22 | %tr | 22 | %tr |
23 | - %td Author: | 23 | + %td Author: |
24 | %td | 24 | %td |
25 | = image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;" | 25 | = image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;" |
26 | = @issue.author.name | 26 | = @issue.author.name |
27 | %tr | 27 | %tr |
28 | - %td Assignee: | 28 | + %td Assignee: |
29 | %td | 29 | %td |
30 | = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" | 30 | = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" |
31 | = @issue.assignee.name | 31 | = @issue.assignee.name |
@@ -33,12 +33,11 @@ | @@ -33,12 +33,11 @@ | ||
33 | %td Closed? | 33 | %td Closed? |
34 | %td | 34 | %td |
35 | - if can? current_user, :write_issue, @project | 35 | - if can? current_user, :write_issue, @project |
36 | - = form_for([@project, @issue]) do |f| | 36 | + = form_for([@project, @issue]) do |f| |
37 | = f.check_box :closed, :onclick => "$(this).parent().submit();" | 37 | = f.check_box :closed, :onclick => "$(this).parent().submit();" |
38 | = hidden_field_tag :status_only, true | 38 | = hidden_field_tag :status_only, true |
39 | - - else | 39 | + - else |
40 | = check_box_tag "closed", 1, @issue.closed, :disabled => true | 40 | = check_box_tag "closed", 1, @issue.closed, :disabled => true |
41 | 41 | ||
42 | - | ||
43 | .clear | 42 | .clear |
44 | 43 |
app/views/issues/show.js.haml
app/views/issues/update.js.haml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | - if @issue.valid? | 2 | - if @issue.valid? |
3 | :plain | 3 | :plain |
4 | $("##{dom_id(@issue)}").fadeOut(); | 4 | $("##{dom_id(@issue)}").fadeOut(); |
5 | -- else | 5 | +- else |
6 | - if @issue.valid? | 6 | - if @issue.valid? |
7 | :plain | 7 | :plain |
8 | $("#edit_issue_dialog").dialog("close"); | 8 | $("#edit_issue_dialog").dialog("close"); |
app/views/keys/index.html.haml
@@ -10,6 +10,6 @@ | @@ -10,6 +10,6 @@ | ||
10 | = render(:partial => 'show', :locals => {:key => key}) | 10 | = render(:partial => 'show', :locals => {:key => key}) |
11 | 11 | ||
12 | :javascript | 12 | :javascript |
13 | - $('.delete-key').live('ajax:success', function() { | ||
14 | - $(this).closest('tr').fadeOut(); }); | 13 | + $('.delete-key').live('ajax:success', function() { |
14 | + $(this).closest('tr').fadeOut(); }); | ||
15 | 15 |
app/views/layouts/_flash.html.haml
@@ -6,9 +6,9 @@ | @@ -6,9 +6,9 @@ | ||
6 | %h4= text | 6 | %h4= text |
7 | :javascript | 7 | :javascript |
8 | $(function(){ | 8 | $(function(){ |
9 | - $("#flash_container").slideDown("slow"); | ||
10 | - $("#flash_container").click(function(){ | ||
11 | - $(this).slideUp("slow"); | 9 | + $("#flash_container").slideDown("slow"); |
10 | + $("#flash_container").click(function(){ | ||
11 | + $(this).slideUp("slow"); | ||
12 | }); | 12 | }); |
13 | setTimeout("hideFlash()",2000); | 13 | setTimeout("hideFlash()",2000); |
14 | }); | 14 | }); |
app/views/layouts/_head_panel.html.erb
app/views/notes/_form.html.haml
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | 22 | ||
23 | = check_box_tag :notify, 1, true | 23 | = check_box_tag :notify, 1, true |
24 | = label_tag :notify, "Notify project team about your note" | 24 | = label_tag :notify, "Notify project team about your note" |
25 | - | 25 | + |
26 | .clear | 26 | .clear |
27 | %br | 27 | %br |
28 | = f.submit 'Add note', :class => "lbutton vm", :id => "submit_note" | 28 | = f.submit 'Add note', :class => "lbutton vm", :id => "submit_note" |
app/views/notes/_notes.html.haml
1 | - if controller.action_name == "wall" | 1 | - if controller.action_name == "wall" |
2 | %ul#notes-list= render "notes/notes_list" | 2 | %ul#notes-list= render "notes/notes_list" |
3 | 3 | ||
4 | -- else | 4 | +- else |
5 | %ul#notes-list= render "notes/notes_list" | 5 | %ul#notes-list= render "notes/notes_list" |
6 | %br | 6 | %br |
7 | %br | 7 | %br |
@@ -9,17 +9,16 @@ | @@ -9,17 +9,16 @@ | ||
9 | = render "notes/form" | 9 | = render "notes/form" |
10 | 10 | ||
11 | :javascript | 11 | :javascript |
12 | - $('.delete-note').live('ajax:success', function() { | ||
13 | - $(this).closest('li').fadeOut(); }); | 12 | + $('.delete-note').live('ajax:success', function() { |
13 | + $(this).closest('li').fadeOut(); }); | ||
14 | 14 | ||
15 | $("#new_note").live("ajax:before", function(){ | 15 | $("#new_note").live("ajax:before", function(){ |
16 | - $("#submit_note").attr("disabled", "disabled"); | 16 | + $("#submit_note").attr("disabled", "disabled"); |
17 | }) | 17 | }) |
18 | 18 | ||
19 | $("#new_note").live("ajax:complete", function(){ | 19 | $("#new_note").live("ajax:complete", function(){ |
20 | - $("#submit_note").removeAttr("disabled"); | 20 | + $("#submit_note").removeAttr("disabled"); |
21 | }) | 21 | }) |
22 | - | ||
23 | 22 | ||
24 | - if ["issues", "projects"].include?(controller.controller_name) | 23 | - if ["issues", "projects"].include?(controller.controller_name) |
25 | :javascript | 24 | :javascript |
app/views/notes/create.js.haml
@@ -7,5 +7,5 @@ | @@ -7,5 +7,5 @@ | ||
7 | :plain | 7 | :plain |
8 | $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); | 8 | $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); |
9 | 9 | ||
10 | -:plain | 10 | +:plain |
11 | $("#submit_note").removeAttr("disabled"); | 11 | $("#submit_note").removeAttr("disabled"); |
app/views/notify/new_issue_email.html.haml
@@ -10,9 +10,9 @@ | @@ -10,9 +10,9 @@ | ||
10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
11 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 11 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
12 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 12 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
13 | - = link_to project_issue_url(@project, @issue) do | 13 | + = link_to project_issue_url(@project, @issue) do |
14 | = "Issue ##{@issue.id.to_s}" | 14 | = "Issue ##{@issue.id.to_s}" |
15 | - = truncate(@issue.title, :length => 45) | 15 | + = truncate(@issue.title, :length => 45) |
16 | %br | 16 | %br |
17 | %cite{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} | 17 | %cite{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} |
18 | = @issue.content | 18 | = @issue.content |
app/views/notify/new_user_email.html.haml
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - Hi #{@user.name}! | 7 | + Hi #{@user.name}! |
8 | %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} | 8 | %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} |
9 | Administrator created account for you. Now you are a member of company gitlab application. | 9 | Administrator created account for you. Now you are a member of company gitlab application. |
10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 10 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/note_issue_email.html.haml
@@ -4,10 +4,10 @@ | @@ -4,10 +4,10 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New comment - | ||
8 | - = link_to project_issue_url(@project, @issue, :anchor => "note_#{@note.id}") do | 7 | + New comment - |
8 | + = link_to project_issue_url(@project, @issue, :anchor => "note_#{@note.id}") do | ||
9 | = "Issue ##{@issue.id.to_s}" | 9 | = "Issue ##{@issue.id.to_s}" |
10 | - = truncate(@issue.title, :length => 35) | 10 | + = truncate(@issue.title, :length => 35) |
11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 11 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
12 | %tr | 12 | %tr |
13 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 13 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
app/views/notify/note_wall_email.html.haml
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 4 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
5 | %td{:align => "left", :style => "padding: 20px 0 0;"} | 5 | %td{:align => "left", :style => "padding: 20px 0 0;"} |
6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} | 6 | %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} |
7 | - New message on | 7 | + New message on |
8 | = link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}") | 8 | = link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}") |
9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} | 9 | %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} |
10 | %tr | 10 | %tr |
app/views/projects/_form.html.haml
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | %td | 21 | %td |
22 | = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? | 22 | = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? |
23 | %tr | 23 | %tr |
24 | - %td | 24 | + %td |
25 | .left= f.label :code | 25 | .left= f.label :code |
26 | %cite.right http://yourserver/ | 26 | %cite.right http://yourserver/ |
27 | %td= f.text_field :code, :placeholder => "example" | 27 | %td= f.text_field :code, :placeholder => "example" |
@@ -39,10 +39,10 @@ | @@ -39,10 +39,10 @@ | ||
39 | = image_tag "ajax-loader.gif", :class => "append-bottom" | 39 | = image_tag "ajax-loader.gif", :class => "append-bottom" |
40 | - if @project.new_record? | 40 | - if @project.new_record? |
41 | %h3.prepend-top Creating project & repository. Please wait for few minutes | 41 | %h3.prepend-top Creating project & repository. Please wait for few minutes |
42 | - - else | 42 | + - else |
43 | %h3.prepend-top Updating project & repository. Please wait for few minutes | 43 | %h3.prepend-top Updating project & repository. Please wait for few minutes |
44 | :javascript | 44 | :javascript |
45 | - $('.new_project, .edit_project').bind('ajax:before', function() { | ||
46 | - $(this).find(".form_content").hide(); | 45 | + $('.new_project, .edit_project').bind('ajax:before', function() { |
46 | + $(this).find(".form_content").hide(); | ||
47 | $('.ajax_loader').show(); | 47 | $('.ajax_loader').show(); |
48 | - }); | 48 | + }); |
app/views/projects/_list.html.haml
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | %td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled | 16 | %td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled |
17 | %td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled | 17 | %td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled |
18 | %td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled | 18 | %td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled |
19 | - %td | 19 | + %td |
20 | -if can? current_user, :admin_project, project | 20 | -if can? current_user, :admin_project, project |
21 | = link_to 'Edit', edit_project_path(project), :class => "lbutton positive" | 21 | = link_to 'Edit', edit_project_path(project), :class => "lbutton positive" |
22 | %br | 22 | %br |
app/views/projects/_projects_top_menu.html.haml
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | $(".list").toggle(); | 11 | $(".list").toggle(); |
12 | if($(".tile").is(":visible")){ | 12 | if($(".tile").is(":visible")){ |
13 | $.cookie('project_view', 'tile', { expires: 14 }); | 13 | $.cookie('project_view', 'tile', { expires: 14 }); |
14 | - } else { | 14 | + } else { |
15 | $.cookie('project_view', 'list', { expires: 14 }); | 15 | $.cookie('project_view', 'list', { expires: 14 }); |
16 | } | 16 | } |
17 | } | 17 | } |
app/views/projects/_recent_commits.html.haml
@@ -6,8 +6,8 @@ | @@ -6,8 +6,8 @@ | ||
6 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" | 6 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" |
7 | %p{:style => "margin-bottom: 3px;"} | 7 | %p{:style => "margin-bottom: 3px;"} |
8 | %strong | 8 | %strong |
9 | - = link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id) | ||
10 | - | 9 | + = link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id) |
10 | + | ||
11 | %span | 11 | %span |
12 | %span.author | 12 | %span.author |
13 | = commit.author.name.force_encoding("UTF-8") | 13 | = commit.author.name.force_encoding("UTF-8") |
app/views/projects/_team.html.haml
@@ -14,5 +14,5 @@ | @@ -14,5 +14,5 @@ | ||
14 | = render(:partial => 'team_members/show', :locals => {:member => up}) | 14 | = render(:partial => 'team_members/show', :locals => {:member => up}) |
15 | 15 | ||
16 | :javascript | 16 | :javascript |
17 | - $('.delete-team-member').live('ajax:success', function() { | ||
18 | - $(this).closest('tr').fadeOut(); }); | 17 | + $('.delete-team-member').live('ajax:success', function() { |
18 | + $(this).closest('tr').fadeOut(); }); |
app/views/projects/empty.html.erb
@@ -40,7 +40,7 @@ eos | @@ -40,7 +40,7 @@ eos | ||
40 | <p> | 40 | <p> |
41 | Be careful! <br/> | 41 | Be careful! <br/> |
42 | Project cant be recovered after destroy.</p> | 42 | Project cant be recovered after destroy.</p> |
43 | - <%= link_to 'Destroy', @project, | 43 | + <%= link_to 'Destroy', @project, |
44 | :confirm => 'Are you sure?', :method => :delete, | 44 | :confirm => 'Are you sure?', :method => :delete, |
45 | :class => "left button negative span-6", :style => "text-align:center" %> | 45 | :class => "left button negative span-6", :style => "text-align:center" %> |
46 | <div class="clear"></div> | 46 | <div class="clear"></div> |
app/views/projects/index.html.haml
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | = render "tile" | 3 | = render "tile" |
4 | %div{:class => "list", :style => view_mode_style("list")} | 4 | %div{:class => "list", :style => view_mode_style("list")} |
5 | = render "list" | 5 | = render "list" |
6 | -- else | 6 | +- else |
7 | %center.prepend-top | 7 | %center.prepend-top |
8 | %h2 | 8 | %h2 |
9 | %cite Nothing here | 9 | %cite Nothing here |
app/views/projects/tree.js.haml
1 | :plain | 1 | :plain |
2 | - $("#tree-holder table").hide("slide", { direction: "left" }, 150, function(){ | 2 | + $("#tree-holder table").hide("slide", { direction: "left" }, 150, function(){ |
3 | $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); | 3 | $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); |
4 | $("#tree-holder table").show("slide", { direction: "right" }, 150); | 4 | $("#tree-holder table").show("slide", { direction: "right" }, 150); |
5 | }); | 5 | }); |
app/views/projects/wall.html.haml
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | %hr | 20 | %hr |
21 | = render "notes/notes" | 21 | = render "notes/notes" |
22 | 22 | ||
23 | -:javascript | 23 | +:javascript |
24 | $(function(){ | 24 | $(function(){ |
25 | $("#note_note").live("click", function(){ | 25 | $("#note_note").live("click", function(){ |
26 | $(this).css("height", "100px"); | 26 | $(this).css("height", "100px"); |
app/views/projects/wall.js.haml
app/views/snippets/_form.html.haml
@@ -17,6 +17,6 @@ | @@ -17,6 +17,6 @@ | ||
17 | = f.label :content, "Code" | 17 | = f.label :content, "Code" |
18 | %br | 18 | %br |
19 | = f.text_area :content, :style => "height:240px;width:932px;" | 19 | = f.text_area :content, :style => "height:240px;width:932px;" |
20 | - | 20 | + |
21 | .actions.prepend-top | 21 | .actions.prepend-top |
22 | = f.submit 'Save', :class => "lbutton vm" | 22 | = f.submit 'Save', :class => "lbutton vm" |
app/views/snippets/index.html.haml
@@ -10,5 +10,5 @@ | @@ -10,5 +10,5 @@ | ||
10 | %th | 10 | %th |
11 | = render @snippets | 11 | = render @snippets |
12 | :javascript | 12 | :javascript |
13 | - $('.delete-snippet').live('ajax:success', function() { | ||
14 | - $(this).closest('tr').fadeOut(); }); | 13 | + $('.delete-snippet').live('ajax:success', function() { |
14 | + $(this).closest('tr').fadeOut(); }); |
app/views/team_members/_show.html.haml
@@ -7,11 +7,11 @@ | @@ -7,11 +7,11 @@ | ||
7 | 7 | ||
8 | %td= truncate user.email, :lenght => 16 | 8 | %td= truncate user.email, :lenght => 16 |
9 | - if can? current_user, :admin_project, @project | 9 | - if can? current_user, :admin_project, @project |
10 | - = form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f| | 10 | + = form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f| |
11 | %td= f.check_box :read, :onclick => "$(this.form).submit();" | 11 | %td= f.check_box :read, :onclick => "$(this.form).submit();" |
12 | %td= f.check_box :write, :onclick => "$(this.form).submit();" | 12 | %td= f.check_box :write, :onclick => "$(this.form).submit();" |
13 | %td= f.check_box :admin, :onclick => "$(this.form).submit();" | 13 | %td= f.check_box :admin, :onclick => "$(this.form).submit();" |
14 | - - else | 14 | + - else |
15 | %td= check_box_tag "read", 1, member.read, :disabled => :disabled | 15 | %td= check_box_tag "read", 1, member.read, :disabled => :disabled |
16 | %td= check_box_tag "commit", 1, member.write, :disabled => :disabled | 16 | %td= check_box_tag "commit", 1, member.write, :disabled => :disabled |
17 | %td= check_box_tag "admin", 1, member.admin, :disabled => :disabled | 17 | %td= check_box_tag "admin", 1, member.admin, :disabled => :disabled |
app/views/team_members/show.html.haml
config/environments/production.rb
@@ -58,7 +58,6 @@ Gitlab::Application.configure do | @@ -58,7 +58,6 @@ Gitlab::Application.configure do | ||
58 | # Send deprecation notices to registered listeners | 58 | # Send deprecation notices to registered listeners |
59 | config.active_support.deprecation = :notify | 59 | config.active_support.deprecation = :notify |
60 | 60 | ||
61 | - | ||
62 | config.action_mailer.delivery_method = :sendmail | 61 | config.action_mailer.delivery_method = :sendmail |
63 | # Defaults to: | 62 | # Defaults to: |
64 | # # config.action_mailer.sendmail_settings = { | 63 | # # config.action_mailer.sendmail_settings = { |
config/initializers/grit_ext.rb
config/routes.rb
1 | Gitlab::Application.routes.draw do | 1 | Gitlab::Application.routes.draw do |
2 | - namespace :admin do | 2 | + namespace :admin do |
3 | resources :users | 3 | resources :users |
4 | resources :projects | 4 | resources :projects |
5 | resources :team_members | 5 | resources :team_members |
@@ -10,7 +10,7 @@ Gitlab::Application.routes.draw do | @@ -10,7 +10,7 @@ Gitlab::Application.routes.draw do | ||
10 | root :to => "users#index" | 10 | root :to => "users#index" |
11 | end | 11 | end |
12 | 12 | ||
13 | - get "errors/gitosis" | 13 | + get "errors/gitosis" |
14 | get "profile/password", :to => "profile#password" | 14 | get "profile/password", :to => "profile#password" |
15 | put "profile/password", :to => "profile#password_update" | 15 | put "profile/password", :to => "profile#password_update" |
16 | put "profile/edit", :to => "profile#social_update" | 16 | put "profile/edit", :to => "profile#social_update" |
@@ -21,8 +21,8 @@ Gitlab::Application.routes.draw do | @@ -21,8 +21,8 @@ Gitlab::Application.routes.draw do | ||
21 | resources :keys | 21 | resources :keys |
22 | devise_for :users | 22 | devise_for :users |
23 | 23 | ||
24 | - resources :projects, :except => [:new, :create, :index], :path => "/" do | ||
25 | - member do | 24 | + resources :projects, :except => [:new, :create, :index], :path => "/" do |
25 | + member do | ||
26 | get "tree" | 26 | get "tree" |
27 | get "blob" | 27 | get "blob" |
28 | get "team" | 28 | get "team" |
@@ -32,7 +32,7 @@ Gitlab::Application.routes.draw do | @@ -32,7 +32,7 @@ Gitlab::Application.routes.draw do | ||
32 | get "tree/:commit_id" => "projects#tree" | 32 | get "tree/:commit_id" => "projects#tree" |
33 | get "tree/:commit_id/:path" => "projects#tree", | 33 | get "tree/:commit_id/:path" => "projects#tree", |
34 | :as => :tree_file, | 34 | :as => :tree_file, |
35 | - :constraints => { | 35 | + :constraints => { |
36 | :id => /[a-zA-Z0-9_\-]+/, | 36 | :id => /[a-zA-Z0-9_\-]+/, |
37 | :commit_id => /[a-zA-Z0-9]+/, | 37 | :commit_id => /[a-zA-Z0-9]+/, |
38 | :path => /.*/ | 38 | :path => /.*/ |
db/migrate/20110913200833_devise_create_users.rb
@@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration | @@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration | ||
11 | # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both | 11 | # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both |
12 | # t.token_authenticatable | 12 | # t.token_authenticatable |
13 | 13 | ||
14 | - | ||
15 | t.timestamps | 14 | t.timestamps |
16 | end | 15 | end |
17 | 16 |
lib/color.rb
@@ -17,7 +17,7 @@ module Color | @@ -17,7 +17,7 @@ module Color | ||
17 | 17 | ||
18 | def command(string) | 18 | def command(string) |
19 | `#{string}` | 19 | `#{string}` |
20 | - if $?.to_i > 0 | 20 | + if $?.to_i > 0 |
21 | puts red " == #{string} - FAIL" | 21 | puts red " == #{string} - FAIL" |
22 | puts red " == Error during configure" | 22 | puts red " == Error during configure" |
23 | exit | 23 | exit |
lib/commit_ext.rb
1 | module CommitExt | 1 | module CommitExt |
2 | def safe_message | 2 | def safe_message |
3 | - message.encode("UTF-8", | ||
4 | - :invalid => :replace, | ||
5 | - :undef => :replace, | 3 | + message.encode("UTF-8", |
4 | + :invalid => :replace, | ||
5 | + :undef => :replace, | ||
6 | :universal_newline => true, | 6 | :universal_newline => true, |
7 | :replace => "") | 7 | :replace => "") |
8 | - rescue | 8 | + rescue |
9 | "-- invalid encoding for commit message" | 9 | "-- invalid encoding for commit message" |
10 | end | 10 | end |
11 | end | 11 | end |
lib/file_size_validator.rb
@@ -33,7 +33,7 @@ class FileSizeValidator < ActiveModel::EachValidator | @@ -33,7 +33,7 @@ class FileSizeValidator < ActiveModel::EachValidator | ||
33 | 33 | ||
34 | def validate_each(record, attribute, value) | 34 | def validate_each(record, attribute, value) |
35 | raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base | 35 | raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base |
36 | - | 36 | + |
37 | value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String) | 37 | value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String) |
38 | 38 | ||
39 | CHECKS.each do |key, validity_check| | 39 | CHECKS.each do |key, validity_check| |
@@ -53,7 +53,7 @@ class FileSizeValidator < ActiveModel::EachValidator | @@ -53,7 +53,7 @@ class FileSizeValidator < ActiveModel::EachValidator | ||
53 | record.errors.add(attribute, MESSAGES[key], errors_options) | 53 | record.errors.add(attribute, MESSAGES[key], errors_options) |
54 | end | 54 | end |
55 | end | 55 | end |
56 | - | 56 | + |
57 | def help | 57 | def help |
58 | Helper.instance | 58 | Helper.instance |
59 | end | 59 | end |
lib/utils.rb
public/index.html.example
@@ -25,7 +25,6 @@ | @@ -25,7 +25,6 @@ | ||
25 | text-decoration: none; | 25 | text-decoration: none; |
26 | } | 26 | } |
27 | 27 | ||
28 | - | ||
29 | #page { | 28 | #page { |
30 | background-color: #f0f0f0; | 29 | background-color: #f0f0f0; |
31 | width: 750px; | 30 | width: 750px; |
@@ -57,7 +56,6 @@ | @@ -57,7 +56,6 @@ | ||
57 | padding-right: 30px; | 56 | padding-right: 30px; |
58 | } | 57 | } |
59 | 58 | ||
60 | - | ||
61 | #header { | 59 | #header { |
62 | background-image: url("/assets/rails.png"); | 60 | background-image: url("/assets/rails.png"); |
63 | background-repeat: no-repeat; | 61 | background-repeat: no-repeat; |
@@ -71,7 +69,6 @@ | @@ -71,7 +69,6 @@ | ||
71 | font-size: 16px; | 69 | font-size: 16px; |
72 | } | 70 | } |
73 | 71 | ||
74 | - | ||
75 | #about h3 { | 72 | #about h3 { |
76 | margin: 0; | 73 | margin: 0; |
77 | margin-bottom: 10px; | 74 | margin-bottom: 10px; |
@@ -112,7 +109,6 @@ | @@ -112,7 +109,6 @@ | ||
112 | padding: 10px; | 109 | padding: 10px; |
113 | } | 110 | } |
114 | 111 | ||
115 | - | ||
116 | #getting-started { | 112 | #getting-started { |
117 | border-top: 1px solid #ccc; | 113 | border-top: 1px solid #ccc; |
118 | margin-top: 25px; | 114 | margin-top: 25px; |
@@ -149,7 +145,6 @@ | @@ -149,7 +145,6 @@ | ||
149 | font-size: 13px; | 145 | font-size: 13px; |
150 | } | 146 | } |
151 | 147 | ||
152 | - | ||
153 | #sidebar ul { | 148 | #sidebar ul { |
154 | margin-left: 0; | 149 | margin-left: 0; |
155 | padding-left: 0; | 150 | padding-left: 0; |
spec/factory.rb
1 | class Factory | 1 | class Factory |
2 | @factories = {} | 2 | @factories = {} |
3 | 3 | ||
4 | - class << self | 4 | + class << self |
5 | def add(name, klass, &block) | 5 | def add(name, klass, &block) |
6 | @factories[name] = [klass, block] | 6 | @factories[name] = [klass, block] |
7 | end | 7 | end |
@@ -13,10 +13,10 @@ class Factory | @@ -13,10 +13,10 @@ class Factory | ||
13 | def new(name, opts) | 13 | def new(name, opts) |
14 | factory = @factories[name] | 14 | factory = @factories[name] |
15 | factory[0].new.tap do |obj| | 15 | factory[0].new.tap do |obj| |
16 | - factory[1].call(obj) | 16 | + factory[1].call(obj) |
17 | end.tap do |obj| | 17 | end.tap do |obj| |
18 | opts.each do |k, opt| | 18 | opts.each do |k, opt| |
19 | - obj.send("#{k}=", opt) | 19 | + obj.send("#{k}=", opt) |
20 | end | 20 | end |
21 | end | 21 | end |
22 | end | 22 | end |
spec/models/issue_spec.rb
@@ -14,7 +14,7 @@ describe Issue do | @@ -14,7 +14,7 @@ describe Issue do | ||
14 | it { should validate_presence_of(:assignee_id) } | 14 | it { should validate_presence_of(:assignee_id) } |
15 | end | 15 | end |
16 | 16 | ||
17 | - describe "Scope" do | 17 | + describe "Scope" do |
18 | it { Issue.should respond_to :closed } | 18 | it { Issue.should respond_to :closed } |
19 | it { Issue.should respond_to :opened } | 19 | it { Issue.should respond_to :opened } |
20 | end | 20 | end |
spec/models/key_spec.rb
@@ -10,7 +10,7 @@ describe Key do | @@ -10,7 +10,7 @@ describe Key do | ||
10 | it { should validate_presence_of(:key) } | 10 | it { should validate_presence_of(:key) } |
11 | end | 11 | end |
12 | 12 | ||
13 | - describe "Methods" do | 13 | + describe "Methods" do |
14 | it { should respond_to :projects } | 14 | it { should respond_to :projects } |
15 | end | 15 | end |
16 | 16 |
spec/models/note_spec.rb
@@ -13,8 +13,8 @@ describe Note do | @@ -13,8 +13,8 @@ describe Note do | ||
13 | it { Factory.create(:note, | 13 | it { Factory.create(:note, |
14 | :project => Factory.create(:project)).should be_valid } | 14 | :project => Factory.create(:project)).should be_valid } |
15 | 15 | ||
16 | - describe :authorization do | ||
17 | - before do | 16 | + describe :authorization do |
17 | + before do | ||
18 | @p1 = Factory :project | 18 | @p1 = Factory :project |
19 | @p2 = Factory :project, :code => "alien", :path => "legit_1" | 19 | @p2 = Factory :project, :code => "alien", :path => "legit_1" |
20 | @u1 = Factory :user | 20 | @u1 = Factory :user |
@@ -24,10 +24,10 @@ describe Note do | @@ -24,10 +24,10 @@ describe Note do | ||
24 | @abilities << Ability | 24 | @abilities << Ability |
25 | end | 25 | end |
26 | 26 | ||
27 | - describe :read do | ||
28 | - before do | ||
29 | - @p1.users_projects.create(:user => @u1, :read => false) | ||
30 | - @p1.users_projects.create(:user => @u2, :read => true) | 27 | + describe :read do |
28 | + before do | ||
29 | + @p1.users_projects.create(:user => @u1, :read => false) | ||
30 | + @p1.users_projects.create(:user => @u2, :read => true) | ||
31 | @p2.users_projects.create(:user => @u3, :read => true) | 31 | @p2.users_projects.create(:user => @u3, :read => true) |
32 | end | 32 | end |
33 | 33 | ||
@@ -36,11 +36,11 @@ describe Note do | @@ -36,11 +36,11 @@ describe Note do | ||
36 | it { @abilities.allowed?(@u3, :read_note, @p1).should be_false } | 36 | it { @abilities.allowed?(@u3, :read_note, @p1).should be_false } |
37 | end | 37 | end |
38 | 38 | ||
39 | - describe :write do | ||
40 | - before do | ||
41 | - @p1.users_projects.create(:user => @u1, :write => false) | ||
42 | - @p1.users_projects.create(:user => @u2, :write => true) | ||
43 | - @p2.users_projects.create(:user => @u3, :write => true) | 39 | + describe :write do |
40 | + before do | ||
41 | + @p1.users_projects.create(:user => @u1, :write => false) | ||
42 | + @p1.users_projects.create(:user => @u2, :write => true) | ||
43 | + @p2.users_projects.create(:user => @u3, :write => true) | ||
44 | end | 44 | end |
45 | 45 | ||
46 | it { @abilities.allowed?(@u1, :write_note, @p1).should be_false } | 46 | it { @abilities.allowed?(@u1, :write_note, @p1).should be_false } |
@@ -48,11 +48,11 @@ describe Note do | @@ -48,11 +48,11 @@ describe Note do | ||
48 | it { @abilities.allowed?(@u3, :write_note, @p1).should be_false } | 48 | it { @abilities.allowed?(@u3, :write_note, @p1).should be_false } |
49 | end | 49 | end |
50 | 50 | ||
51 | - describe :admin do | ||
52 | - before do | ||
53 | - @p1.users_projects.create(:user => @u1, :admin => false) | ||
54 | - @p1.users_projects.create(:user => @u2, :admin => true) | ||
55 | - @p2.users_projects.create(:user => @u3, :admin => true) | 51 | + describe :admin do |
52 | + before do | ||
53 | + @p1.users_projects.create(:user => @u1, :admin => false) | ||
54 | + @p1.users_projects.create(:user => @u2, :admin => true) | ||
55 | + @p2.users_projects.create(:user => @u3, :admin => true) | ||
56 | end | 56 | end |
57 | 57 | ||
58 | it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false } | 58 | it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false } |
spec/models/project_security_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe Project do | 3 | describe Project do |
4 | - describe :authorization do | ||
5 | - before do | 4 | + describe :authorization do |
5 | + before do | ||
6 | @p1 = Factory :project | 6 | @p1 = Factory :project |
7 | @u1 = Factory :user | 7 | @u1 = Factory :user |
8 | @u2 = Factory :user | 8 | @u2 = Factory :user |
@@ -10,30 +10,30 @@ describe Project do | @@ -10,30 +10,30 @@ describe Project do | ||
10 | @abilities << Ability | 10 | @abilities << Ability |
11 | end | 11 | end |
12 | 12 | ||
13 | - describe :read do | ||
14 | - before do | ||
15 | - @p1.users_projects.create(:project => @p1, :user => @u1, :read => false) | ||
16 | - @p1.users_projects.create(:project => @p1, :user => @u2, :read => true) | 13 | + describe :read do |
14 | + before do | ||
15 | + @p1.users_projects.create(:project => @p1, :user => @u1, :read => false) | ||
16 | + @p1.users_projects.create(:project => @p1, :user => @u2, :read => true) | ||
17 | end | 17 | end |
18 | 18 | ||
19 | it { @abilities.allowed?(@u1, :read_project, @p1).should be_false } | 19 | it { @abilities.allowed?(@u1, :read_project, @p1).should be_false } |
20 | it { @abilities.allowed?(@u2, :read_project, @p1).should be_true } | 20 | it { @abilities.allowed?(@u2, :read_project, @p1).should be_true } |
21 | end | 21 | end |
22 | 22 | ||
23 | - describe :write do | ||
24 | - before do | ||
25 | - @p1.users_projects.create(:project => @p1, :user => @u1, :write => false) | ||
26 | - @p1.users_projects.create(:project => @p1, :user => @u2, :write => true) | 23 | + describe :write do |
24 | + before do | ||
25 | + @p1.users_projects.create(:project => @p1, :user => @u1, :write => false) | ||
26 | + @p1.users_projects.create(:project => @p1, :user => @u2, :write => true) | ||
27 | end | 27 | end |
28 | 28 | ||
29 | it { @abilities.allowed?(@u1, :write_project, @p1).should be_false } | 29 | it { @abilities.allowed?(@u1, :write_project, @p1).should be_false } |
30 | it { @abilities.allowed?(@u2, :write_project, @p1).should be_true } | 30 | it { @abilities.allowed?(@u2, :write_project, @p1).should be_true } |
31 | end | 31 | end |
32 | 32 | ||
33 | - describe :admin do | ||
34 | - before do | ||
35 | - @p1.users_projects.create(:project => @p1, :user => @u1, :admin => false) | ||
36 | - @p1.users_projects.create(:project => @p1, :user => @u2, :admin => true) | 33 | + describe :admin do |
34 | + before do | ||
35 | + @p1.users_projects.create(:project => @p1, :user => @u1, :admin => false) | ||
36 | + @p1.users_projects.create(:project => @p1, :user => @u2, :admin => true) | ||
37 | end | 37 | end |
38 | 38 | ||
39 | it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false } | 39 | it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false } |
spec/models/project_spec.rb
@@ -40,20 +40,20 @@ describe Project do | @@ -40,20 +40,20 @@ describe Project do | ||
40 | should_not allow_value("gitosis-admin").for(:path) | 40 | should_not allow_value("gitosis-admin").for(:path) |
41 | end | 41 | end |
42 | 42 | ||
43 | - it "should return valid url to repo" do | 43 | + it "should return valid url to repo" do |
44 | project = Project.new(:path => "somewhere") | 44 | project = Project.new(:path => "somewhere") |
45 | project.url_to_repo.should == "git@localhost:somewhere.git" | 45 | project.url_to_repo.should == "git@localhost:somewhere.git" |
46 | end | 46 | end |
47 | 47 | ||
48 | - it "should return path to repo" do | 48 | + it "should return path to repo" do |
49 | project = Project.new(:path => "somewhere") | 49 | project = Project.new(:path => "somewhere") |
50 | project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") | 50 | project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") |
51 | end | 51 | end |
52 | 52 | ||
53 | - describe :valid_repo? do | ||
54 | - it "should be valid repo" do | 53 | + describe :valid_repo? do |
54 | + it "should be valid repo" do | ||
55 | project = Factory :project | 55 | project = Factory :project |
56 | - project.valid_repo?.should be_true | 56 | + project.valid_repo?.should be_true |
57 | end | 57 | end |
58 | 58 | ||
59 | it "should be invalid repo" do | 59 | it "should be invalid repo" do |
@@ -62,43 +62,43 @@ describe Project do | @@ -62,43 +62,43 @@ describe Project do | ||
62 | end | 62 | end |
63 | end | 63 | end |
64 | 64 | ||
65 | - describe "Git methods" do | 65 | + describe "Git methods" do |
66 | let(:project) { Factory :project } | 66 | let(:project) { Factory :project } |
67 | 67 | ||
68 | - describe :repo do | ||
69 | - it "should return valid repo" do | 68 | + describe :repo do |
69 | + it "should return valid repo" do | ||
70 | project.repo.should be_kind_of(Grit::Repo) | 70 | project.repo.should be_kind_of(Grit::Repo) |
71 | end | 71 | end |
72 | 72 | ||
73 | - it "should return nil" do | 73 | + it "should return nil" do |
74 | lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError) | 74 | lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError) |
75 | end | 75 | end |
76 | 76 | ||
77 | - it "should return nil" do | 77 | + it "should return nil" do |
78 | lambda { Project.new.repo }.should raise_error(TypeError) | 78 | lambda { Project.new.repo }.should raise_error(TypeError) |
79 | end | 79 | end |
80 | end | 80 | end |
81 | 81 | ||
82 | - describe :commit do | ||
83 | - it "should return first head commit if without params" do | 82 | + describe :commit do |
83 | + it "should return first head commit if without params" do | ||
84 | project.commit.id.should == project.repo.commits.first.id | 84 | project.commit.id.should == project.repo.commits.first.id |
85 | end | 85 | end |
86 | 86 | ||
87 | - it "should return valid commit" do | 87 | + it "should return valid commit" do |
88 | project.commit(ValidCommit::ID).should be_valid_commit | 88 | project.commit(ValidCommit::ID).should be_valid_commit |
89 | end | 89 | end |
90 | 90 | ||
91 | - it "should return nil" do | 91 | + it "should return nil" do |
92 | project.commit("+123_4532530XYZ").should be_nil | 92 | project.commit("+123_4532530XYZ").should be_nil |
93 | end | 93 | end |
94 | end | 94 | end |
95 | 95 | ||
96 | - describe :tree do | ||
97 | - before do | 96 | + describe :tree do |
97 | + before do | ||
98 | @commit = project.commit(ValidCommit::ID) | 98 | @commit = project.commit(ValidCommit::ID) |
99 | end | 99 | end |
100 | 100 | ||
101 | - it "should raise error w/o arguments" do | 101 | + it "should raise error w/o arguments" do |
102 | lambda { project.tree }.should raise_error | 102 | lambda { project.tree }.should raise_error |
103 | end | 103 | end |
104 | 104 |
spec/models/user_spec.rb
@@ -14,7 +14,7 @@ describe User do | @@ -14,7 +14,7 @@ describe User do | ||
14 | it { should respond_to(:name) } | 14 | it { should respond_to(:name) } |
15 | end | 15 | end |
16 | 16 | ||
17 | - it "should return valid identifier" do | 17 | + it "should return valid identifier" do |
18 | user = User.new(:email => "test@mail.com") | 18 | user = User.new(:email => "test@mail.com") |
19 | user.identifier.should == "test_mail.com" | 19 | user.identifier.should == "test_mail.com" |
20 | end | 20 | end |
spec/models/users_project_spec.rb
@@ -11,7 +11,7 @@ describe UsersProject do | @@ -11,7 +11,7 @@ describe UsersProject do | ||
11 | it { should validate_presence_of(:project_id) } | 11 | it { should validate_presence_of(:project_id) } |
12 | end | 12 | end |
13 | 13 | ||
14 | - describe "Delegate methods" do | 14 | + describe "Delegate methods" do |
15 | it { should respond_to(:user_name) } | 15 | it { should respond_to(:user_name) } |
16 | it { should respond_to(:user_email) } | 16 | it { should respond_to(:user_email) } |
17 | end | 17 | end |
spec/monkeypatch.rb
1 | # Stubbing Project <-> gitosis path | 1 | # Stubbing Project <-> gitosis path |
2 | # create project using Factory only | 2 | # create project using Factory only |
3 | -class Project | 3 | +class Project |
4 | def update_gitosis_project | 4 | def update_gitosis_project |
5 | true | 5 | true |
6 | end | 6 | end |
@@ -9,12 +9,12 @@ class Project | @@ -9,12 +9,12 @@ class Project | ||
9 | true | 9 | true |
10 | end | 10 | end |
11 | 11 | ||
12 | - def path_to_repo | 12 | + def path_to_repo |
13 | File.join(Rails.root, "tmp", "tests", path) | 13 | File.join(Rails.root, "tmp", "tests", path) |
14 | end | 14 | end |
15 | end | 15 | end |
16 | 16 | ||
17 | -class Key | 17 | +class Key |
18 | def update_gitosis | 18 | def update_gitosis |
19 | true | 19 | true |
20 | end | 20 | end |
spec/requests/admin/admin_projects_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe "Admin::Projects" do | 3 | describe "Admin::Projects" do |
4 | - before do | 4 | + before do |
5 | @project = Factory :project, | 5 | @project = Factory :project, |
6 | :name => "LeGiT", | 6 | :name => "LeGiT", |
7 | :code => "LGT" | 7 | :code => "LGT" |
@@ -9,7 +9,7 @@ describe "Admin::Projects" do | @@ -9,7 +9,7 @@ describe "Admin::Projects" do | ||
9 | end | 9 | end |
10 | 10 | ||
11 | describe "GET /admin/projects" do | 11 | describe "GET /admin/projects" do |
12 | - before do | 12 | + before do |
13 | visit admin_projects_path | 13 | visit admin_projects_path |
14 | end | 14 | end |
15 | 15 | ||
@@ -17,49 +17,49 @@ describe "Admin::Projects" do | @@ -17,49 +17,49 @@ describe "Admin::Projects" do | ||
17 | current_path.should == admin_projects_path | 17 | current_path.should == admin_projects_path |
18 | end | 18 | end |
19 | 19 | ||
20 | - it "should have projects list" do | 20 | + it "should have projects list" do |
21 | page.should have_content(@project.code) | 21 | page.should have_content(@project.code) |
22 | page.should have_content(@project.name) | 22 | page.should have_content(@project.name) |
23 | end | 23 | end |
24 | end | 24 | end |
25 | 25 | ||
26 | - describe "GET /admin/projects/:id" do | ||
27 | - before do | 26 | + describe "GET /admin/projects/:id" do |
27 | + before do | ||
28 | visit admin_projects_path | 28 | visit admin_projects_path |
29 | click_link "Show" | 29 | click_link "Show" |
30 | end | 30 | end |
31 | 31 | ||
32 | - it "should have project info" do | 32 | + it "should have project info" do |
33 | page.should have_content(@project.code) | 33 | page.should have_content(@project.code) |
34 | page.should have_content(@project.name) | 34 | page.should have_content(@project.name) |
35 | end | 35 | end |
36 | end | 36 | end |
37 | 37 | ||
38 | - describe "GET /admin/projects/:id/edit" do | ||
39 | - before do | 38 | + describe "GET /admin/projects/:id/edit" do |
39 | + before do | ||
40 | visit admin_projects_path | 40 | visit admin_projects_path |
41 | click_link "edit_project_#{@project.id}" | 41 | click_link "edit_project_#{@project.id}" |
42 | end | 42 | end |
43 | 43 | ||
44 | - it "should have project edit page" do | 44 | + it "should have project edit page" do |
45 | page.should have_content("Name") | 45 | page.should have_content("Name") |
46 | page.should have_content("Code") | 46 | page.should have_content("Code") |
47 | end | 47 | end |
48 | 48 | ||
49 | describe "Update project" do | 49 | describe "Update project" do |
50 | - before do | 50 | + before do |
51 | fill_in "project_name", :with => "Big Bang" | 51 | fill_in "project_name", :with => "Big Bang" |
52 | fill_in "project_code", :with => "BB1" | 52 | fill_in "project_code", :with => "BB1" |
53 | click_button "Save" | 53 | click_button "Save" |
54 | @project.reload | 54 | @project.reload |
55 | end | 55 | end |
56 | 56 | ||
57 | - it "should show page with new data" do | 57 | + it "should show page with new data" do |
58 | page.should have_content("BB1") | 58 | page.should have_content("BB1") |
59 | page.should have_content("Big Bang") | 59 | page.should have_content("Big Bang") |
60 | end | 60 | end |
61 | 61 | ||
62 | - it "should change project entry" do | 62 | + it "should change project entry" do |
63 | @project.name.should == "Big Bang" | 63 | @project.name.should == "Big Bang" |
64 | @project.code.should == "BB1" | 64 | @project.code.should == "BB1" |
65 | end | 65 | end |
@@ -67,24 +67,24 @@ describe "Admin::Projects" do | @@ -67,24 +67,24 @@ describe "Admin::Projects" do | ||
67 | end | 67 | end |
68 | 68 | ||
69 | describe "GET /admin/projects/new" do | 69 | describe "GET /admin/projects/new" do |
70 | - before do | 70 | + before do |
71 | visit admin_projects_path | 71 | visit admin_projects_path |
72 | click_link "New Project" | 72 | click_link "New Project" |
73 | end | 73 | end |
74 | 74 | ||
75 | it "should be correct path" do | 75 | it "should be correct path" do |
76 | - current_path.should == new_admin_project_path | 76 | + current_path.should == new_admin_project_path |
77 | end | 77 | end |
78 | 78 | ||
79 | it "should have labels for new project" do | 79 | it "should have labels for new project" do |
80 | - page.should have_content("Name") | ||
81 | - page.should have_content("Path") | ||
82 | - page.should have_content("Description") | 80 | + page.should have_content("Name") |
81 | + page.should have_content("Path") | ||
82 | + page.should have_content("Description") | ||
83 | end | 83 | end |
84 | end | 84 | end |
85 | 85 | ||
86 | describe "POST /admin/projects" do | 86 | describe "POST /admin/projects" do |
87 | - before do | 87 | + before do |
88 | visit new_admin_project_path | 88 | visit new_admin_project_path |
89 | fill_in 'Name', :with => 'NewProject' | 89 | fill_in 'Name', :with => 'NewProject' |
90 | fill_in 'Code', :with => 'NPR' | 90 | fill_in 'Code', :with => 'NPR' |
spec/requests/admin/admin_users_spec.rb
@@ -4,7 +4,7 @@ describe "Admin::Users" do | @@ -4,7 +4,7 @@ describe "Admin::Users" do | ||
4 | before { login_as :admin } | 4 | before { login_as :admin } |
5 | 5 | ||
6 | describe "GET /admin/users" do | 6 | describe "GET /admin/users" do |
7 | - before do | 7 | + before do |
8 | visit admin_users_path | 8 | visit admin_users_path |
9 | end | 9 | end |
10 | 10 | ||
@@ -12,14 +12,14 @@ describe "Admin::Users" do | @@ -12,14 +12,14 @@ describe "Admin::Users" do | ||
12 | current_path.should == admin_users_path | 12 | current_path.should == admin_users_path |
13 | end | 13 | end |
14 | 14 | ||
15 | - it "should have users list" do | 15 | + it "should have users list" do |
16 | page.should have_content(@user.email) | 16 | page.should have_content(@user.email) |
17 | page.should have_content(@user.name) | 17 | page.should have_content(@user.name) |
18 | end | 18 | end |
19 | end | 19 | end |
20 | 20 | ||
21 | - describe "GET /admin/users/new" do | ||
22 | - before do | 21 | + describe "GET /admin/users/new" do |
22 | + before do | ||
23 | @password = "123ABC" | 23 | @password = "123ABC" |
24 | visit new_admin_user_path | 24 | visit new_admin_user_path |
25 | fill_in "user_name", :with => "Big Bang" | 25 | fill_in "user_name", :with => "Big Bang" |
@@ -28,23 +28,23 @@ describe "Admin::Users" do | @@ -28,23 +28,23 @@ describe "Admin::Users" do | ||
28 | fill_in "user_password_confirmation", :with => @password | 28 | fill_in "user_password_confirmation", :with => @password |
29 | end | 29 | end |
30 | 30 | ||
31 | - it "should create new user" do | 31 | + it "should create new user" do |
32 | expect { click_button "Save" }.to change {User.count}.by(1) | 32 | expect { click_button "Save" }.to change {User.count}.by(1) |
33 | end | 33 | end |
34 | 34 | ||
35 | - it "should create user with valid data" do | 35 | + it "should create user with valid data" do |
36 | click_button "Save" | 36 | click_button "Save" |
37 | user = User.last | 37 | user = User.last |
38 | user.name.should == "Big Bang" | 38 | user.name.should == "Big Bang" |
39 | user.email.should == "bigbang@mail.com" | 39 | user.email.should == "bigbang@mail.com" |
40 | end | 40 | end |
41 | 41 | ||
42 | - it "should call send mail" do | 42 | + it "should call send mail" do |
43 | Notify.should_receive(:new_user_email).and_return(stub(:deliver => true)) | 43 | Notify.should_receive(:new_user_email).and_return(stub(:deliver => true)) |
44 | click_button "Save" | 44 | click_button "Save" |
45 | end | 45 | end |
46 | 46 | ||
47 | - it "should send valid email to user with email & password" do | 47 | + it "should send valid email to user with email & password" do |
48 | click_button "Save" | 48 | click_button "Save" |
49 | user = User.last | 49 | user = User.last |
50 | email = ActionMailer::Base.deliveries.last | 50 | email = ActionMailer::Base.deliveries.last |
@@ -54,45 +54,45 @@ describe "Admin::Users" do | @@ -54,45 +54,45 @@ describe "Admin::Users" do | ||
54 | end | 54 | end |
55 | end | 55 | end |
56 | 56 | ||
57 | - describe "GET /admin/users/:id" do | ||
58 | - before do | 57 | + describe "GET /admin/users/:id" do |
58 | + before do | ||
59 | visit admin_users_path | 59 | visit admin_users_path |
60 | click_link "Show" | 60 | click_link "Show" |
61 | end | 61 | end |
62 | 62 | ||
63 | - it "should have user info" do | 63 | + it "should have user info" do |
64 | page.should have_content(@user.email) | 64 | page.should have_content(@user.email) |
65 | page.should have_content(@user.name) | 65 | page.should have_content(@user.name) |
66 | page.should have_content(@user.is_admin?) | 66 | page.should have_content(@user.is_admin?) |
67 | end | 67 | end |
68 | end | 68 | end |
69 | 69 | ||
70 | - describe "GET /admin/users/:id/edit" do | ||
71 | - before do | 70 | + describe "GET /admin/users/:id/edit" do |
71 | + before do | ||
72 | @simple_user = Factory :user | 72 | @simple_user = Factory :user |
73 | visit admin_users_path | 73 | visit admin_users_path |
74 | click_link "edit_user_#{@simple_user.id}" | 74 | click_link "edit_user_#{@simple_user.id}" |
75 | end | 75 | end |
76 | 76 | ||
77 | - it "should have user edit page" do | 77 | + it "should have user edit page" do |
78 | page.should have_content("Name") | 78 | page.should have_content("Name") |
79 | page.should have_content("Password") | 79 | page.should have_content("Password") |
80 | end | 80 | end |
81 | 81 | ||
82 | describe "Update user" do | 82 | describe "Update user" do |
83 | - before do | 83 | + before do |
84 | fill_in "user_name", :with => "Big Bang" | 84 | fill_in "user_name", :with => "Big Bang" |
85 | fill_in "user_email", :with => "bigbang@mail.com" | 85 | fill_in "user_email", :with => "bigbang@mail.com" |
86 | check "user_admin" | 86 | check "user_admin" |
87 | click_button "Save" | 87 | click_button "Save" |
88 | end | 88 | end |
89 | 89 | ||
90 | - it "should show page with new data" do | 90 | + it "should show page with new data" do |
91 | page.should have_content("bigbang@mail.com") | 91 | page.should have_content("bigbang@mail.com") |
92 | page.should have_content("Big Bang") | 92 | page.should have_content("Big Bang") |
93 | end | 93 | end |
94 | 94 | ||
95 | - it "should change user entry" do | 95 | + it "should change user entry" do |
96 | @simple_user.reload | 96 | @simple_user.reload |
97 | @simple_user.name.should == "Big Bang" | 97 | @simple_user.name.should == "Big Bang" |
98 | @simple_user.is_admin?.should be_true | 98 | @simple_user.is_admin?.should be_true |
spec/requests/admin/security_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe "Admin::Projects" do | 3 | describe "Admin::Projects" do |
4 | - describe "GET /admin/projects" do | 4 | + describe "GET /admin/projects" do |
5 | it { admin_projects_path.should be_allowed_for :admin } | 5 | it { admin_projects_path.should be_allowed_for :admin } |
6 | it { admin_projects_path.should be_denied_for :user } | 6 | it { admin_projects_path.should be_denied_for :user } |
7 | it { admin_projects_path.should be_denied_for :visitor } | 7 | it { admin_projects_path.should be_denied_for :visitor } |
8 | end | 8 | end |
9 | 9 | ||
10 | - describe "GET /admin/users" do | 10 | + describe "GET /admin/users" do |
11 | it { admin_users_path.should be_allowed_for :admin } | 11 | it { admin_users_path.should be_allowed_for :admin } |
12 | it { admin_users_path.should be_denied_for :user } | 12 | it { admin_users_path.should be_denied_for :user } |
13 | it { admin_users_path.should be_denied_for :visitor } | 13 | it { admin_users_path.should be_denied_for :visitor } |
14 | end | 14 | end |
15 | 15 | ||
16 | - describe "GET /admin/team_members" do | 16 | + describe "GET /admin/team_members" do |
17 | it { admin_team_members_path.should be_allowed_for :admin } | 17 | it { admin_team_members_path.should be_allowed_for :admin } |
18 | it { admin_team_members_path.should be_denied_for :user } | 18 | it { admin_team_members_path.should be_denied_for :user } |
19 | it { admin_team_members_path.should be_denied_for :visitor } | 19 | it { admin_team_members_path.should be_denied_for :visitor } |
20 | end | 20 | end |
21 | 21 | ||
22 | - describe "GET /admin/emails" do | 22 | + describe "GET /admin/emails" do |
23 | it { admin_emails_path.should be_allowed_for :admin } | 23 | it { admin_emails_path.should be_allowed_for :admin } |
24 | it { admin_emails_path.should be_denied_for :user } | 24 | it { admin_emails_path.should be_denied_for :user } |
25 | it { admin_emails_path.should be_denied_for :visitor } | 25 | it { admin_emails_path.should be_denied_for :visitor } |
spec/requests/commits_notes_spec.rb
@@ -4,13 +4,13 @@ describe "Issues" do | @@ -4,13 +4,13 @@ describe "Issues" do | ||
4 | let(:project) { Factory :project } | 4 | let(:project) { Factory :project } |
5 | let!(:commit) { project.repo.commits.first } | 5 | let!(:commit) { project.repo.commits.first } |
6 | 6 | ||
7 | - before do | 7 | + before do |
8 | login_as :user | 8 | login_as :user |
9 | project.add_access(@user, :read, :write) | 9 | project.add_access(@user, :read, :write) |
10 | end | 10 | end |
11 | 11 | ||
12 | - describe "add new note", :js => true do | ||
13 | - before do | 12 | + describe "add new note", :js => true do |
13 | + before do | ||
14 | visit project_commit_path(project, commit) | 14 | visit project_commit_path(project, commit) |
15 | click_link "Comments" # notes tab | 15 | click_link "Comments" # notes tab |
16 | fill_in "note_note", :with => "I commented this commit" | 16 | fill_in "note_note", :with => "I commented this commit" |
spec/requests/commits_spec.rb
@@ -3,13 +3,13 @@ require 'spec_helper' | @@ -3,13 +3,13 @@ require 'spec_helper' | ||
3 | describe "Commits" do | 3 | describe "Commits" do |
4 | let(:project) { Factory :project } | 4 | let(:project) { Factory :project } |
5 | let!(:commit) { project.repo.commits.first } | 5 | let!(:commit) { project.repo.commits.first } |
6 | - before do | 6 | + before do |
7 | login_as :user | 7 | login_as :user |
8 | project.add_access(@user, :read) | 8 | project.add_access(@user, :read) |
9 | end | 9 | end |
10 | 10 | ||
11 | describe "GET /commits" do | 11 | describe "GET /commits" do |
12 | - before do | 12 | + before do |
13 | visit project_commits_path(project) | 13 | visit project_commits_path(project) |
14 | end | 14 | end |
15 | 15 | ||
@@ -17,22 +17,22 @@ describe "Commits" do | @@ -17,22 +17,22 @@ describe "Commits" do | ||
17 | current_path.should == project_commits_path(project) | 17 | current_path.should == project_commits_path(project) |
18 | end | 18 | end |
19 | 19 | ||
20 | - it "should have project name" do | 20 | + it "should have project name" do |
21 | page.should have_content(project.name) | 21 | page.should have_content(project.name) |
22 | end | 22 | end |
23 | 23 | ||
24 | - it "should list commits" do | 24 | + it "should list commits" do |
25 | page.should have_content(commit.author) | 25 | page.should have_content(commit.author) |
26 | page.should have_content(commit.message) | 26 | page.should have_content(commit.message) |
27 | end | 27 | end |
28 | end | 28 | end |
29 | 29 | ||
30 | - describe "GET /commits/:id" do | ||
31 | - before do | 30 | + describe "GET /commits/:id" do |
31 | + before do | ||
32 | visit project_commit_path(project, commit) | 32 | visit project_commit_path(project, commit) |
33 | end | 33 | end |
34 | 34 | ||
35 | - it "should have valid path" do | 35 | + it "should have valid path" do |
36 | current_path.should == project_commit_path(project, commit) | 36 | current_path.should == project_commit_path(project, commit) |
37 | end | 37 | end |
38 | end | 38 | end |
spec/requests/issues_notes_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper' | @@ -3,7 +3,7 @@ require 'spec_helper' | ||
3 | describe "Issues" do | 3 | describe "Issues" do |
4 | let(:project) { Factory :project } | 4 | let(:project) { Factory :project } |
5 | 5 | ||
6 | - before do | 6 | + before do |
7 | login_as :user | 7 | login_as :user |
8 | project.add_access(@user, :read, :write) | 8 | project.add_access(@user, :read, :write) |
9 | 9 | ||
@@ -13,8 +13,8 @@ describe "Issues" do | @@ -13,8 +13,8 @@ describe "Issues" do | ||
13 | :project => project | 13 | :project => project |
14 | end | 14 | end |
15 | 15 | ||
16 | - describe "add new note", :js => true do | ||
17 | - before do | 16 | + describe "add new note", :js => true do |
17 | + before do | ||
18 | visit project_issue_path(project, @issue) | 18 | visit project_issue_path(project, @issue) |
19 | fill_in "note_note", :with => "I commented this issue" | 19 | fill_in "note_note", :with => "I commented this issue" |
20 | click_button "Add note" | 20 | click_button "Add note" |
spec/requests/issues_spec.rb
@@ -3,13 +3,13 @@ require 'spec_helper' | @@ -3,13 +3,13 @@ require 'spec_helper' | ||
3 | describe "Issues" do | 3 | describe "Issues" do |
4 | let(:project) { Factory :project } | 4 | let(:project) { Factory :project } |
5 | 5 | ||
6 | - before do | 6 | + before do |
7 | login_as :user | 7 | login_as :user |
8 | project.add_access(@user, :read, :write) | 8 | project.add_access(@user, :read, :write) |
9 | end | 9 | end |
10 | 10 | ||
11 | describe "GET /issues" do | 11 | describe "GET /issues" do |
12 | - before do | 12 | + before do |
13 | @issue = Factory :issue, | 13 | @issue = Factory :issue, |
14 | :author => @user, | 14 | :author => @user, |
15 | :assignee => @user, | 15 | :assignee => @user, |
@@ -24,23 +24,23 @@ describe "Issues" do | @@ -24,23 +24,23 @@ describe "Issues" do | ||
24 | it { should have_content(@issue.project.name) } | 24 | it { should have_content(@issue.project.name) } |
25 | it { should have_content(@issue.assignee.name) } | 25 | it { should have_content(@issue.assignee.name) } |
26 | 26 | ||
27 | - describe "Destroy" do | ||
28 | - before do | 27 | + describe "Destroy" do |
28 | + before do | ||
29 | # admin access to remove issue | 29 | # admin access to remove issue |
30 | @user.users_projects.destroy_all | 30 | @user.users_projects.destroy_all |
31 | project.add_access(@user, :read, :write, :admin) | 31 | project.add_access(@user, :read, :write, :admin) |
32 | visit project_issues_path(project) | 32 | visit project_issues_path(project) |
33 | end | 33 | end |
34 | 34 | ||
35 | - it "should remove entry" do | 35 | + it "should remove entry" do |
36 | expect { | 36 | expect { |
37 | click_link "destroy_issue_#{@issue.id}" | 37 | click_link "destroy_issue_#{@issue.id}" |
38 | }.to change { Issue.count }.by(-1) | 38 | }.to change { Issue.count }.by(-1) |
39 | end | 39 | end |
40 | end | 40 | end |
41 | 41 | ||
42 | - describe "statuses", :js => true do | ||
43 | - before do | 42 | + describe "statuses", :js => true do |
43 | + before do | ||
44 | @closed_issue = Factory :issue, | 44 | @closed_issue = Factory :issue, |
45 | :author => @user, | 45 | :author => @user, |
46 | :assignee => @user, | 46 | :assignee => @user, |
@@ -48,18 +48,18 @@ describe "Issues" do | @@ -48,18 +48,18 @@ describe "Issues" do | ||
48 | :closed => true | 48 | :closed => true |
49 | end | 49 | end |
50 | 50 | ||
51 | - it "should show only open" do | 51 | + it "should show only open" do |
52 | should have_content(@issue.title) | 52 | should have_content(@issue.title) |
53 | should have_no_content(@closed_issue.title) | 53 | should have_no_content(@closed_issue.title) |
54 | end | 54 | end |
55 | 55 | ||
56 | - it "should show only closed" do | 56 | + it "should show only closed" do |
57 | choose "closed_issues" | 57 | choose "closed_issues" |
58 | should have_no_content(@issue.title) | 58 | should have_no_content(@issue.title) |
59 | should have_content(@closed_issue.title) | 59 | should have_content(@closed_issue.title) |
60 | end | 60 | end |
61 | 61 | ||
62 | - it "should show all" do | 62 | + it "should show all" do |
63 | choose "all_issues" | 63 | choose "all_issues" |
64 | should have_content(@issue.title) | 64 | should have_content(@issue.title) |
65 | should have_content(@closed_issue.title) | 65 | should have_content(@closed_issue.title) |
@@ -67,17 +67,17 @@ describe "Issues" do | @@ -67,17 +67,17 @@ describe "Issues" do | ||
67 | end | 67 | end |
68 | end | 68 | end |
69 | 69 | ||
70 | - describe "New issue", :js => true do | ||
71 | - before do | 70 | + describe "New issue", :js => true do |
71 | + before do | ||
72 | visit project_issues_path(project) | 72 | visit project_issues_path(project) |
73 | click_link "New Issue" | 73 | click_link "New Issue" |
74 | end | 74 | end |
75 | 75 | ||
76 | - it "should open new issue popup" do | 76 | + it "should open new issue popup" do |
77 | page.should have_content("Add new issue") | 77 | page.should have_content("Add new issue") |
78 | end | 78 | end |
79 | 79 | ||
80 | - describe "fill in" do | 80 | + describe "fill in" do |
81 | before do | 81 | before do |
82 | fill_in "issue_title", :with => "bug 345" | 82 | fill_in "issue_title", :with => "bug 345" |
83 | fill_in "issue_content", :with => "app bug 345" | 83 | fill_in "issue_content", :with => "app bug 345" |
@@ -87,7 +87,7 @@ describe "Issues" do | @@ -87,7 +87,7 @@ describe "Issues" do | ||
87 | 87 | ||
88 | it { expect { click_button "Save" }.to change {Issue.count}.by(1) } | 88 | it { expect { click_button "Save" }.to change {Issue.count}.by(1) } |
89 | 89 | ||
90 | - it "should add new issue to table" do | 90 | + it "should add new issue to table" do |
91 | click_button "Save" | 91 | click_button "Save" |
92 | 92 | ||
93 | page.should_not have_content("Add new issue") | 93 | page.should_not have_content("Add new issue") |
@@ -96,12 +96,12 @@ describe "Issues" do | @@ -96,12 +96,12 @@ describe "Issues" do | ||
96 | page.should have_content project.name | 96 | page.should have_content project.name |
97 | end | 97 | end |
98 | 98 | ||
99 | - it "should call send mail" do | 99 | + it "should call send mail" do |
100 | Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) | 100 | Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) |
101 | click_button "Save" | 101 | click_button "Save" |
102 | end | 102 | end |
103 | 103 | ||
104 | - it "should send valid email to user with email & password" do | 104 | + it "should send valid email to user with email & password" do |
105 | click_button "Save" | 105 | click_button "Save" |
106 | issue = Issue.last | 106 | issue = Issue.last |
107 | email = ActionMailer::Base.deliveries.last | 107 | email = ActionMailer::Base.deliveries.last |
@@ -112,8 +112,8 @@ describe "Issues" do | @@ -112,8 +112,8 @@ describe "Issues" do | ||
112 | end | 112 | end |
113 | end | 113 | end |
114 | 114 | ||
115 | - describe "Edit issue", :js => true do | ||
116 | - before do | 115 | + describe "Edit issue", :js => true do |
116 | + before do | ||
117 | @issue = Factory :issue, | 117 | @issue = Factory :issue, |
118 | :author => @user, | 118 | :author => @user, |
119 | :assignee => @user, | 119 | :assignee => @user, |
@@ -122,11 +122,11 @@ describe "Issues" do | @@ -122,11 +122,11 @@ describe "Issues" do | ||
122 | click_link "Edit" | 122 | click_link "Edit" |
123 | end | 123 | end |
124 | 124 | ||
125 | - it "should open new issue popup" do | 125 | + it "should open new issue popup" do |
126 | page.should have_content("Issue ##{@issue.id}") | 126 | page.should have_content("Issue ##{@issue.id}") |
127 | end | 127 | end |
128 | 128 | ||
129 | - describe "fill in" do | 129 | + describe "fill in" do |
130 | before do | 130 | before do |
131 | fill_in "issue_title", :with => "bug 345" | 131 | fill_in "issue_title", :with => "bug 345" |
132 | fill_in "issue_content", :with => "app bug 345" | 132 | fill_in "issue_content", :with => "app bug 345" |
@@ -134,7 +134,7 @@ describe "Issues" do | @@ -134,7 +134,7 @@ describe "Issues" do | ||
134 | 134 | ||
135 | it { expect { click_button "Save" }.to_not change {Issue.count} } | 135 | it { expect { click_button "Save" }.to_not change {Issue.count} } |
136 | 136 | ||
137 | - it "should update issue fields" do | 137 | + it "should update issue fields" do |
138 | click_button "Save" | 138 | click_button "Save" |
139 | 139 | ||
140 | page.should_not have_content("Issue ##{@issue.id}") | 140 | page.should_not have_content("Issue ##{@issue.id}") |
spec/requests/keys_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe "Issues" do | 3 | describe "Issues" do |
4 | - before do | 4 | + before do |
5 | login_as :user | 5 | login_as :user |
6 | end | 6 | end |
7 | 7 | ||
8 | describe "GET /keys" do | 8 | describe "GET /keys" do |
9 | - before do | 9 | + before do |
10 | @key = Factory :key, :user => @user | 10 | @key = Factory :key, :user => @user |
11 | visit keys_path | 11 | visit keys_path |
12 | end | 12 | end |
@@ -15,8 +15,8 @@ describe "Issues" do | @@ -15,8 +15,8 @@ describe "Issues" do | ||
15 | 15 | ||
16 | it { should have_content(@key.title) } | 16 | it { should have_content(@key.title) } |
17 | 17 | ||
18 | - describe "Destroy" do | ||
19 | - it "should remove entry" do | 18 | + describe "Destroy" do |
19 | + it "should remove entry" do | ||
20 | expect { | 20 | expect { |
21 | click_link "destroy_key_#{@key.id}" | 21 | click_link "destroy_key_#{@key.id}" |
22 | }.to change { @user.keys.count }.by(-1) | 22 | }.to change { @user.keys.count }.by(-1) |
@@ -24,17 +24,17 @@ describe "Issues" do | @@ -24,17 +24,17 @@ describe "Issues" do | ||
24 | end | 24 | end |
25 | end | 25 | end |
26 | 26 | ||
27 | - describe "New key", :js => true do | ||
28 | - before do | 27 | + describe "New key", :js => true do |
28 | + before do | ||
29 | visit keys_path | 29 | visit keys_path |
30 | click_link "Add new" | 30 | click_link "Add new" |
31 | end | 31 | end |
32 | 32 | ||
33 | - it "should open new key popup" do | 33 | + it "should open new key popup" do |
34 | page.should have_content("Add new public key") | 34 | page.should have_content("Add new public key") |
35 | end | 35 | end |
36 | 36 | ||
37 | - describe "fill in" do | 37 | + describe "fill in" do |
38 | before do | 38 | before do |
39 | fill_in "key_title", :with => "laptop" | 39 | fill_in "key_title", :with => "laptop" |
40 | fill_in "key_key", :with => "publickey234=" | 40 | fill_in "key_key", :with => "publickey234=" |
@@ -42,7 +42,7 @@ describe "Issues" do | @@ -42,7 +42,7 @@ describe "Issues" do | ||
42 | 42 | ||
43 | it { expect { click_button "Save" }.to change {Key.count}.by(1) } | 43 | it { expect { click_button "Save" }.to change {Key.count}.by(1) } |
44 | 44 | ||
45 | - it "should add new key to table" do | 45 | + it "should add new key to table" do |
46 | click_button "Save" | 46 | click_button "Save" |
47 | 47 | ||
48 | page.should_not have_content("Add new public key") | 48 | page.should_not have_content("Add new public key") |
spec/requests/profile_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe "Profile" do | 3 | describe "Profile" do |
4 | - before do | 4 | + before do |
5 | login_as :user | 5 | login_as :user |
6 | end | 6 | end |
7 | 7 | ||
8 | describe "Show profile" do | 8 | describe "Show profile" do |
9 | - before do | 9 | + before do |
10 | visit profile_path | 10 | visit profile_path |
11 | end | 11 | end |
12 | 12 | ||
@@ -15,13 +15,13 @@ describe "Profile" do | @@ -15,13 +15,13 @@ describe "Profile" do | ||
15 | end | 15 | end |
16 | 16 | ||
17 | describe "Profile update" do | 17 | describe "Profile update" do |
18 | - before do | 18 | + before do |
19 | visit profile_path | 19 | visit profile_path |
20 | fill_in "user_skype", :with => "testskype" | 20 | fill_in "user_skype", :with => "testskype" |
21 | - fill_in "user_linkedin", :with => "testlinkedin" | 21 | + fill_in "user_linkedin", :with => "testlinkedin" |
22 | fill_in "user_twitter", :with => "testtwitter" | 22 | fill_in "user_twitter", :with => "testtwitter" |
23 | click_button "Save" | 23 | click_button "Save" |
24 | - @user.reload | 24 | + @user.reload |
25 | end | 25 | end |
26 | 26 | ||
27 | it { @user.skype.should == 'testskype' } | 27 | it { @user.skype.should == 'testskype' } |
@@ -29,18 +29,17 @@ describe "Profile" do | @@ -29,18 +29,17 @@ describe "Profile" do | ||
29 | it { @user.twitter.should == 'testtwitter' } | 29 | it { @user.twitter.should == 'testtwitter' } |
30 | end | 30 | end |
31 | 31 | ||
32 | - | ||
33 | describe "Password update" do | 32 | describe "Password update" do |
34 | - before do | 33 | + before do |
35 | visit profile_password_path | 34 | visit profile_password_path |
36 | end | 35 | end |
37 | 36 | ||
38 | it { page.should have_content("Password") } | 37 | it { page.should have_content("Password") } |
39 | it { page.should have_content("Password confirmation") } | 38 | it { page.should have_content("Password confirmation") } |
40 | 39 | ||
41 | - describe "change password" do | ||
42 | - before do | ||
43 | - @old_pwd = @user.encrypted_password | 40 | + describe "change password" do |
41 | + before do | ||
42 | + @old_pwd = @user.encrypted_password | ||
44 | fill_in "user_password", :with => "777777" | 43 | fill_in "user_password", :with => "777777" |
45 | fill_in "user_password_confirmation", :with => "777777" | 44 | fill_in "user_password_confirmation", :with => "777777" |
46 | click_button "Save" | 45 | click_button "Save" |
@@ -51,18 +50,18 @@ describe "Profile" do | @@ -51,18 +50,18 @@ describe "Profile" do | ||
51 | current_path.should == new_user_session_path | 50 | current_path.should == new_user_session_path |
52 | end | 51 | end |
53 | 52 | ||
54 | - it "should change password" do | 53 | + it "should change password" do |
55 | @user.encrypted_password.should_not == @old_pwd | 54 | @user.encrypted_password.should_not == @old_pwd |
56 | end | 55 | end |
57 | 56 | ||
58 | - describe "login with new password" do | 57 | + describe "login with new password" do |
59 | before do | 58 | before do |
60 | fill_in "user_email", :with => @user.email | 59 | fill_in "user_email", :with => @user.email |
61 | fill_in "user_password", :with => "777777" | 60 | fill_in "user_password", :with => "777777" |
62 | click_button "Sign in" | 61 | click_button "Sign in" |
63 | end | 62 | end |
64 | - | ||
65 | - it "should login user" do | 63 | + |
64 | + it "should login user" do | ||
66 | current_path.should == root_path | 65 | current_path.should == root_path |
67 | end | 66 | end |
68 | end | 67 | end |
spec/requests/projects_security_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | describe "Projects" do | 3 | describe "Projects" do |
4 | - describe "GET /projects" do | 4 | + describe "GET /projects" do |
5 | it { projects_path.should be_allowed_for :admin } | 5 | it { projects_path.should be_allowed_for :admin } |
6 | it { projects_path.should be_allowed_for :user } | 6 | it { projects_path.should be_allowed_for :user } |
7 | it { projects_path.should be_denied_for :visitor } | 7 | it { projects_path.should be_denied_for :visitor } |
8 | end | 8 | end |
9 | 9 | ||
10 | - describe "GET /projects/new" do | 10 | + describe "GET /projects/new" do |
11 | it { projects_path.should be_allowed_for :admin } | 11 | it { projects_path.should be_allowed_for :admin } |
12 | it { projects_path.should be_allowed_for :user } | 12 | it { projects_path.should be_allowed_for :user } |
13 | it { projects_path.should be_denied_for :visitor } | 13 | it { projects_path.should be_denied_for :visitor } |
14 | end | 14 | end |
15 | 15 | ||
16 | describe "Project" do | 16 | describe "Project" do |
17 | - before do | 17 | + before do |
18 | @project = Factory :project | 18 | @project = Factory :project |
19 | @u1 = Factory :user | 19 | @u1 = Factory :user |
20 | @u2 = Factory :user | 20 | @u2 = Factory :user |
21 | @u3 = Factory :user | 21 | @u3 = Factory :user |
22 | # full access | 22 | # full access |
23 | - @project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true) | 23 | + @project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true) |
24 | # no access | 24 | # no access |
25 | - @project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false) | 25 | + @project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false) |
26 | # readonly | 26 | # readonly |
27 | - @project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false) | 27 | + @project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false) |
28 | end | 28 | end |
29 | 29 | ||
30 | - describe "GET /project_code" do | 30 | + describe "GET /project_code" do |
31 | it { project_path(@project).should be_allowed_for @u1 } | 31 | it { project_path(@project).should be_allowed_for @u1 } |
32 | it { project_path(@project).should be_allowed_for @u3 } | 32 | it { project_path(@project).should be_allowed_for @u3 } |
33 | it { project_path(@project).should be_denied_for :admin } | 33 | it { project_path(@project).should be_denied_for :admin } |
@@ -36,7 +36,7 @@ describe "Projects" do | @@ -36,7 +36,7 @@ describe "Projects" do | ||
36 | it { project_path(@project).should be_denied_for :visitor } | 36 | it { project_path(@project).should be_denied_for :visitor } |
37 | end | 37 | end |
38 | 38 | ||
39 | - describe "GET /project_code/tree" do | 39 | + describe "GET /project_code/tree" do |
40 | it { tree_project_path(@project).should be_allowed_for @u1 } | 40 | it { tree_project_path(@project).should be_allowed_for @u1 } |
41 | it { tree_project_path(@project).should be_allowed_for @u3 } | 41 | it { tree_project_path(@project).should be_allowed_for @u3 } |
42 | it { tree_project_path(@project).should be_denied_for :admin } | 42 | it { tree_project_path(@project).should be_denied_for :admin } |
@@ -45,7 +45,7 @@ describe "Projects" do | @@ -45,7 +45,7 @@ describe "Projects" do | ||
45 | it { tree_project_path(@project).should be_denied_for :visitor } | 45 | it { tree_project_path(@project).should be_denied_for :visitor } |
46 | end | 46 | end |
47 | 47 | ||
48 | - describe "GET /project_code/commits" do | 48 | + describe "GET /project_code/commits" do |
49 | it { project_commits_path(@project).should be_allowed_for @u1 } | 49 | it { project_commits_path(@project).should be_allowed_for @u1 } |
50 | it { project_commits_path(@project).should be_allowed_for @u3 } | 50 | it { project_commits_path(@project).should be_allowed_for @u3 } |
51 | it { project_commits_path(@project).should be_denied_for :admin } | 51 | it { project_commits_path(@project).should be_denied_for :admin } |
@@ -54,7 +54,7 @@ describe "Projects" do | @@ -54,7 +54,7 @@ describe "Projects" do | ||
54 | it { project_commits_path(@project).should be_denied_for :visitor } | 54 | it { project_commits_path(@project).should be_denied_for :visitor } |
55 | end | 55 | end |
56 | 56 | ||
57 | - describe "GET /project_code/commit" do | 57 | + describe "GET /project_code/commit" do |
58 | it { project_commit_path(@project, @project.commit).should be_allowed_for @u1 } | 58 | it { project_commit_path(@project, @project.commit).should be_allowed_for @u1 } |
59 | it { project_commit_path(@project, @project.commit).should be_allowed_for @u3 } | 59 | it { project_commit_path(@project, @project.commit).should be_allowed_for @u3 } |
60 | it { project_commit_path(@project, @project.commit).should be_denied_for :admin } | 60 | it { project_commit_path(@project, @project.commit).should be_denied_for :admin } |
@@ -63,7 +63,7 @@ describe "Projects" do | @@ -63,7 +63,7 @@ describe "Projects" do | ||
63 | it { project_commit_path(@project, @project.commit).should be_denied_for :visitor } | 63 | it { project_commit_path(@project, @project.commit).should be_denied_for :visitor } |
64 | end | 64 | end |
65 | 65 | ||
66 | - describe "GET /project_code/team" do | 66 | + describe "GET /project_code/team" do |
67 | it { team_project_path(@project).should be_allowed_for @u1 } | 67 | it { team_project_path(@project).should be_allowed_for @u1 } |
68 | it { team_project_path(@project).should be_allowed_for @u3 } | 68 | it { team_project_path(@project).should be_allowed_for @u3 } |
69 | it { team_project_path(@project).should be_denied_for :admin } | 69 | it { team_project_path(@project).should be_denied_for :admin } |
@@ -72,7 +72,7 @@ describe "Projects" do | @@ -72,7 +72,7 @@ describe "Projects" do | ||
72 | it { team_project_path(@project).should be_denied_for :visitor } | 72 | it { team_project_path(@project).should be_denied_for :visitor } |
73 | end | 73 | end |
74 | 74 | ||
75 | - describe "GET /project_code/wall" do | 75 | + describe "GET /project_code/wall" do |
76 | it { wall_project_path(@project).should be_allowed_for @u1 } | 76 | it { wall_project_path(@project).should be_allowed_for @u1 } |
77 | it { wall_project_path(@project).should be_allowed_for @u3 } | 77 | it { wall_project_path(@project).should be_allowed_for @u3 } |
78 | it { wall_project_path(@project).should be_denied_for :admin } | 78 | it { wall_project_path(@project).should be_denied_for :admin } |
@@ -81,8 +81,8 @@ describe "Projects" do | @@ -81,8 +81,8 @@ describe "Projects" do | ||
81 | it { wall_project_path(@project).should be_denied_for :visitor } | 81 | it { wall_project_path(@project).should be_denied_for :visitor } |
82 | end | 82 | end |
83 | 83 | ||
84 | - describe "GET /project_code/blob" do | ||
85 | - before do | 84 | + describe "GET /project_code/blob" do |
85 | + before do | ||
86 | @commit = @project.commit | 86 | @commit = @project.commit |
87 | @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name | 87 | @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name |
88 | @blob_path = blob_project_path(@project, :commit_id => @commit.id, :path => @path) | 88 | @blob_path = blob_project_path(@project, :commit_id => @commit.id, :path => @path) |
@@ -96,7 +96,7 @@ describe "Projects" do | @@ -96,7 +96,7 @@ describe "Projects" do | ||
96 | it { @blob_path.should be_denied_for :visitor } | 96 | it { @blob_path.should be_denied_for :visitor } |
97 | end | 97 | end |
98 | 98 | ||
99 | - describe "GET /project_code/edit" do | 99 | + describe "GET /project_code/edit" do |
100 | it { edit_project_path(@project).should be_allowed_for @u1 } | 100 | it { edit_project_path(@project).should be_allowed_for @u1 } |
101 | it { edit_project_path(@project).should be_denied_for @u3 } | 101 | it { edit_project_path(@project).should be_denied_for @u3 } |
102 | it { edit_project_path(@project).should be_denied_for :admin } | 102 | it { edit_project_path(@project).should be_denied_for :admin } |
@@ -105,7 +105,7 @@ describe "Projects" do | @@ -105,7 +105,7 @@ describe "Projects" do | ||
105 | it { edit_project_path(@project).should be_denied_for :visitor } | 105 | it { edit_project_path(@project).should be_denied_for :visitor } |
106 | end | 106 | end |
107 | 107 | ||
108 | - describe "GET /project_code/issues" do | 108 | + describe "GET /project_code/issues" do |
109 | it { project_issues_path(@project).should be_allowed_for @u1 } | 109 | it { project_issues_path(@project).should be_allowed_for @u1 } |
110 | it { project_issues_path(@project).should be_allowed_for @u3 } | 110 | it { project_issues_path(@project).should be_allowed_for @u3 } |
111 | it { project_issues_path(@project).should be_denied_for :admin } | 111 | it { project_issues_path(@project).should be_denied_for :admin } |
@@ -114,7 +114,7 @@ describe "Projects" do | @@ -114,7 +114,7 @@ describe "Projects" do | ||
114 | it { project_issues_path(@project).should be_denied_for :visitor } | 114 | it { project_issues_path(@project).should be_denied_for :visitor } |
115 | end | 115 | end |
116 | 116 | ||
117 | - describe "GET /project_code/snippets" do | 117 | + describe "GET /project_code/snippets" do |
118 | it { project_snippets_path(@project).should be_allowed_for @u1 } | 118 | it { project_snippets_path(@project).should be_allowed_for @u1 } |
119 | it { project_snippets_path(@project).should be_allowed_for @u3 } | 119 | it { project_snippets_path(@project).should be_allowed_for @u3 } |
120 | it { project_snippets_path(@project).should be_denied_for :admin } | 120 | it { project_snippets_path(@project).should be_denied_for :admin } |