Commit d62200ca authored by Nihad Abbasov's avatar Nihad Abbasov

clean-up code

  * Remove trailing whitespace
  * Converts hard-tabs into two-space soft-tabs
  * Remove consecutive blank lines
parent f6a67fba
...@@ -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
* http://docs.jquery.com/UI/Mouse * http://docs.jquery.com/UI/Mouse
* *
* Depends: * Depends:
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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("."+ (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("."+
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= 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
* http://docs.jquery.com/UI/Draggables * http://docs.jquery.com/UI/Draggables
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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== (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==
"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= "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.
* http://docs.jquery.com/UI/Droppables * http://docs.jquery.com/UI/Droppables
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.widget.js * jquery.ui.widget.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.draggable.js * jquery.ui.draggable.js
*/ */
(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); (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);
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&& 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);
* http://docs.jquery.com/UI/Resizables * http://docs.jquery.com/UI/Resizables
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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, (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,
_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(), _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
* http://docs.jquery.com/UI/Selectables * http://docs.jquery.com/UI/Selectables
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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"), (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"),
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, 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("
* http://docs.jquery.com/UI/Sortables * http://docs.jquery.com/UI/Sortables
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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"); (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");
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=== 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
* http://docs.jquery.com/UI/Accordion * http://docs.jquery.com/UI/Accordion
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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"); (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");
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"); 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",
* http://docs.jquery.com/UI/Autocomplete * http://docs.jquery.com/UI/Autocomplete
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.widget.js * jquery.ui.widget.js
* jquery.ui.position.js * jquery.ui.position.js
*/ */
(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= (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=
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!= 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
* http://docs.jquery.com/UI/Button * http://docs.jquery.com/UI/Button
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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!== (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!==
"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"); "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);
* http://docs.jquery.com/UI/Dialog * http://docs.jquery.com/UI/Dialog
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.widget.js * jquery.ui.widget.js
* jquery.ui.button.js * jquery.ui.button.js
* jquery.ui.draggable.js * jquery.ui.draggable.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.position.js * jquery.ui.position.js
* jquery.ui.resizable.js * jquery.ui.resizable.js
*/ */
(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, (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,
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||"&#160;",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 "+ 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||"&#160;",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
* http://docs.jquery.com/UI/Slider * http://docs.jquery.com/UI/Slider
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.mouse.js * jquery.ui.mouse.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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-"+ (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-"+
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>"); 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":
* http://docs.jquery.com/UI/Tabs * http://docs.jquery.com/UI/Tabs
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
* jquery.ui.widget.js * jquery.ui.widget.js
*/ */
(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&#8230;</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&& (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&#8230;</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&&
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= 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"
* http://docs.jquery.com/UI/Datepicker * http://docs.jquery.com/UI/Datepicker
* *
* Depends: * Depends:
* jquery.ui.core.js * jquery.ui.core.js
*/ */
(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= (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=
"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", "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);
* http://docs.jquery.com/UI/Effects/Blind * http://docs.jquery.com/UI/Effects/Blind
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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, (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,
g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery); 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
* http://docs.jquery.com/UI/Effects/Bounce * http://docs.jquery.com/UI/Effects/Bounce
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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})/ (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})/
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); 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"?"-=
* http://docs.jquery.com/UI/Effects/Clip * http://docs.jquery.com/UI/Effects/Clip
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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, (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,
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); 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,
* http://docs.jquery.com/UI/Effects/Drop * http://docs.jquery.com/UI/Effects/Drop
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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== (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==
"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); "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,
* http://docs.jquery.com/UI/Effects/Explode * http://docs.jquery.com/UI/Effects/Explode
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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= (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=
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+ 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
* http://docs.jquery.com/UI/Effects/Fade * http://docs.jquery.com/UI/Effects/Fade
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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); (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);
;/* ;/*
...@@ -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
* http://docs.jquery.com/UI/Effects/Fold * http://docs.jquery.com/UI/Effects/Fold
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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], (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],
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); 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
* http://docs.jquery.com/UI/Effects/Highlight * http://docs.jquery.com/UI/Effects/Highlight
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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&& (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&&
this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); 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
* http://docs.jquery.com/UI/Effects/Pulsate * http://docs.jquery.com/UI/Effects/Pulsate
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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, (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,
a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery); 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(
* http://docs.jquery.com/UI/Effects/Scale * http://docs.jquery.com/UI/Effects/Scale
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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, (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,
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= 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
* http://docs.jquery.com/UI/Effects/Shake * http://docs.jquery.com/UI/Effects/Shake
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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]= (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]=
(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); (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
* http://docs.jquery.com/UI/Effects/Slide * http://docs.jquery.com/UI/Effects/Slide
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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); (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);
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); 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
* http://docs.jquery.com/UI/Effects/Transfer * http://docs.jquery.com/UI/Effects/Transfer
* *
* Depends: * Depends:
* jquery.effects.core.js * jquery.effects.core.js
*/ */
(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); (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);
b.dequeue()})})}})(jQuery); b.dequeue()})})}})(jQuery);
; ;
\ No newline at end of file
...@@ -12,834 +12,833 @@ ...@@ -12,834 +12,833 @@
(function($) { (function($) {
$.widget("ui.selectmenu", { $.widget("ui.selectmenu", {
getter: "value", getter: "value",
version: "1.8", version: "1.8",
eventPrefix: "selectmenu", eventPrefix: "selectmenu",
options: { options: {
transferClasses: true, transferClasses: true,
typeAhead: "sequential", typeAhead: "sequential",
style: 'dropdown', style: 'dropdown',
positionOptions: { positionOptions: {
my: "left top", my: "left top",
at: "left bottom", at: "left bottom",
offset: null offset: null
}, },
width: null, width: null,
menuWidth: null, menuWidth: null,
handleWidth: 26, handleWidth: 26,
maxHeight: null, maxHeight: null,
icons: null, icons: null,
format: null, format: null,
bgImage: function() {}, bgImage: function() {},
wrapperElement: "<div />" wrapperElement: "<div />"
}, },
_create: function() { _create: function() {
var self = this, o = this.options; var self = this, o = this.options;
// set a default id value, generate a new random one if not set by developer // set a default id value, generate a new random one if not set by developer
var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ); var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );
// quick array of button and menu id's // quick array of button and menu id's
this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ]; this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ];
// define safe mouseup for future toggling // define safe mouseup for future toggling
this._safemouseup = true; this._safemouseup = true;
// create menu button wrapper // create menu button wrapper
this.newelement = $( '<a />', { this.newelement = $( '<a />', {
'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all', 'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all',
'id' : this.ids[ 0 ], 'id' : this.ids[ 0 ],
'role': 'button', 'role': 'button',
'href': '#nogo', 'href': '#nogo',
'tabindex': this.element.attr( 'disabled' ) ? 1 : 0, 'tabindex': this.element.attr( 'disabled' ) ? 1 : 0,
'aria-haspopup': true, 'aria-haspopup': true,
'aria-owns': this.ids[ 1 ] 'aria-owns': this.ids[ 1 ]
}); });
this.newelementWrap = $( o.wrapperElement ) this.newelementWrap = $( o.wrapperElement )
.append( this.newelement ) .append( this.newelement )
.insertAfter( this.element ); .insertAfter( this.element );
// transfer tabindex // transfer tabindex
var tabindex = this.element.attr( 'tabindex' ); var tabindex = this.element.attr( 'tabindex' );
if ( tabindex ) { if ( tabindex ) {
this.newelement.attr( 'tabindex', tabindex ); this.newelement.attr( 'tabindex', tabindex );
} }
// save reference to select in data for ease in calling methods // save reference to select in data for ease in calling methods
this.newelement.data( 'selectelement', this.element ); this.newelement.data( 'selectelement', this.element );
// menu icon // menu icon
this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' ) this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' )
.prependTo( this.newelement ); .prependTo( this.newelement );
// append status span to button // append status span to button
this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' ); this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' );
// make associated form label trigger focus // make associated form label trigger focus
$( 'label[for="' + selectmenuId + '"]' ) $( 'label[for="' + selectmenuId + '"]' )
.attr( 'for', this.ids[0] ) .attr( 'for', this.ids[0] )
.bind( 'click.selectmenu', function() { .bind( 'click.selectmenu', function() {
self.newelement[0].focus(); self.newelement[0].focus();
return false; return false;
}); });
// click toggle for menu visibility // click toggle for menu visibility
this.newelement this.newelement
.bind('mousedown.selectmenu', function(event) { .bind('mousedown.selectmenu', function(event) {
self._toggle(event, true); self._toggle(event, true);
// make sure a click won't open/close instantly // make sure a click won't open/close instantly
if (o.style == "popup") { if (o.style == "popup") {
self._safemouseup = false; self._safemouseup = false;
setTimeout(function() { self._safemouseup = true; }, 300); setTimeout(function() { self._safemouseup = true; }, 300);
} }
return false; return false;
}) })
.bind('click.selectmenu', function() { .bind('click.selectmenu', function() {
return false; return false;
}) })
.bind("keydown.selectmenu", function(event) { .bind("keydown.selectmenu", function(event) {
var ret = false; var ret = false;
switch (event.keyCode) { switch (event.keyCode) {
case $.ui.keyCode.ENTER: case $.ui.keyCode.ENTER:
ret = true; ret = true;
break; break;
case $.ui.keyCode.SPACE: case $.ui.keyCode.SPACE:
self._toggle(event); self._toggle(event);
break; break;
case $.ui.keyCode.UP: case $.ui.keyCode.UP:
if (event.altKey) { if (event.altKey) {
self.open(event); self.open(event);
} else { } else {
self._moveSelection(-1); self._moveSelection(-1);
} }
break; break;
case $.ui.keyCode.DOWN: case $.ui.keyCode.DOWN:
if (event.altKey) { if (event.altKey) {
self.open(event); self.open(event);
} else { } else {
self._moveSelection(1); self._moveSelection(1);
} }
break; break;
case $.ui.keyCode.LEFT: case $.ui.keyCode.LEFT:
self._moveSelection(-1); self._moveSelection(-1);
break; break;
case $.ui.keyCode.RIGHT: case $.ui.keyCode.RIGHT:
self._moveSelection(1); self._moveSelection(1);
break; break;
case $.ui.keyCode.TAB: case $.ui.keyCode.TAB:
ret = true; ret = true;
break; break;
default: default:
ret = true; ret = true;
} }
return ret; return ret;
}) })
.bind('keypress.selectmenu', function(event) { .bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'mouseup'); self._typeAhead(event.which, 'mouseup');
return true; return true;
}) })
.bind('mouseover.selectmenu focus.selectmenu', function() { .bind('mouseover.selectmenu focus.selectmenu', function() {
if (!o.disabled) { if (!o.disabled) {
$(this).addClass(self.widgetBaseClass + '-focus ui-state-hover'); $(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
} }
}) })
.bind('mouseout.selectmenu blur.selectmenu', function() { .bind('mouseout.selectmenu blur.selectmenu', function() {
if (!o.disabled) { if (!o.disabled) {
$(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover'); $(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover');
} }
}); });
// document click closes menu // document click closes menu
$(document).bind("mousedown.selectmenu", function(event) { $(document).bind("mousedown.selectmenu", function(event) {
self.close(event); self.close(event);
}); });
// change event on original selectmenu // change event on original selectmenu
this.element this.element
.bind("click.selectmenu", function() { .bind("click.selectmenu", function() {
self._refreshValue(); self._refreshValue();
}) })
// FIXME: newelement can be null under unclear circumstances in IE8 // FIXME: newelement can be null under unclear circumstances in IE8
// TODO not sure if this is still a problem (fnagel 20.03.11) // TODO not sure if this is still a problem (fnagel 20.03.11)
.bind("focus.selectmenu", function() { .bind("focus.selectmenu", function() {
if (self.newelement) { if (self.newelement) {
self.newelement[0].focus(); self.newelement[0].focus();
} }
}); });
// set width when not set via options // set width when not set via options
if (!o.width) { if (!o.width) {
o.width = this.element.outerWidth(); o.width = this.element.outerWidth();
} }
// set menu button width // set menu button width
this.newelement.width(o.width); this.newelement.width(o.width);
// hide original selectmenu element // hide original selectmenu element
this.element.hide(); this.element.hide();
// create menu portion, append to body // create menu portion, append to body
this.list = $( '<ul />', { this.list = $( '<ul />', {
'class': 'ui-widget ui-widget-content', 'class': 'ui-widget ui-widget-content',
'aria-hidden': true, 'aria-hidden': true,
'role': 'listbox', 'role': 'listbox',
'aria-labelledby': this.ids[0], 'aria-labelledby': this.ids[0],
'id': this.ids[1] 'id': this.ids[1]
}); });
this.listWrap = $( o.wrapperElement ) this.listWrap = $( o.wrapperElement )
.addClass( self.widgetBaseClass + '-menu' ) .addClass( self.widgetBaseClass + '-menu' )
.append( this.list ) .append( this.list )
.appendTo( 'body' ); .appendTo( 'body' );
// transfer menu click to menu button // transfer menu click to menu button
this.list this.list
.bind("keydown.selectmenu", function(event) { .bind("keydown.selectmenu", function(event) {
var ret = false; var ret = false;
switch (event.keyCode) { switch (event.keyCode) {
case $.ui.keyCode.UP: case $.ui.keyCode.UP:
if (event.altKey) { if (event.altKey) {
self.close(event, true); self.close(event, true);
} else { } else {
self._moveFocus(-1); self._moveFocus(-1);
} }
break; break;
case $.ui.keyCode.DOWN: case $.ui.keyCode.DOWN:
if (event.altKey) { if (event.altKey) {
self.close(event, true); self.close(event, true);
} else { } else {
self._moveFocus(1); self._moveFocus(1);
} }
break; break;
case $.ui.keyCode.LEFT: case $.ui.keyCode.LEFT:
self._moveFocus(-1); self._moveFocus(-1);
break; break;
case $.ui.keyCode.RIGHT: case $.ui.keyCode.RIGHT:
self._moveFocus(1); self._moveFocus(1);
break; break;
case $.ui.keyCode.HOME: case $.ui.keyCode.HOME:
self._moveFocus(':first'); self._moveFocus(':first');
break; break;
case $.ui.keyCode.PAGE_UP: case $.ui.keyCode.PAGE_UP:
self._scrollPage('up'); self._scrollPage('up');
break; break;
case $.ui.keyCode.PAGE_DOWN: case $.ui.keyCode.PAGE_DOWN:
self._scrollPage('down'); self._scrollPage('down');
break; break;
case $.ui.keyCode.END: case $.ui.keyCode.END:
self._moveFocus(':last'); self._moveFocus(':last');
break; break;
case $.ui.keyCode.ENTER: case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE: case $.ui.keyCode.SPACE:
self.close(event, true); self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup'); $(event.target).parents('li:eq(0)').trigger('mouseup');
break; break;
case $.ui.keyCode.TAB: case $.ui.keyCode.TAB:
ret = true; ret = true;
self.close(event, true); self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup'); $(event.target).parents('li:eq(0)').trigger('mouseup');
break; break;
case $.ui.keyCode.ESCAPE: case $.ui.keyCode.ESCAPE:
self.close(event, true); self.close(event, true);
break; break;
default: default:
ret = true; ret = true;
} }
return ret; return ret;
}) })
.bind('keypress.selectmenu', function(event) { .bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'focus'); self._typeAhead(event.which, 'focus');
return true; return true;
}) })
// this allows for using the scrollbar in an overflowed list // this allows for using the scrollbar in an overflowed list
.bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; }); .bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; });
// needed when window is resized // needed when window is resized
// TODO seems to be useless, but causes errors (fnagel 01.08.11) // TODO seems to be useless, but causes errors (fnagel 01.08.11)
// see: https://github.com/fnagel/jquery-ui/issues/147 // see: https://github.com/fnagel/jquery-ui/issues/147
// $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) ); // $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) );
}, },
_init: function() { _init: function() {
var self = this, o = this.options; var self = this, o = this.options;
// serialize selectmenu element options // serialize selectmenu element options
var selectOptionData = []; var selectOptionData = [];
this.element this.element
.find('option') .find('option')
.each(function() { .each(function() {
var opt = $(this); var opt = $(this);
selectOptionData.push({ selectOptionData.push({
value: opt.attr('value'), value: opt.attr('value'),
text: self._formatText(opt.text()), text: self._formatText(opt.text()),
selected: opt.attr('selected'), selected: opt.attr('selected'),
disabled: opt.attr('disabled'), disabled: opt.attr('disabled'),
classes: opt.attr('class'), classes: opt.attr('class'),
typeahead: opt.attr('typeahead'), typeahead: opt.attr('typeahead'),
parentOptGroup: opt.parent('optgroup'), parentOptGroup: opt.parent('optgroup'),
bgImage: o.bgImage.call(opt) bgImage: o.bgImage.call(opt)
}); });
}); });
// active state class is only used in popup style // active state class is only used in popup style
var activeClass = (self.options.style == "popup") ? " ui-state-active" : ""; var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
// empty list so we can refresh the selectmenu via selectmenu() // empty list so we can refresh the selectmenu via selectmenu()
this.list.html(""); this.list.html("");
// write li's // write li's
if (selectOptionData.length) { if (selectOptionData.length) {
for (var i = 0; i < selectOptionData.length; i++) { for (var i = 0; i < selectOptionData.length; i++) {
var thisLiAttr = { role : 'presentation' }; var thisLiAttr = { role : 'presentation' };
if ( selectOptionData[ i ].disabled ) { if ( selectOptionData[ i ].disabled ) {
thisLiAttr[ 'class' ] = this.namespace + '-state-disabled'; thisLiAttr[ 'class' ] = this.namespace + '-state-disabled';
} }
var thisAAttr = { var thisAAttr = {
html: selectOptionData[i].text, html: selectOptionData[i].text,
href : '#nogo', href : '#nogo',
tabindex : -1, tabindex : -1,
role : 'option', role : 'option',
'aria-selected' : false 'aria-selected' : false
}; };
if ( selectOptionData[ i ].disabled ) { if ( selectOptionData[ i ].disabled ) {
thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled; thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled;
} }
if ( selectOptionData[ i ].typeahead ) { if ( selectOptionData[ i ].typeahead ) {
thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead; thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead;
} }
var thisA = $('<a/>', thisAAttr); var thisA = $('<a/>', thisAAttr);
var thisLi = $('<li/>', thisLiAttr) var thisLi = $('<li/>', thisLiAttr)
.append(thisA) .append(thisA)
.data('index', i) .data('index', i)
.addClass(selectOptionData[i].classes) .addClass(selectOptionData[i].classes)
.data('optionClasses', selectOptionData[i].classes || '') .data('optionClasses', selectOptionData[i].classes || '')
.bind("mouseup.selectmenu", function(event) { .bind("mouseup.selectmenu", function(event) {
if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) { if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) {
var changed = $(this).data('index') != self._selectedIndex(); var changed = $(this).data('index') != self._selectedIndex();
self.index($(this).data('index')); self.index($(this).data('index'));
self.select(event); self.select(event);
if (changed) { if (changed) {
self.change(event); self.change(event);
} }
self.close(event, true); self.close(event, true);
} }
return false; return false;
}) })
.bind("click.selectmenu", function() { .bind("click.selectmenu", function() {
return false; return false;
}) })
.bind('mouseover.selectmenu focus.selectmenu', function(e) { .bind('mouseover.selectmenu focus.selectmenu', function(e) {
// no hover if diabled // no hover if diabled
if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) { if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) {
self._selectedOptionLi().addClass(activeClass); self._selectedOptionLi().addClass(activeClass);
self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
$(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover'); $(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover');
} }
}) })
.bind('mouseout.selectmenu blur.selectmenu', function() { .bind('mouseout.selectmenu blur.selectmenu', function() {
if ($(this).is(self._selectedOptionLi().selector)) { if ($(this).is(self._selectedOptionLi().selector)) {
$(this).addClass(activeClass); $(this).addClass(activeClass);
} }
$(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); $(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
}); });
// optgroup or not... // optgroup or not...
if ( selectOptionData[i].parentOptGroup.length ) { if ( selectOptionData[i].parentOptGroup.length ) {
var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup ); var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup );
if (this.list.find( 'li.' + optGroupName ).length ) { if (this.list.find( 'li.' + optGroupName ).length ) {
this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi ); this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi );
} else { } else {
$(' <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> ') $(' <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> ')
.appendTo( this.list ) .appendTo( this.list )
.find( 'ul' ) .find( 'ul' )
.append( thisLi ); .append( thisLi );
} }
} else { } else {
thisLi.appendTo(this.list); thisLi.appendTo(this.list);
} }
// append icon if option is specified // append icon if option is specified
if (o.icons) { if (o.icons) {
for (var j in o.icons) { for (var j in o.icons) {
if (thisLi.is(o.icons[j].find)) { if (thisLi.is(o.icons[j].find)) {
thisLi thisLi
.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon') .data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
.addClass(self.widgetBaseClass + '-hasIcon'); .addClass(self.widgetBaseClass + '-hasIcon');
var iconClass = o.icons[j].icon || ""; var iconClass = o.icons[j].icon || "";
thisLi thisLi
.find('a:eq(0)') .find('a:eq(0)')
.prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>'); .prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>');
if (selectOptionData[i].bgImage) { if (selectOptionData[i].bgImage) {
thisLi.find('span').css('background-image', selectOptionData[i].bgImage); thisLi.find('span').css('background-image', selectOptionData[i].bgImage);
} }
} }
} }
} }
} }
} else { } else {
$('<li role="presentation"><a href="#nogo" tabindex="-1" role="option"></a></li>').appendTo(this.list); $('<li role="presentation"><a href="#nogo" tabindex="-1" role="option"></a></li>').appendTo(this.list);
} }
// we need to set and unset the CSS classes for dropdown and popup style // we need to set and unset the CSS classes for dropdown and popup style
var isDropDown = ( o.style == 'dropdown' ); var isDropDown = ( o.style == 'dropdown' );
this.newelement this.newelement
.toggleClass( self.widgetBaseClass + '-dropdown', isDropDown ) .toggleClass( self.widgetBaseClass + '-dropdown', isDropDown )
.toggleClass( self.widgetBaseClass + '-popup', !isDropDown ); .toggleClass( self.widgetBaseClass + '-popup', !isDropDown );
this.list this.list
.toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown ) .toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown )
.toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown ) .toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown )
// add corners to top and bottom menu items // add corners to top and bottom menu items
.find( 'li:first' ) .find( 'li:first' )
.toggleClass( 'ui-corner-top', !isDropDown ) .toggleClass( 'ui-corner-top', !isDropDown )
.end().find( 'li:last' ) .end().find( 'li:last' )
.addClass( 'ui-corner-bottom' ); .addClass( 'ui-corner-bottom' );
this.selectmenuIcon this.selectmenuIcon
.toggleClass( 'ui-icon-triangle-1-s', isDropDown ) .toggleClass( 'ui-icon-triangle-1-s', isDropDown )
.toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown ); .toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown );
// transfer classes to selectmenu and list // transfer classes to selectmenu and list
if ( o.transferClasses ) { if ( o.transferClasses ) {
var transferClasses = this.element.attr( 'class' ) || ''; var transferClasses = this.element.attr( 'class' ) || '';
this.newelement.add( this.list ).addClass( transferClasses ); this.newelement.add( this.list ).addClass( transferClasses );
} }
// set menu width to either menuWidth option value, width option value, or select width // set menu width to either menuWidth option value, width option value, or select width
if ( o.style == 'dropdown' ) { if ( o.style == 'dropdown' ) {
this.list.width( o.menuWidth ? o.menuWidth : o.width ); this.list.width( o.menuWidth ? o.menuWidth : o.width );
} else { } else {
this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth ); this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth );
} }
// reset height to auto // reset height to auto
this.list.css( 'height', 'auto' ); this.list.css( 'height', 'auto' );
var listH = this.listWrap.height(); var listH = this.listWrap.height();
// calculate default max height // calculate default max height
if ( o.maxHeight && o.maxHeight < listH ) { if ( o.maxHeight && o.maxHeight < listH ) {
this.list.height( o.maxHeight ); this.list.height( o.maxHeight );
} else { } else {
var winH = $( window ).height() / 3; var winH = $( window ).height() / 3;
if ( winH < listH ) this.list.height( winH ); if ( winH < listH ) this.list.height( winH );
} }
// save reference to actionable li's (not group label li's) // save reference to actionable li's (not group label li's)
this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' ); this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' );
// transfer disabled state // transfer disabled state
if ( this.element.attr( 'disabled' ) ) { if ( this.element.attr( 'disabled' ) ) {
this.disable(); this.disable();
} else { } else {
this.enable() this.enable()
} }
// update value // update value
this.index( this._selectedIndex() ); this.index( this._selectedIndex() );
// needed when selectmenu is placed at the very bottom / top of the page // needed when selectmenu is placed at the very bottom / top of the page
window.setTimeout( function() { window.setTimeout( function() {
self._refreshPosition(); self._refreshPosition();
}, 200 ); }, 200 );
}, },
destroy: function() { destroy: function() {
this.element.removeData( this.widgetName ) this.element.removeData( this.widgetName )
.removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' ) .removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
.removeAttr( 'aria-disabled' ) .removeAttr( 'aria-disabled' )
.unbind( ".selectmenu" ); .unbind( ".selectmenu" );
// TODO unneded as event binding has been disabled // TODO unneded as event binding has been disabled
// $( window ).unbind( ".selectmenu" ); // $( window ).unbind( ".selectmenu" );
$( document ).unbind( ".selectmenu" ); $( document ).unbind( ".selectmenu" );
// unbind click on label, reset its for attr // unbind click on label, reset its for attr
$( 'label[for=' + this.newelement.attr('id') + ']' ) $( 'label[for=' + this.newelement.attr('id') + ']' )
.attr( 'for', this.element.attr( 'id' ) ) .attr( 'for', this.element.attr( 'id' ) )
.unbind( '.selectmenu' ); .unbind( '.selectmenu' );
this.newelementWrap.remove(); this.newelementWrap.remove();
this.listWrap.remove(); this.listWrap.remove();
this.element.show(); this.element.show();
// call widget destroy function // call widget destroy function
$.Widget.prototype.destroy.apply(this, arguments); $.Widget.prototype.destroy.apply(this, arguments);
}, },
_typeAhead: function( code, eventType ){ _typeAhead: function( code, eventType ){
var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase(); var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
c = C.toLowerCase(); c = C.toLowerCase();
if ( self.options.typeAhead == 'sequential' ) { if ( self.options.typeAhead == 'sequential' ) {
// clear the timeout so we can use _prevChar // clear the timeout so we can use _prevChar
window.clearTimeout('ui.selectmenu-' + self.selectmenuId); window.clearTimeout('ui.selectmenu-' + self.selectmenuId);
// define our find var // define our find var
var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' ); var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' );
function focusOptSeq( elem, ind, c ){ function focusOptSeq( elem, ind, c ){
focusFound = true; focusFound = true;
$( elem ).trigger( eventType ); $( elem ).trigger( eventType );
typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c; typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c;
} }
this.list.find( 'li a' ).each( function( i ) { this.list.find( 'li a' ).each( function( i ) {
if ( !focusFound ) { if ( !focusFound ) {
// allow the typeahead attribute on the option tag for a more specific lookup // allow the typeahead attribute on the option tag for a more specific lookup
var thisText = $( this ).attr( 'typeahead' ) || $(this).text(); var thisText = $( this ).attr( 'typeahead' ) || $(this).text();
if ( thisText.indexOf( find + C ) === 0 ) { if ( thisText.indexOf( find + C ) === 0 ) {
focusOptSeq( this, i, C ); focusOptSeq( this, i, C );
} else if (thisText.indexOf(find+c) === 0 ) { } else if (thisText.indexOf(find+c) === 0 ) {
focusOptSeq( this, i, c ); focusOptSeq( this, i, c );
} }
} }
}); });
// set a 1 second timeout for sequenctial typeahead // set a 1 second timeout for sequenctial typeahead
// keep this set even if we have no matches so it doesnt typeahead somewhere else // keep this set even if we have no matches so it doesnt typeahead somewhere else
window.setTimeout( function( el ) { window.setTimeout( function( el ) {
self._prevChar = undefined; self._prevChar = undefined;
}, 1000, self ); }, 1000, self );
} else { } else {
// define self._prevChar if needed // define self._prevChar if needed
if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; } if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; }
focusFound = false; focusFound = false;
function focusOpt( elem, ind ){ function focusOpt( elem, ind ){
focusFound = true; focusFound = true;
$( elem ).trigger( eventType ); $( elem ).trigger( eventType );
self._prevChar[ 1 ] = ind; self._prevChar[ 1 ] = ind;
} }
this.list.find( 'li a' ).each(function( i ){ this.list.find( 'li a' ).each(function( i ){
if (!focusFound){ if (!focusFound){
var thisText = $(this).text(); var thisText = $(this).text();
if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) { if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) {
if (self._prevChar[0] == C){ if (self._prevChar[0] == C){
if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); } if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); }
} else{ } else{
focusOpt( this, i ); focusOpt( this, i );
} }
} }
} }
}); });
this._prevChar[ 0 ] = C; this._prevChar[ 0 ] = C;
} }
}, },
// returns some usefull information, called by callbacks only // returns some usefull information, called by callbacks only
_uiHash: function() { _uiHash: function() {
var index = this.index(); var index = this.index();
return { return {
index: index, index: index,
option: $("option", this.element).get(index), option: $("option", this.element).get(index),
value: this.element[0].value value: this.element[0].value
}; };
}, },
open: function(event) { open: function(event) {
var self = this, o = this.options; var self = this, o = this.options;
if ( self.newelement.attr("aria-disabled") != 'true' ) { if ( self.newelement.attr("aria-disabled") != 'true' ) {
self._closeOthers(event); self._closeOthers(event);
self.newelement.addClass('ui-state-active'); self.newelement.addClass('ui-state-active');
self.listWrap.appendTo( o.appendTo ); self.listWrap.appendTo( o.appendTo );
self.list.attr('aria-hidden', false); self.list.attr('aria-hidden', false);
if ( o.style == "dropdown" ) { if ( o.style == "dropdown" ) {
self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
} }
self.listWrap.addClass( self.widgetBaseClass + '-open' ); self.listWrap.addClass( self.widgetBaseClass + '-open' );
// positioning needed for IE7 (tested 01.08.11 on MS VPC Image) // positioning needed for IE7 (tested 01.08.11 on MS VPC Image)
// see https://github.com/fnagel/jquery-ui/issues/147 // see https://github.com/fnagel/jquery-ui/issues/147
if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) { if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) {
self._refreshPosition(); self._refreshPosition();
} }
var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + '):visible a'); var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + '):visible a');
if (selected.length) selected[0].focus(); if (selected.length) selected[0].focus();
// positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image) // positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image)
self._refreshPosition(); self._refreshPosition();
self._trigger("open", event, self._uiHash()); self._trigger("open", event, self._uiHash());
} }
}, },
close: function(event, retainFocus) { close: function(event, retainFocus) {
if ( this.newelement.is('.ui-state-active') ) { if ( this.newelement.is('.ui-state-active') ) {
this.newelement this.newelement
.removeClass('ui-state-active'); .removeClass('ui-state-active');
this.listWrap.removeClass(this.widgetBaseClass + '-open'); this.listWrap.removeClass(this.widgetBaseClass + '-open');
this.list.attr('aria-hidden', true); this.list.attr('aria-hidden', true);
if ( this.options.style == "dropdown" ) { if ( this.options.style == "dropdown" ) {
this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all');
} }
if ( retainFocus ) { if ( retainFocus ) {
this.newelement.focus(); this.newelement.focus();
} }
this._trigger("close", event, this._uiHash()); this._trigger("close", event, this._uiHash());
} }
}, },
change: function(event) { change: function(event) {
this.element.trigger("change"); this.element.trigger("change");
this._trigger("change", event, this._uiHash()); this._trigger("change", event, this._uiHash());
}, },
select: function(event) { select: function(event) {
if (this._disabled(event.currentTarget)) { return false; } if (this._disabled(event.currentTarget)) { return false; }
this._trigger("select", event, this._uiHash()); this._trigger("select", event, this._uiHash());
}, },
_closeOthers: function(event) { _closeOthers: function(event) {
$('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() { $('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() {
$(this).data('selectelement').selectmenu('close', event); $(this).data('selectelement').selectmenu('close', event);
}); });
$('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout'); $('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout');
}, },
_toggle: function(event, retainFocus) { _toggle: function(event, retainFocus) {
if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) { if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) {
this.close(event, retainFocus); this.close(event, retainFocus);
} else { } else {
this.open(event); this.open(event);
} }
}, },
_formatText: function(text) { _formatText: function(text) {
return (this.options.format ? this.options.format(text) : text); return (this.options.format ? this.options.format(text) : text);
}, },
_selectedIndex: function() { _selectedIndex: function() {
return this.element[0].selectedIndex; return this.element[0].selectedIndex;
}, },
_selectedOptionLi: function() { _selectedOptionLi: function() {
return this._optionLis.eq(this._selectedIndex()); return this._optionLis.eq(this._selectedIndex());
}, },
_focusedOptionLi: function() { _focusedOptionLi: function() {
return this.list.find('.' + this.widgetBaseClass + '-item-focus'); return this.list.find('.' + this.widgetBaseClass + '-item-focus');
}, },
_moveSelection: function(amt, recIndex) { _moveSelection: function(amt, recIndex) {
// do nothing if disabled // do nothing if disabled
if (!this.options.disabled) { if (!this.options.disabled) {
var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10); var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt; var newIndex = currIndex + amt;
// do not loop when using up key // do not loop when using up key
if (newIndex < 0) { if (newIndex < 0) {
newIndex = 0; newIndex = 0;
} }
if (newIndex > this._optionLis.size() - 1) { if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1; newIndex = this._optionLis.size() - 1;
} }
// Occurs when a full loop has been made // Occurs when a full loop has been made
if (newIndex === recIndex) { return false; } if (newIndex === recIndex) { return false; }
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) { if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one // if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt; (amt > 0) ? ++amt : --amt;
this._moveSelection(amt, newIndex); this._moveSelection(amt, newIndex);
} else { } else {
return this._optionLis.eq(newIndex).trigger('mouseup'); return this._optionLis.eq(newIndex).trigger('mouseup');
} }
} }
}, },
_moveFocus: function(amt, recIndex) { _moveFocus: function(amt, recIndex) {
if (!isNaN(amt)) { if (!isNaN(amt)) {
var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10); var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt; var newIndex = currIndex + amt;
} else { } else {
var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10);
} }
if (newIndex < 0) { if (newIndex < 0) {
newIndex = 0; newIndex = 0;
} }
if (newIndex > this._optionLis.size() - 1) { if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1; newIndex = this._optionLis.size() - 1;
} }
//Occurs when a full loop has been made //Occurs when a full loop has been made
if (newIndex === recIndex) { return false; } if (newIndex === recIndex) { return false; }
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
this._focusedOptionLi().find('a:eq(0)').attr('id', ''); this._focusedOptionLi().find('a:eq(0)').attr('id', '');
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) { if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one // if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt; (amt > 0) ? ++amt : --amt;
this._moveFocus(amt, newIndex); this._moveFocus(amt, newIndex);
} else { } else {
this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus(); this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus();
} }
this.list.attr('aria-activedescendant', activeID); this.list.attr('aria-activedescendant', activeID);
}, },
_scrollPage: function(direction) { _scrollPage: function(direction) {
var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight()); var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
numPerPage = (direction == 'up' ? -numPerPage : numPerPage); numPerPage = (direction == 'up' ? -numPerPage : numPerPage);
this._moveFocus(numPerPage); this._moveFocus(numPerPage);
}, },
_setOption: function(key, value) { _setOption: function(key, value) {
this.options[key] = value; this.options[key] = value;
// set // set
if (key == 'disabled') { if (key == 'disabled') {
this.close(); this.close();
this.element this.element
.add(this.newelement) .add(this.newelement)
.add(this.list)[value ? 'addClass' : 'removeClass']( .add(this.list)[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled' + ' ' + this.widgetBaseClass + '-disabled' + ' ' +
this.namespace + '-state-disabled') this.namespace + '-state-disabled')
.attr("aria-disabled", value); .attr("aria-disabled", value);
} }
}, },
disable: function(index, type){ disable: function(index, type){
// if options is not provided, call the parents disable function // if options is not provided, call the parents disable function
if ( typeof( index ) == 'undefined' ) { if ( typeof( index ) == 'undefined' ) {
this._setOption( 'disabled', true ); this._setOption( 'disabled', true );
} else { } else {
if ( type == "optgroup" ) { if ( type == "optgroup" ) {
this._disableOptgroup(index); this._disableOptgroup(index);
} else { } else {
this._disableOption(index); this._disableOption(index);
} }
} }
}, },
enable: function(index, type) { enable: function(index, type) {
// if options is not provided, call the parents enable function // if options is not provided, call the parents enable function
if ( typeof( index ) == 'undefined' ) { if ( typeof( index ) == 'undefined' ) {
this._setOption('disabled', false); this._setOption('disabled', false);
} else { } else {
if ( type == "optgroup" ) { if ( type == "optgroup" ) {
this._enableOptgroup(index); this._enableOptgroup(index);
} else { } else {
this._enableOption(index); this._enableOption(index);
} }
} }
}, },
_disabled: function(elem) { _disabled: function(elem) {
return $(elem).hasClass( this.namespace + '-state-disabled' ); return $(elem).hasClass( this.namespace + '-state-disabled' );
}, },
_disableOption: function(index) {
_disableOption: function(index) { var optionElem = this._optionLis.eq(index);
var optionElem = this._optionLis.eq(index); if (optionElem) {
if (optionElem) { optionElem.addClass(this.namespace + '-state-disabled')
optionElem.addClass(this.namespace + '-state-disabled') .find("a").attr("aria-disabled", true);
.find("a").attr("aria-disabled", true); this.element.find("option").eq(index).attr("disabled", "disabled");
this.element.find("option").eq(index).attr("disabled", "disabled"); }
} },
},
_enableOption: function(index) {
_enableOption: function(index) { var optionElem = this._optionLis.eq(index);
var optionElem = this._optionLis.eq(index); if (optionElem) {
if (optionElem) { optionElem.removeClass( this.namespace + '-state-disabled' )
optionElem.removeClass( this.namespace + '-state-disabled' ) .find("a").attr("aria-disabled", false);
.find("a").attr("aria-disabled", false); this.element.find("option").eq(index).removeAttr("disabled");
this.element.find("option").eq(index).removeAttr("disabled"); }
} },
},
_disableOptgroup: function(index) {
_disableOptgroup: function(index) { var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index ); if (optGroupElem) {
if (optGroupElem) { optGroupElem.addClass(this.namespace + '-state-disabled')
optGroupElem.addClass(this.namespace + '-state-disabled') .attr("aria-disabled", true);
.attr("aria-disabled", true); this.element.find("optgroup").eq(index).attr("disabled", "disabled");
this.element.find("optgroup").eq(index).attr("disabled", "disabled"); }
} },
},
_enableOptgroup: function(index) {
_enableOptgroup: function(index) { var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index ); if (optGroupElem) {
if (optGroupElem) { optGroupElem.removeClass(this.namespace + '-state-disabled')
optGroupElem.removeClass(this.namespace + '-state-disabled') .attr("aria-disabled", false);
.attr("aria-disabled", false); this.element.find("optgroup").eq(index).removeAttr("disabled");
this.element.find("optgroup").eq(index).removeAttr("disabled"); }
} },
},
index: function(newValue) {
index: function(newValue) { if (arguments.length) {
if (arguments.length) { if (!this._disabled($(this._optionLis[newValue]))) {
if (!this._disabled($(this._optionLis[newValue]))) { this.element[0].selectedIndex = newValue;
this.element[0].selectedIndex = newValue; this._refreshValue();
this._refreshValue(); } else {
} else { return false;
return false; }
} } else {
} else { return this._selectedIndex();
return this._selectedIndex(); }
} },
},
value: function(newValue) {
value: function(newValue) { if (arguments.length) {
if (arguments.length) { this.element[0].value = newValue;
this.element[0].value = newValue; this._refreshValue();
this._refreshValue(); } else {
} else { return this.element[0].value;
return this.element[0].value; }
} },
},
_refreshValue: function() {
_refreshValue: function() { var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
var activeClass = (this.options.style == "popup") ? " ui-state-active" : ""; var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); // deselect previous
// deselect previous this.list
this.list .find('.' + this.widgetBaseClass + '-item-selected')
.find('.' + this.widgetBaseClass + '-item-selected') .removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
.removeClass(this.widgetBaseClass + "-item-selected" + activeClass) .find('a')
.find('a') .attr('aria-selected', 'false')
.attr('aria-selected', 'false') .attr('id', '');
.attr('id', ''); // select new
// select new this._selectedOptionLi()
this._selectedOptionLi() .addClass(this.widgetBaseClass + "-item-selected" + activeClass)
.addClass(this.widgetBaseClass + "-item-selected" + activeClass) .find('a')
.find('a') .attr('aria-selected', 'true')
.attr('aria-selected', 'true') .attr('id', activeID);
.attr('id', activeID);
// toggle any class brought in from option
// toggle any class brought in from option var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "");
var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : ""); var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "");
var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : ""); this.newelement
this.newelement .removeClass(currentOptionClasses)
.removeClass(currentOptionClasses) .data('optionClasses', newOptionClasses)
.data('optionClasses', newOptionClasses) .addClass( newOptionClasses )
.addClass( newOptionClasses ) .find('.' + this.widgetBaseClass + '-status')
.find('.' + this.widgetBaseClass + '-status') .html(
.html( this._selectedOptionLi()
this._selectedOptionLi() .find('a:eq(0)')
.find('a:eq(0)') .html()
.html() );
);
this.list.attr('aria-activedescendant', activeID);
this.list.attr('aria-activedescendant', activeID); },
},
_refreshPosition: function() {
_refreshPosition: function() { var o = this.options;
var o = this.options;
// if its a native pop-up we need to calculate the position of the selected li
// if its a native pop-up we need to calculate the position of the selected li if ( o.style == "popup" && !o.positionOptions.offset ) {
if ( o.style == "popup" && !o.positionOptions.offset ) { var selected = this._selectedOptionLi();
var selected = this._selectedOptionLi(); var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top );
var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top ); }
} // update zIndex if jQuery UI is able to process
// update zIndex if jQuery UI is able to process var zIndexElement = this.element.zIndex();
var zIndexElement = this.element.zIndex(); if ( zIndexElement ) {
if ( zIndexElement ) { this.listWrap.css( 'zIndex', zIndexElement );
this.listWrap.css( 'zIndex', zIndexElement ); }
} this.listWrap.position({
this.listWrap.position({ // set options for position plugin
// set options for position plugin of: o.positionOptions.of || this.newelement,
of: o.positionOptions.of || this.newelement, my: o.positionOptions.my,
my: o.positionOptions.my, at: o.positionOptions.at,
at: o.positionOptions.at, offset: o.positionOptions.offset || _offset,
offset: o.positionOptions.offset || _offset, collision: o.positionOptions.collision || 'flip'
collision: o.positionOptions.collision || 'flip' });
}); }
}
}); });
})(jQuery); })(jQuery);
...@@ -8,7 +8,7 @@ $(document).ready(function(){ ...@@ -8,7 +8,7 @@ $(document).ready(function(){
e.stopPropagation(); e.stopPropagation();
$(this).find("td.tree-item-file-name a").click(); $(this).find("td.tree-item-file-name a").click();
return false; return false;
} }
}); });
$("#projects-list .project").live('click', function(e){ $("#projects-list .project").live('click', function(e){
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope. * the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self *= require_self
*= require_tree . *= require_tree .
*/ */
@mixin round-borders-all($radius) { @mixin round-borders-all($radius) {
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
-moz-border-radius: $radius; -moz-border-radius: $radius;
-webkit-border-radius: $radius; -webkit-border-radius: $radius;
...@@ -28,11 +28,11 @@ td.linenos{ ...@@ -28,11 +28,11 @@ td.linenos{
.highlight pre{ .highlight pre{
} }
.linenodiv pre { .linenodiv pre {
white-space:pre-line; white-space:pre-line;
} }
td.linenos { td.linenos {
background:#ECECEC; background:#ECECEC;
color:#777; color:#777;
padding:10px 0px 0px 10px; padding:10px 0px 0px 10px;
...@@ -42,7 +42,7 @@ td.linenos { ...@@ -42,7 +42,7 @@ td.linenos {
} }
td.code .highlight { td.code .highlight {
overflow: auto; overflow: auto;
} }
table.highlighttable pre{ table.highlighttable pre{
...@@ -53,9 +53,8 @@ table.highlighttable pre{ ...@@ -53,9 +53,8 @@ table.highlighttable pre{
text-align:left; text-align:left;
} }
.git-empty .highlight { .git-empty .highlight {
@include round-borders-all(4px); @include round-borders-all(4px);
background:#eee; background:#eee;
padding:5px; padding:5px;
//overflow-x:scroll; //overflow-x:scroll;
...@@ -71,10 +70,9 @@ table.highlighttable pre{ ...@@ -71,10 +70,9 @@ table.highlighttable pre{
.shadow{ .shadow{
-webkit-box-shadow:0 5px 15px #000; -webkit-box-shadow:0 5px 15px #000;
-moz-box-shadow:0 5px 15px #000; -moz-box-shadow:0 5px 15px #000;
box-shadow:0 5px 15px #000; box-shadow:0 5px 15px #000;
} }
.hll { background-color: #ffffff } .hll { background-color: #ffffff }
.c { color: #888888; font-style: italic } /* Comment */ .c { color: #888888; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */ .err { color: #a61717; background-color: #e3d2d2 } /* Error */
...@@ -105,7 +103,7 @@ table.highlighttable pre{ ...@@ -105,7 +103,7 @@ table.highlighttable pre{
.highlight .nb{color:#0086B3;} /* Name.Builtin */ .highlight .nb{color:#0086B3;} /* Name.Builtin */
.highlight .nc{color:#458;font-weight:bold;} /* Name.Class */ .highlight .nc{color:#458;font-weight:bold;} /* Name.Class */
.highlight .no{color:#008080;} /* Name.Constant */ .highlight .no{color:#008080;} /* Name.Constant */
.highlight .ni{color:#800080;} .highlight .ni{color:#800080;}
.highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */ .highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */
.highlight .nf{color:#900;font-weight:bold;} /* Name.Function */ .highlight .nf{color:#900;font-weight:bold;} /* Name.Function */
.highlight .nn{color:#005;font-weight:bold;} /* Name.Namespace */ .highlight .nn{color:#005;font-weight:bold;} /* Name.Namespace */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
.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; } .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; }
.ui-selectmenu-icon { position:absolute; right:6px; margin-top:-8px; top: 50%; } .ui-selectmenu-icon { position:absolute; right:6px; margin-top:-8px; top: 50%; }
.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 */ .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 */
.ui-selectmenu-menu ul { padding:0; margin:0; list-style:none; position: relative; overflow: auto; overflow-y: auto ; overflow-x: hidden; } .ui-selectmenu-menu ul { padding:0; margin:0; list-style:none; position: relative; overflow: auto; overflow-y: auto ; overflow-x: hidden; }
.ui-selectmenu-open { display: block; } .ui-selectmenu-open { display: block; }
.ui-selectmenu.ui-widget { background:none; } .ui-selectmenu.ui-widget { background:none; }
.ui-selectmenu-menu-popup { margin-top: -1px; } .ui-selectmenu-menu-popup { margin-top: -1px; }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
@mixin round-borders-bottom($radius) { @mixin round-borders-bottom($radius) {
border-top: 1px solid #eaeaea; border-top: 1px solid #eaeaea;
-moz-border-radius-bottomright: $radius; -moz-border-radius-bottomright: $radius;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
-webkit-border-bottom-right-radius: $radius; -webkit-border-bottom-right-radius: $radius;
} }
@mixin round-borders-top($radius) { @mixin round-borders-top($radius) {
border-top: 1px solid #eaeaea; border-top: 1px solid #eaeaea;
-moz-border-radius-topright: $radius; -moz-border-radius-topright: $radius;
...@@ -28,14 +28,14 @@ ...@@ -28,14 +28,14 @@
-webkit-border-top-right-radius: $radius; -webkit-border-top-right-radius: $radius;
} }
@mixin round-borders-all($radius) { @mixin round-borders-all($radius) {
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
-moz-border-radius: $radius; -moz-border-radius: $radius;
-webkit-border-radius: $radius; -webkit-border-radius: $radius;
border-radius: $radius; border-radius: $radius;
} }
@mixin hover-color { @mixin hover-color {
background: #fff !important; background: #fff !important;
background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#FFF6BF)) !important; background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#FFF6BF)) !important;
background: -moz-linear-gradient(top,#fff,#FFF6BF) !important; background: -moz-linear-gradient(top,#fff,#FFF6BF) !important;
...@@ -46,47 +46,47 @@ ...@@ -46,47 +46,47 @@
border:1px solid #CCC; border:1px solid #CCC;
margin-bottom:1em; margin-bottom:1em;
.diff_file_header { .diff_file_header {
padding:5px 5px; padding:5px 5px;
border-bottom:1px solid #CCC; border-bottom:1px solid #CCC;
background: #eee; background: #eee;
} }
.diff_file_content { .diff_file_content {
overflow-x: scroll; overflow-x: scroll;
background:#fff; background:#fff;
color:#333; color:#333;
font-size: 12px; font-size: 12px;
font-family: 'Courier New', 'andale mono','lucida console',monospace; font-family: 'Courier New', 'andale mono','lucida console',monospace;
} }
.diff_file_content_image { .diff_file_content_image {
background:#eee; background:#eee;
text-align:center; text-align:center;
img { img {
padding:100px; padding:100px;
max-width:300px; max-width:300px;
} }
} }
} }
#logo { #logo {
&:hover { &:hover {
background:none; background:none;
} }
} }
.file_stats { .file_stats {
margin-bottom:10px; margin-bottom:10px;
@include round-borders-all(4px); @include round-borders-all(4px);
span { span {
border-top: 1px solid #eaeaea; border-top: 1px solid #eaeaea;
padding:5px 5px; padding:5px 5px;
display:block; display:block;
&:first-child { &:first-child {
border-top:none; border-top:none;
} }
img { img {
width:18px; width:18px;
float:left; float:left;
margin-right: 6px; margin-right: 6px;
...@@ -94,15 +94,15 @@ ...@@ -94,15 +94,15 @@
} }
} }
.round-borders { .round-borders {
@include round-borders-all(4px); @include round-borders-all(4px);
padding: 4px 0px; padding: 4px 0px;
} }
table.round-borders { table.round-borders {
float:left; float:left;
} }
.day-commits-table { .day-commits-table {
@include round-borders-all(4px); @include round-borders-all(4px);
padding: 4px 0px; padding: 4px 0px;
margin-bottom:10px; margin-bottom:10px;
...@@ -110,55 +110,54 @@ table.round-borders { ...@@ -110,55 +110,54 @@ table.round-borders {
width:100%; width:100%;
background: #E6F1F6; background: #E6F1F6;
.day-header { .day-header {
padding:10px; padding:10px;
h3 { h3 {
margin:0px; margin:0px;
} }
} }
ul { ul {
display:block; display:block;
list-style:none; list-style:none;
margin:0px; margin:0px;
padding:0px; padding:0px;
li.commit { li.commit {
display:list-item; display:list-item;
padding:8px; padding:8px;
margin:0px; margin:0px;
background: #F7FBFC; background: #F7FBFC;
border-top: 1px solid #E2EAEE; border-top: 1px solid #E2EAEE;
&:first-child { &:first-child {
border-top: 1px solid #E2EAEE; border-top: 1px solid #E2EAEE;
} }
&:nth-child(2n+1) { &:nth-child(2n+1) {
background: white; background: white;
} }
a.button { a.button {
width:85px; width:85px;
padding:10px; padding:10px;
margin:0px; margin:0px;
float:right; float:right;
} }
p { p {
margin-bottom: 3px; margin-bottom: 3px;
font-size: 13px; font-size: 13px;
} }
} }
} }
} }
@mixin panel-color { @mixin panel-color {
background: #111 !important; background: #111 !important;
background: -webkit-gradient(linear,left top,left bottom,from(#333),to(#111)) !important; background: -webkit-gradient(linear,left top,left bottom,from(#333),to(#111)) !important;
background: -moz-linear-gradient(top,#333,#111) !important; background: -moz-linear-gradient(top,#333,#111) !important;
background: transparent 9 !important; background: transparent 9 !important;
} }
#header-panel {
#header-panel {
@include panel-color; @include panel-color;
height:40px; height:40px;
position:fixed; position:fixed;
...@@ -178,23 +177,23 @@ table.round-borders { ...@@ -178,23 +177,23 @@ table.round-borders {
color:white; color:white;
} }
&.current { &.current {
border-bottom: 3px solid #EAEAEA !important; border-bottom: 3px solid #EAEAEA !important;
padding: 10px 20px 0; padding: 10px 20px 0;
color: #eaeaea; color: #eaeaea;
} }
} }
.search-holder { .search-holder {
float:left; float:left;
width:290px; width:290px;
input { input {
@include round-borders-all(4px); @include round-borders-all(4px);
width:290px; width:290px;
border-color:#888; border-color:#888;
padding:5px; padding:5px;
background:#666; background:#666;
color:#222; color:#222;
&:focus { &:focus {
background:#fff; background:#fff;
color:#000; color:#000;
} }
...@@ -211,7 +210,7 @@ table.round-borders { ...@@ -211,7 +210,7 @@ table.round-borders {
padding:20px; padding:20px;
} }
body { body {
background: #eaeaea; background: #eaeaea;
} }
...@@ -220,7 +219,7 @@ a { ...@@ -220,7 +219,7 @@ a {
} }
.diff_file_content{ .diff_file_content{
.old_line, .new_line { .old_line, .new_line {
background:#ECECEC; background:#ECECEC;
color:#777; color:#777;
width:15px; width:15px;
...@@ -230,9 +229,8 @@ a { ...@@ -230,9 +229,8 @@ a {
} }
} }
.view_file_content{ .view_file_content{
.old_line, .new_line { .old_line, .new_line {
background:#ECECEC; background:#ECECEC;
color:#777; color:#777;
width:15px; width:15px;
...@@ -249,20 +247,20 @@ a { ...@@ -249,20 +247,20 @@ a {
border:1px solid #CCC; border:1px solid #CCC;
margin-bottom:1em; margin-bottom:1em;
.view_file_header { .view_file_header {
padding:5px 5px; padding:5px 5px;
border-bottom:1px solid #CCC; border-bottom:1px solid #CCC;
background: #eee; background: #eee;
} }
.view_file_content { .view_file_content {
background:#fff; background:#fff;
color:#514721; color:#514721;
font-size: 11px; font-size: 11px;
} }
.view_file_content_image { .view_file_content_image {
background:#eee; background:#eee;
text-align:center; text-align:center;
img { img {
padding:100px; padding:100px;
max-width:300px; max-width:300px;
} }
...@@ -273,7 +271,7 @@ a { ...@@ -273,7 +271,7 @@ a {
} }
input.ssh_project_url { input.ssh_project_url {
padding:5px; padding:5px;
margin:0px; margin:0px;
float:right; float:right;
...@@ -281,12 +279,10 @@ input.ssh_project_url { ...@@ -281,12 +279,10 @@ input.ssh_project_url {
text-align:center; text-align:center;
} }
.day-commits-table li.commit {
.day-commits-table li.commit {
cursor:pointer; cursor:pointer;
&:hover { &:hover {
@include hover-color; @include hover-color;
} }
} }
...@@ -295,39 +291,39 @@ input.ssh_project_url { ...@@ -295,39 +291,39 @@ input.ssh_project_url {
#FFF6BF #FFF6BF
#FFD324 #FFD324
*/ */
#tree-slider tr.tree-item { #tree-slider tr.tree-item {
cursor:pointer; cursor:pointer;
&:hover { &:hover {
@include hover-color; @include hover-color;
td { td {
@include hover-color; @include hover-color;
} }
} }
} }
#projects-list .project { #projects-list .project {
height:50px; height:50px;
} }
#projects-list .project, #projects-list .project,
#snippets-table .snippet, #snippets-table .snippet,
#issues-table .issue{ #issues-table .issue{
cursor:pointer; cursor:pointer;
&:hover { &:hover {
@include hover-color; @include hover-color;
td { td {
@include hover-color; @include hover-color;
} }
} }
} }
.clear { .clear {
clear: both; clear: both;
} }
.top_project_menu { .top_project_menu {
a { a {
border-right: 1px solid #FFFFFF; border-right: 1px solid #FFFFFF;
box-shadow: -1px 0 #DDDDDD inset; box-shadow: -1px 0 #DDDDDD inset;
color: #666; color: #666;
...@@ -339,7 +335,7 @@ input.ssh_project_url { ...@@ -339,7 +335,7 @@ input.ssh_project_url {
text-shadow: 0 1px 0 #FFFFFF; text-shadow: 0 1px 0 #FFFFFF;
float:left; float:left;
&.current { &.current {
background-color: #FFFFFF; background-color: #FFFFFF;
color: #222222; color: #222222;
} }
...@@ -363,11 +359,11 @@ input.ssh_project_url { ...@@ -363,11 +359,11 @@ input.ssh_project_url {
.new_project, .new_project,
.new_snippet, .new_snippet,
.edit_snippet, .edit_snippet,
.edit_project { .edit_project {
input[type='text'], input[type='text'],
input[type='email'], input[type='email'],
input[type='password'], input[type='password'],
textarea { textarea {
width:400px; width:400px;
padding:8px; padding:8px;
font-size:14px; font-size:14px;
...@@ -375,7 +371,7 @@ input.ssh_project_url { ...@@ -375,7 +371,7 @@ input.ssh_project_url {
} }
} }
.input_button { .input_button {
//@include round-borders-all(4px); //@include round-borders-all(4px);
padding:8px; padding:8px;
font-size:14px; 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 {
border-bottom: 1px solid #E2EAEE; border-bottom: 1px solid #E2EAEE;
} }
.top_menu_count { .top_menu_count {
background: none repeat scroll 0 0 #FFF6BF; background: none repeat scroll 0 0 #FFF6BF;
border-color: #FFD324; border-color: #FFD324;
color: #514721; 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 {
/** FALSH **/ /** FALSH **/
#flash_container { #flash_container {
height:40px; height:40px;
position:fixed; position:fixed;
z-index:1009; 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 {
cursor:pointer; cursor:pointer;
border-bottom:1px solid #777; border-bottom:1px solid #777;
h4 { h4 {
color:#444; color:#444;
font-size:22px; font-size:22px;
padding-top:5px; 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 {
color: #0099FF; color: #0099FF;
} }
&.hm { &.hm {
margin: 0px 0px; margin: 0px 0px;
} }
&.vm { &.vm {
margin: 5px 0px; margin: 5px 0px;
} }
} }
/** Notes **/ /** Notes **/
#notes-list { #notes-list {
display:block; display:block;
list-style:none; list-style:none;
margin:0px; margin:0px;
padding:0px; padding:0px;
li { li {
display:list-item; display:list-item;
padding:8px; padding:8px;
margin:0px; margin:0px;
background: #F7FBFC; background: #F7FBFC;
border-top: 1px solid #E2EAEE; border-top: 1px solid #E2EAEE;
&:first-child { &:first-child {
border-top: none; border-top: none;
} }
&:nth-child(2n+1) { &:nth-child(2n+1) {
background: white; background: white;
} }
p { p {
margin-bottom: 4px; margin-bottom: 4px;
font-size: 13px; font-size: 13px;
color:#111; color:#111;
} }
} }
cite { cite {
&.ago { &.ago {
color:#666; color:#666;
} }
} }
} }
.notes_count { .notes_count {
background: none repeat scroll 0 0 #FFF6BF; background: none repeat scroll 0 0 #FFF6BF;
border-color: #FFD324; border-color: #FFD324;
color: #514721; 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 {
right: 6px; right: 6px;
top: 6px; top: 6px;
} }
.note_author { .note_author {
float:left; float:left;
width:60px; width:60px;
} }
.note_content { .note_content {
float:left; float:left;
width:650px; width:650px;
} }
.issue_notes { .issue_notes {
.note_content { .note_content {
float:left; float:left;
width:400px; width:400px;
} }
} }
#user_projects_limit{ #user_projects_limit{
width: 60px; width: 60px;
} }
.project_thumb { .project_thumb {
margin:20px 0; margin:20px 0;
width: 250px; width: 250px;
float:left; float:left;
padding:20px; padding:20px;
text-align:center; text-align:center;
p, h4 { p, h4 {
text-align:left; text-align:left;
} }
.lbutton { .lbutton {
float:left; float:left;
} }
} }
...@@ -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 {
padding: 10px; padding: 10px;
} }
.recent_message_parent { .recent_message_parent {
img { img {
padding-right:10px; padding-right:10px;
} }
...@@ -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 {
&.dash_wall{ &.dash_wall{
border-bottom: 2px solid orange; border-bottom: 2px solid orange;
span { span {
background: orange; background: orange;
color:black; color:black;
} }
...@@ -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 {
&.dash_issue{ &.dash_issue{
border-bottom: 2px solid #ffbbbb; border-bottom: 2px solid #ffbbbb;
span { span {
background: #ffbbbb; background: #ffbbbb;
} }
} }
&.dash_commit{ &.dash_commit{
border-bottom: 2px solid #bbbbff; border-bottom: 2px solid #bbbbff;
span{ span{
background: #bbbbff; background: #bbbbff;
} }
} }
...@@ -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 {
&.dash_snippet{ &.dash_snippet{
border-bottom: 2px solid #bbffbb; border-bottom: 2px solid #bbffbb;
span{ span{
background: #bbffbb; background: #bbffbb;
} }
} }
span{
span{
border: 1px solid #aaa; border: 1px solid #aaa;
color:black; color:black;
padding:1px 4px; padding:1px 4px;
} }
h4 { h4 {
margin-bottom:3px; margin-bottom:3px;
} }
} }
.commit, .commit,
.message, .message,
#notes-list{ #notes-list{
.author { .author {
background: #eaeaea; background: #eaeaea;
color: #333; color: #333;
border: 1px solid #aaa; 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 {
} }
/* Note textare */ /* Note textare */
#note_note { #note_note {
height:100px; height:100px;
width:97%; width:97%;
font-size:14px; font-size:14px;
} }
.wall_page { .wall_page {
#note_note { #note_note {
height:25px; height:25px;
} }
.attach_holder { .attach_holder {
display:none; display:none;
} }
} }
...@@ -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 {
padding:2px 4px; padding:2px 4px;
border:none; border:none;
&.high { &.high {
background: #D12F19; background: #D12F19;
color:white; color:white;
} }
&.today { &.today {
background: #44aa22; background: #44aa22;
color:white; color:white;
} }
&.yours { &.yours {
background: #4466cc; background: #4466cc;
color:white; color:white;
} }
...@@ -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 {
} }
} }
#issues-table .issue { #issues-table .issue {
&.critical { &.critical {
td { td {
//background: #D12F19; //background: #D12F19;
//color:#fff; //color:#fff;
......
...@@ -20,7 +20,7 @@ class Admin::MailerController < ApplicationController ...@@ -20,7 +20,7 @@ class Admin::MailerController < ApplicationController
else else
render :file => 'notify/note_wall_email.html.haml', :layout => 'notify' render :file => 'notify/note_wall_email.html.haml', :layout => 'notify'
end end
rescue rescue
render :text => "Preview not avaialble" render :text => "Preview not avaialble"
end end
...@@ -29,7 +29,7 @@ class Admin::MailerController < ApplicationController ...@@ -29,7 +29,7 @@ class Admin::MailerController < ApplicationController
@password = "DHasJKDHAS!" @password = "DHasJKDHAS!"
render :file => 'notify/new_user_email.html.haml', :layout => 'notify' render :file => 'notify/new_user_email.html.haml', :layout => 'notify'
rescue rescue
render :text => "Preview not avaialble" render :text => "Preview not avaialble"
end end
...@@ -38,7 +38,7 @@ class Admin::MailerController < ApplicationController ...@@ -38,7 +38,7 @@ class Admin::MailerController < ApplicationController
@user = @issue.assignee @user = @issue.assignee
@project = @issue.project @project = @issue.project
render :file => 'notify/new_issue_email.html.haml', :layout => 'notify' render :file => 'notify/new_issue_email.html.haml', :layout => 'notify'
rescue rescue
render :text => "Preview not avaialble" render :text => "Preview not avaialble"
end end
end end
...@@ -36,7 +36,7 @@ class Admin::UsersController < ApplicationController ...@@ -36,7 +36,7 @@ class Admin::UsersController < ApplicationController
def create def create
admin = params[:user].delete("admin") admin = params[:user].delete("admin")
@admin_user = User.new(params[:user]) @admin_user = User.new(params[:user])
@admin_user.admin = (admin && admin.to_i > 0) @admin_user.admin = (admin && admin.to_i > 0)
respond_to do |format| respond_to do |format|
...@@ -54,8 +54,8 @@ class Admin::UsersController < ApplicationController ...@@ -54,8 +54,8 @@ class Admin::UsersController < ApplicationController
def update def update
admin = params[:user].delete("admin") admin = params[:user].delete("admin")
if params[:user][:password].empty? if params[:user][:password].empty?
params[:user].delete(:password) params[:user].delete(:password)
params[:user].delete(:password_confirmation) params[:user].delete(:password_confirmation)
end end
@admin_user = User.find(params[:id]) @admin_user = User.find(params[:id])
......
...@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base ...@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
end end
protected protected
def abilities def abilities
@abilities ||= Six.new @abilities ||= Six.new
...@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base ...@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
abilities.allowed?(object, action, subject) abilities.allowed?(object, action, subject)
end end
def project def project
@project ||= Project.find_by_code(params[:project_id]) @project ||= Project.find_by_code(params[:project_id])
end end
...@@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base ...@@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base
@tag = unless params[:tag].blank? @tag = unless params[:tag].blank?
params[:tag] params[:tag]
else else
nil nil
end end
......
class IssuesController < ApplicationController class IssuesController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :project before_filter :project
before_filter :issue, :only => [:edit, :update, :destroy, :show] before_filter :issue, :only => [:edit, :update, :destroy, :show]
# Authorize # Authorize
before_filter :add_project_abilities before_filter :add_project_abilities
before_filter :authorize_read_issue! before_filter :authorize_read_issue!
before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort]
respond_to :js respond_to :js
...@@ -57,14 +57,13 @@ class IssuesController < ApplicationController ...@@ -57,14 +57,13 @@ class IssuesController < ApplicationController
end end
end end
def destroy def destroy
return access_denied! unless can?(current_user, :admin_issue, @issue) return access_denied! unless can?(current_user, :admin_issue, @issue)
@issue.destroy @issue.destroy
respond_to do |format| respond_to do |format|
format.js { render :nothing => true } format.js { render :nothing => true }
end end
end end
...@@ -78,7 +77,7 @@ class IssuesController < ApplicationController ...@@ -78,7 +77,7 @@ class IssuesController < ApplicationController
render :nothing => true render :nothing => true
end end
protected protected
def issue def issue
@issue ||= @project.issues.find(params[:id]) @issue ||= @project.issues.find(params[:id])
......
...@@ -24,7 +24,7 @@ class KeysController < ApplicationController ...@@ -24,7 +24,7 @@ class KeysController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { redirect_to keys_url } format.html { redirect_to keys_url }
format.js { render :nothing => true } format.js { render :nothing => true }
end end
end end
end end
class NotesController < ApplicationController class NotesController < ApplicationController
before_filter :project before_filter :project
# Authorize # Authorize
before_filter :add_project_abilities before_filter :add_project_abilities
before_filter :authorize_write_note!, :only => [:create] before_filter :authorize_write_note!, :only => [:create]
respond_to :js respond_to :js
...@@ -15,10 +15,9 @@ class NotesController < ApplicationController ...@@ -15,10 +15,9 @@ class NotesController < ApplicationController
notify if params[:notify] == '1' notify if params[:notify] == '1'
end end
respond_to do |format| respond_to do |format|
format.html {redirect_to :back} format.html {redirect_to :back}
format.js format.js
end end
end end
...@@ -30,11 +29,11 @@ class NotesController < ApplicationController ...@@ -30,11 +29,11 @@ class NotesController < ApplicationController
@note.destroy @note.destroy
respond_to do |format| respond_to do |format|
format.js { render :nothing => true } format.js { render :nothing => true }
end end
end end
protected protected
def notify def notify
@project.users.reject { |u| u.id == current_user.id } .each do |u| @project.users.reject { |u| u.id == current_user.id } .each do |u|
......
...@@ -14,7 +14,7 @@ class ProfileController < ApplicationController ...@@ -14,7 +14,7 @@ class ProfileController < ApplicationController
end end
def password_update def password_update
params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"} params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
@user = current_user @user = current_user
if @user.update_attributes(params[:user]) if @user.update_attributes(params[:user])
......
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
before_filter :project, :except => [:index, :new, :create] before_filter :project, :except => [:index, :new, :create]
# Authorize # Authorize
before_filter :add_project_abilities before_filter :add_project_abilities
before_filter :authorize_read_project!, :except => [:index, :new, :create] before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :require_non_empty_project, :only => [:blob, :tree] before_filter :require_non_empty_project, :only => [:blob, :tree]
...@@ -23,7 +23,7 @@ class ProjectsController < ApplicationController ...@@ -23,7 +23,7 @@ class ProjectsController < ApplicationController
@project = Project.new(params[:project]) @project = Project.new(params[:project])
@project.owner = current_user @project.owner = current_user
Project.transaction do Project.transaction do
@project.save! @project.save!
@project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user) @project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user)
end end
...@@ -31,7 +31,7 @@ class ProjectsController < ApplicationController ...@@ -31,7 +31,7 @@ class ProjectsController < ApplicationController
respond_to do |format| respond_to do |format|
if @project.valid? if @project.valid?
format.html { redirect_to @project, notice: 'Project was successfully created.' } format.html { redirect_to @project, notice: 'Project was successfully created.' }
format.js format.js
else else
format.html { render action: "new" } format.html { render action: "new" }
format.js format.js
...@@ -51,10 +51,10 @@ class ProjectsController < ApplicationController ...@@ -51,10 +51,10 @@ class ProjectsController < ApplicationController
respond_to do |format| respond_to do |format|
if project.update_attributes(params[:project]) if project.update_attributes(params[:project])
format.html { redirect_to project, :notice => 'Project was successfully updated.' } format.html { redirect_to project, :notice => 'Project was successfully updated.' }
format.js format.js
else else
format.html { render action: "edit" } format.html { render action: "edit" }
format.js format.js
end end
end end
end end
...@@ -105,7 +105,7 @@ class ProjectsController < ApplicationController ...@@ -105,7 +105,7 @@ class ProjectsController < ApplicationController
if params[:commit_id] if params[:commit_id]
@commit = @repo.commits(params[:commit_id]).first @commit = @repo.commits(params[:commit_id]).first
else else
@commit = @repo.commits(@ref || "master").first @commit = @repo.commits(@ref || "master").first
end end
...@@ -114,7 +114,7 @@ class ProjectsController < ApplicationController ...@@ -114,7 +114,7 @@ class ProjectsController < ApplicationController
respond_to do |format| respond_to do |format|
format.html # show.html.erb format.html # show.html.erb
format.js do format.js do
# diasbale cache to allow back button works # diasbale cache to allow back button works
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache" response.headers["Pragma"] = "no-cache"
...@@ -132,7 +132,7 @@ class ProjectsController < ApplicationController ...@@ -132,7 +132,7 @@ class ProjectsController < ApplicationController
if @tree.is_a?(Grit::Blob) if @tree.is_a?(Grit::Blob)
send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name) send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name)
else else
head(404) head(404)
end end
rescue rescue
...@@ -147,9 +147,9 @@ class ProjectsController < ApplicationController ...@@ -147,9 +147,9 @@ class ProjectsController < ApplicationController
end end
end end
protected protected
def project def project
@project ||= Project.find_by_code(params[:id]) @project ||= Project.find_by_code(params[:id])
end end
end end
class SnippetsController < ApplicationController class SnippetsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :project before_filter :project
# Authorize # Authorize
before_filter :add_project_abilities before_filter :add_project_abilities
before_filter :authorize_read_snippet! before_filter :authorize_read_snippet!
before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort] before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort]
respond_to :html respond_to :html
...@@ -13,7 +13,7 @@ class SnippetsController < ApplicationController ...@@ -13,7 +13,7 @@ class SnippetsController < ApplicationController
@snippets = @project.snippets @snippets = @project.snippets
end end
def new def new
@snippet = @project.snippets.new @snippet = @project.snippets.new
end end
......
class TeamMembersController < ApplicationController class TeamMembersController < ApplicationController
before_filter :project before_filter :project
# Authorize # Authorize
before_filter :add_project_abilities before_filter :add_project_abilities
before_filter :authorize_read_project! before_filter :authorize_read_project!
before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update] before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update]
def show def show
@team_member = project.users_projects.find(params[:id]) @team_member = project.users_projects.find(params[:id])
...@@ -26,7 +26,7 @@ class TeamMembersController < ApplicationController ...@@ -26,7 +26,7 @@ class TeamMembersController < ApplicationController
respond_to do |format| respond_to do |format|
format.js format.js
format.html do format.html do
unless @team_member.valid? unless @team_member.valid?
flash[:alert] = "User should have at least one role" flash[:alert] = "User should have at least one role"
end end
...@@ -41,7 +41,7 @@ class TeamMembersController < ApplicationController ...@@ -41,7 +41,7 @@ class TeamMembersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { redirect_to root_path } format.html { redirect_to root_path }
format.js { render :nothing => true } format.js { render :nothing => true }
end end
end end
end end
...@@ -23,9 +23,9 @@ module ApplicationHelper ...@@ -23,9 +23,9 @@ module ApplicationHelper
end end
def last_commit(project) def last_commit(project)
if project.repo_exists? if project.repo_exists?
time_ago_in_words(project.commit.committed_date) + " ago" time_ago_in_words(project.commit.committed_date) + " ago"
else else
"Never" "Never"
end end
end end
...@@ -33,8 +33,8 @@ module ApplicationHelper ...@@ -33,8 +33,8 @@ module ApplicationHelper
def search_autocomplete_source def search_autocomplete_source
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
default_nav = [ default_nav = [
{ :label => "Keys", :url => keys_path }, { :label => "Keys", :url => keys_path },
{ :label => "Projects", :url => projects_path }, { :label => "Projects", :url => projects_path },
{ :label => "Admin", :url => admin_root_path } { :label => "Admin", :url => admin_root_path }
] ]
...@@ -42,10 +42,10 @@ module ApplicationHelper ...@@ -42,10 +42,10 @@ module ApplicationHelper
if @project && !@project.new_record? if @project && !@project.new_record?
project_nav = [ project_nav = [
{ :label => "#{@project.code} / Issues", :url => project_issues_path(@project) }, { :label => "#{@project.code} / Issues", :url => project_issues_path(@project) },
{ :label => "#{@project.code} / Wall", :url => wall_project_path(@project) }, { :label => "#{@project.code} / Wall", :url => wall_project_path(@project) },
{ :label => "#{@project.code} / Tree", :url => tree_project_path(@project) }, { :label => "#{@project.code} / Tree", :url => tree_project_path(@project) },
{ :label => "#{@project.code} / Commits", :url => project_commits_path(@project) }, { :label => "#{@project.code} / Commits", :url => project_commits_path(@project) },
{ :label => "#{@project.code} / Team", :url => team_project_path(@project) } { :label => "#{@project.code} / Team", :url => team_project_path(@project) }
] ]
end end
......
module CommitsHelper module CommitsHelper
def diff_line(line, line_new = 0, line_old = 0) def diff_line(line, line_new = 0, line_old = 0)
full_line = html_escape(line.gsub(/\n/, '')) full_line = html_escape(line.gsub(/\n/, ''))
color = if line[0] == "+" color = if line[0] == "+"
full_line = "<span class=\"old_line\">&nbsp;</span><span class=\"new_line\">#{line_new}</span> " + full_line full_line = "<span class=\"old_line\">&nbsp;</span><span class=\"new_line\">#{line_new}</span> " + full_line
"#DFD" "#DFD"
elsif line[0] == "-" elsif line[0] == "-"
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">&nbsp;</span> " + full_line full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">&nbsp;</span> " + full_line
"#FDD" "#FDD"
else else
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line
"none" "none"
end end
......
...@@ -12,7 +12,7 @@ module ProjectsHelper ...@@ -12,7 +12,7 @@ module ProjectsHelper
else else
true true
end end
rescue rescue
nil nil
end end
end end
...@@ -17,14 +17,14 @@ class Ability ...@@ -17,14 +17,14 @@ class Ability
:read_issue, :read_issue,
:read_snippet, :read_snippet,
:read_team_member, :read_team_member,
:read_note :read_note
] if project.readers.include?(user) ] if project.readers.include?(user)
rules << [ rules << [
:write_project, :write_project,
:write_issue, :write_issue,
:write_snippet, :write_snippet,
:write_note :write_note
] if project.writers.include?(user) ] if project.writers.include?(user)
rules << [ rules << [
...@@ -32,13 +32,13 @@ class Ability ...@@ -32,13 +32,13 @@ class Ability
:admin_issue, :admin_issue,
:admin_snippet, :admin_snippet,
:admin_team_member, :admin_team_member,
:admin_note :admin_note
] if project.admins.include?(user) ] if project.admins.include?(user)
rules.flatten rules.flatten
end end
class << self class << self
[:issue, :note, :snippet].each do |name| [:issue, :note, :snippet].each do |name|
define_method "#{name}_abilities" do |user, subject| define_method "#{name}_abilities" do |user, subject|
if subject.author == user if subject.author == user
...@@ -48,7 +48,7 @@ class Ability ...@@ -48,7 +48,7 @@ class Ability
:"admin_#{name}" :"admin_#{name}"
] ]
else else
subject.respond_to?(:project) ? subject.respond_to?(:project) ?
project_abilities(user, subject.project) : [] project_abilities(user, subject.project) : []
end end
end end
......
...@@ -13,7 +13,7 @@ class Issue < ActiveRecord::Base ...@@ -13,7 +13,7 @@ class Issue < ActiveRecord::Base
validates :title, validates :title,
:presence => true, :presence => true,
:length => { :within => 0..255 } :length => { :within => 0..255 }
validates :content, validates :content,
:presence => true, :presence => true,
:length => { :within => 0..2000 } :length => { :within => 0..2000 }
...@@ -30,7 +30,7 @@ class Issue < ActiveRecord::Base ...@@ -30,7 +30,7 @@ class Issue < ActiveRecord::Base
def today? def today?
Date.today == created_at.to_date Date.today == created_at.to_date
end end
def new? def new?
today? && created_at == updated_at today? && created_at == updated_at
end end
......
...@@ -17,11 +17,11 @@ class Key < ActiveRecord::Base ...@@ -17,11 +17,11 @@ class Key < ActiveRecord::Base
def set_identifier def set_identifier
self.identifier = "#{user.identifier}_#{Time.now.to_i}" self.identifier = "#{user.identifier}_#{Time.now.to_i}"
end end
def update_gitosis def update_gitosis
Gitosis.new.configure do |c| Gitosis.new.configure do |c|
c.update_keys(identifier, key) c.update_keys(identifier, key)
projects.each do |project| projects.each do |project|
c.update_project(project.path, project.gitosis_writers) c.update_project(project.path, project.gitosis_writers)
end end
......
...@@ -7,7 +7,7 @@ class Note < ActiveRecord::Base ...@@ -7,7 +7,7 @@ class Note < ActiveRecord::Base
belongs_to :author, belongs_to :author,
:class_name => "User" :class_name => "User"
attr_protected :author, :author_id attr_protected :author, :author_id
validates_presence_of :project validates_presence_of :project
...@@ -15,10 +15,10 @@ class Note < ActiveRecord::Base ...@@ -15,10 +15,10 @@ class Note < ActiveRecord::Base
:presence => true, :presence => true,
:length => { :within => 0..255 } :length => { :within => 0..255 }
validates :attachment, validates :attachment,
:file_size => { :file_size => {
:maximum => 10.megabytes.to_i :maximum => 10.megabytes.to_i
} }
scope :common, where(:noteable_id => nil) scope :common, where(:noteable_id => nil)
......
...@@ -20,7 +20,7 @@ class Project < ActiveRecord::Base ...@@ -20,7 +20,7 @@ class Project < ActiveRecord::Base
:format => { :with => /^[a-zA-Z0-9_\-]*$/, :format => { :with => /^[a-zA-Z0-9_\-]*$/,
:message => "only letters, digits & '_' '-' allowed" }, :message => "only letters, digits & '_' '-' allowed" },
:length => { :within => 0..255 } :length => { :within => 0..255 }
validates :description, validates :description,
:length => { :within => 0..2000 } :length => { :within => 0..2000 }
...@@ -57,13 +57,13 @@ class Project < ActiveRecord::Base ...@@ -57,13 +57,13 @@ class Project < ActiveRecord::Base
c.update_project(path, gitosis_writers) c.update_project(path, gitosis_writers)
end end
end end
def destroy_gitosis_project def destroy_gitosis_project
Gitosis.new.configure do |c| Gitosis.new.configure do |c|
c.destroy_project(self) c.destroy_project(self)
end end
end end
def add_access(user, *access) def add_access(user, *access)
opts = { :user => user } opts = { :user => user }
access.each { |name| opts.merge!(name => true) } access.each { |name| opts.merge!(name => true) }
...@@ -102,12 +102,12 @@ class Project < ActiveRecord::Base ...@@ -102,12 +102,12 @@ class Project < ActiveRecord::Base
def url_to_repo def url_to_repo
"#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git" "#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git"
end end
def path_to_repo def path_to_repo
GITOSIS["base_path"] + path + ".git" GITOSIS["base_path"] + path + ".git"
end end
def repo def repo
@repo ||= Grit::Repo.new(path_to_repo) @repo ||= Grit::Repo.new(path_to_repo)
end end
...@@ -122,17 +122,17 @@ class Project < ActiveRecord::Base ...@@ -122,17 +122,17 @@ class Project < ActiveRecord::Base
def commit(commit_id = nil) def commit(commit_id = nil)
if commit_id if commit_id
repo.commits(commit_id).first repo.commits(commit_id).first
else else
repo.commits.first repo.commits.first
end end
end end
def heads def heads
@heads ||= repo.heads @heads ||= repo.heads
end end
def fresh_commits def fresh_commits
commits = heads.map do |h| commits = heads.map do |h|
repo.commits(h.name, 10) repo.commits(h.name, 10)
end.flatten.uniq { |c| c.id } end.flatten.uniq { |c| c.id }
...@@ -144,7 +144,7 @@ class Project < ActiveRecord::Base ...@@ -144,7 +144,7 @@ class Project < ActiveRecord::Base
end end
def commits_since(date) def commits_since(date)
commits = heads.map do |h| commits = heads.map do |h|
repo.log(h.name, nil, :since => date) repo.log(h.name, nil, :since => date)
end.flatten.uniq { |c| c.id } end.flatten.uniq { |c| c.id }
...@@ -165,7 +165,7 @@ class Project < ActiveRecord::Base ...@@ -165,7 +165,7 @@ class Project < ActiveRecord::Base
unless owner.can_create_project? unless owner.can_create_project?
errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it") errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
end end
rescue rescue
errors[:base] << ("Cant check your ability to create project") errors[:base] << ("Cant check your ability to create project")
end end
......
...@@ -13,7 +13,7 @@ class Snippet < ActiveRecord::Base ...@@ -13,7 +13,7 @@ class Snippet < ActiveRecord::Base
validates :title, validates :title,
:presence => true, :presence => true,
:length => { :within => 0..255 } :length => { :within => 0..255 }
validates :file_name, validates :file_name,
:presence => true, :presence => true,
:length => { :within => 0..255 } :length => { :within => 0..255 }
...@@ -22,9 +22,8 @@ class Snippet < ActiveRecord::Base ...@@ -22,9 +22,8 @@ class Snippet < ActiveRecord::Base
:presence => true, :presence => true,
:length => { :within => 0..10000 } :length => { :within => 0..10000 }
def self.content_types def self.content_types
[ [
".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb", ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb",
".js", ".sh", ".coffee", ".yml", ".md" ".js", ".sh", ".coffee", ".yml", ".md"
......
...@@ -5,7 +5,7 @@ class User < ActiveRecord::Base ...@@ -5,7 +5,7 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable :recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model # Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, attr_accessible :email, :password, :password_confirmation, :remember_me,
:name, :projects_limit, :skype, :linkedin, :twitter :name, :projects_limit, :skype, :linkedin, :twitter
has_many :users_projects, :dependent => :destroy has_many :users_projects, :dependent => :destroy
......
%p This is page with preview for all system emails that are sent to user %p This is page with preview for all system emails that are sent to user
%p Email previews built based on existing Project/Commit/Issue base - so some preview maybe unavailable unless object appear in system %p Email previews built based on existing Project/Commit/Issue base - so some preview maybe unavailable unless object appear in system
#accordion #accordion
%h3 %h3
%a New user %a New user
%div %div
%iframe{ :src=> admin_mailer_preview_user_new_path, :width=>"100%", :height=>"350"} %iframe{ :src=> admin_mailer_preview_user_new_path, :width=>"100%", :height=>"350"}
%h3 %h3
%a New issue %a New issue
%div %div
%iframe{ :src=> admin_mailer_preview_issue_new_path, :width=>"100%", :height=>"350"} %iframe{ :src=> admin_mailer_preview_issue_new_path, :width=>"100%", :height=>"350"}
%h3 %h3
%a Commit note %a Commit note
%div %div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Commit"), :width=>"100%", :height=>"350"} %iframe{ :src=> admin_mailer_preview_note_path(:type => "Commit"), :width=>"100%", :height=>"350"}
%h3 %h3
%a Issue note %a Issue note
%div %div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Issue"), :width=>"100%", :height=>"350"} %iframe{ :src=> admin_mailer_preview_note_path(:type => "Issue"), :width=>"100%", :height=>"350"}
%h3 %h3
%a Wall note %a Wall note
%div %div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"} %iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"}
:javascript
:javascript
$(function() { $(function() {
$( "#accordion" ).accordion(); }); $( "#accordion" ).accordion(); });
%p#notice= notice %p#notice= notice
.span-8.colborder .span-8.colborder
%h2= @admin_project.name %h2= @admin_project.name
%p %p
%b Name: %b Name:
...@@ -22,16 +22,16 @@ ...@@ -22,16 +22,16 @@
.span-14 .span-14
%h2 Team %h2 Team
%table.round-borders %table.round-borders
%tr %tr
%th Name %th Name
%th Added %th Added
%th Web %th Web
%th Git %th Git
%th Admin %th Admin
%th %th
- @admin_project.users_projects.each do |tm| - @admin_project.users_projects.each do |tm|
%tr %tr
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
%th Read %th Read
%th Git %th Git
%th Manage %th Manage
%th Added %th Added
%th %th
%th %th
%th %th
- members.each do |tm| - members.each do |tm|
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
%b Since: %b Since:
= @admin_team_member.updated_at = @admin_team_member.updated_at
.span-10 .span-10
.span-6 .span-6
%b Access: %b Access:
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
.field .field
= f.label :twitter = f.label :twitter
%br %br
= f.text_field :twitter = f.text_field :twitter
.clear .clear
%br %br
.actions .actions
......
...@@ -2,5 +2,4 @@ ...@@ -2,5 +2,4 @@
= render 'form' = render 'form'
= link_to 'Back', admin_users_path, :class => "right lbutton" = link_to 'Back', admin_users_path, :class => "right lbutton"
...@@ -19,28 +19,27 @@ ...@@ -19,28 +19,27 @@
= @admin_user.skype = @admin_user.skype
%p %p
%b LinkedIn: %b LinkedIn:
= @admin_user.linkedin = @admin_user.linkedin
%p %p
%b Twitter: %b Twitter:
= @admin_user.twitter = @admin_user.twitter
.clear .clear
= link_to 'Edit', edit_admin_user_path(@admin_user) = link_to 'Edit', edit_admin_user_path(@admin_user)
\| \|
= link_to 'Back', admin_users_path = link_to 'Back', admin_users_path
.span-14 .span-14
%h2 Projects %h2 Projects
%table.round-borders %table.round-borders
%tr %tr
%th Name %th Name
%th Added %th Added
%th Web %th Web
%th Git %th Git
%th Admin %th Admin
%th %th
- @admin_user.users_projects.each do |tm| - @admin_user.users_projects.each do |tm|
- project = tm.project - project = tm.project
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
.diff_file_header .diff_file_header
- if diff.deleted_file - if diff.deleted_file
%strong{:id => "#{diff.b_path}"}= diff.a_path %strong{:id => "#{diff.b_path}"}= diff.a_path
- else - else
= link_to tree_file_project_path(@project, @commit.id, diff.b_path) do = link_to tree_file_project_path(@project, @commit.id, diff.b_path) do
%strong{:id => "#{diff.b_path}"}= diff.b_path %strong{:id => "#{diff.b_path}"}= diff.b_path
%br/ %br/
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
.diff_file_content_image .diff_file_content_image
%img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
- else - else
%p %p
%center No preview for this file type %center No preview for this file type
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
%h1 Listing commits %h1 Listing commits
%div{:id => dom_id(@project)} %div{:id => dom_id(@project)}
= render "commits" = render "commits"
%br/ %br/
\ No newline at end of file
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
= diff_line(line, line_new, line_old) = diff_line(line, line_new, line_old)
- if line[0] == "+" - if line[0] == "+"
- line_new += 1 - line_new += 1
- elsif - elsif
- line[0] == "-" - line[0] == "-"
- line_old += 1 - line_old += 1
- else - else
- line_new += 1 - line_new += 1
- line_old += 1 - line_old += 1
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
side.html("#{escape_javascript(render "commits/show")}"); side.html("#{escape_javascript(render "commits/show")}");
$("##{dom_id(@project)}").parent().append(side); $("##{dom_id(@project)}").parent().append(side);
$("##{dom_id(@project)}").addClass("span-14"); $("##{dom_id(@project)}").addClass("span-14");
:plain :plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
<div><%= f.submit "Resend confirmation instructions" %></div> <div><%= f.submit "Resend confirmation instructions" %></div>
<% end %> <% end %>
<%= render :partial => "devise/shared/links" %> <%= render :partial => "devise/shared/links" %>
\ No newline at end of file
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
<div><%= f.submit "Change my password" %></div> <div><%= f.submit "Change my password" %></div>
<% end %> <% end %>
<%= render :partial => "devise/shared/links" %> <%= render :partial => "devise/shared/links" %>
\ No newline at end of file
...@@ -22,4 +22,4 @@ ...@@ -22,4 +22,4 @@
<%- resource_class.omniauth_providers.each do |provider| %> <%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br /> <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%> <% end -%>
<% end -%> <% end -%>
\ No newline at end of file
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
<div><%= f.submit "Resend unlock instructions" %></div> <div><%= f.submit "Resend unlock instructions" %></div>
<% end %> <% end %>
<%= render :partial => "devise/shared/links" %> <%= render :partial => "devise/shared/links" %>
\ No newline at end of file
%table.round-borders#issues-table %table.round-borders#issues-table
%tr %tr
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0" - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%th %th
%th Assignee %th Assignee
%th ID %th ID
%th Title %th Title
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
-#notes -#notes
%td %td
- if can? current_user, :write_issue, @project - if can? current_user, :write_issue, @project
= form_for([@project, issue], :remote => true) do |f| = form_for([@project, issue], :remote => true) do |f|
= f.check_box :closed, :onclick => "$(this).parent().submit();" = f.check_box :closed, :onclick => "$(this).parent().submit();"
= hidden_field_tag :status_only, true = hidden_field_tag :status_only, true
- else - else
= check_box_tag "closed", 1, issue.closed, :disabled => true = check_box_tag "closed", 1, issue.closed, :disabled => true
%td %td
- if can?(current_user, :admin_issue, @project) || issue.author == current_user - if can?(current_user, :admin_issue, @project) || issue.author == current_user
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
.span-2 .span-2
= radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues" = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues"
= label_tag "my_issues","To Me" = label_tag "my_issues","To Me"
.span-2 .span-2
= radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues" = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues"
= label_tag "all_issues","All" = label_tag "all_issues","All"
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#issues-table-holder= render "issues" #issues-table-holder= render "issues"
%br %br
:javascript :javascript
$('.delete-issue').live('ajax:success', function() { $('.delete-issue').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); }); $(this).closest('tr').fadeOut(); });
function setSortable(){ function setSortable(){
$('#issues-table>tbody').sortable({ $('#issues-table>tbody').sortable({
axis: 'y', axis: 'y',
......
...@@ -8,24 +8,24 @@ ...@@ -8,24 +8,24 @@
.span-8 .span-8
- if @issue.closed - if @issue.closed
%center.success Closed %center.success Closed
- else - else
%center.error Open %center.error Open
%table.round-borders %table.round-borders
%tr %tr
%td Title: %td Title:
%td %td
= truncate html_escape(@issue.title) = truncate html_escape(@issue.title)
%tr %tr
%td Project %td Project
%td %td
%strong= @issue.project.name %strong= @issue.project.name
%tr %tr
%td Author: %td Author:
%td %td
= image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;" = image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= @issue.author.name = @issue.author.name
%tr %tr
%td Assignee: %td Assignee:
%td %td
= image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= @issue.assignee.name = @issue.assignee.name
...@@ -33,12 +33,11 @@ ...@@ -33,12 +33,11 @@
%td Closed? %td Closed?
%td %td
- if can? current_user, :write_issue, @project - if can? current_user, :write_issue, @project
= form_for([@project, @issue]) do |f| = form_for([@project, @issue]) do |f|
= f.check_box :closed, :onclick => "$(this).parent().submit();" = f.check_box :closed, :onclick => "$(this).parent().submit();"
= hidden_field_tag :status_only, true = hidden_field_tag :status_only, true
- else - else
= check_box_tag "closed", 1, @issue.closed, :disabled => true = check_box_tag "closed", 1, @issue.closed, :disabled => true
.clear .clear
:plain :plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- if @issue.valid? - if @issue.valid?
:plain :plain
$("##{dom_id(@issue)}").fadeOut(); $("##{dom_id(@issue)}").fadeOut();
- else - else
- if @issue.valid? - if @issue.valid?
:plain :plain
$("#edit_issue_dialog").dialog("close"); $("#edit_issue_dialog").dialog("close");
......
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
= render(:partial => 'show', :locals => {:key => key}) = render(:partial => 'show', :locals => {:key => key})
:javascript :javascript
$('.delete-key').live('ajax:success', function() { $('.delete-key').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); }); $(this).closest('tr').fadeOut(); });
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
%h4= text %h4= text
:javascript :javascript
$(function(){ $(function(){
$("#flash_container").slideDown("slow"); $("#flash_container").slideDown("slow");
$("#flash_container").click(function(){ $("#flash_container").click(function(){
$(this).slideUp("slow"); $(this).slideUp("slow");
}); });
setTimeout("hideFlash()",2000); setTimeout("hideFlash()",2000);
}); });
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
</div> </div>
</div> </div>
<% if current_user %> <% if current_user %>
<%= javascript_tag do %> <%= javascript_tag do %>
$(function() { $(function() {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
= check_box_tag :notify, 1, true = check_box_tag :notify, 1, true
= label_tag :notify, "Notify project team about your note" = label_tag :notify, "Notify project team about your note"
.clear .clear
%br %br
= f.submit 'Add note', :class => "lbutton vm", :id => "submit_note" = f.submit 'Add note', :class => "lbutton vm", :id => "submit_note"
- if controller.action_name == "wall" - if controller.action_name == "wall"
%ul#notes-list= render "notes/notes_list" %ul#notes-list= render "notes/notes_list"
- else - else
%ul#notes-list= render "notes/notes_list" %ul#notes-list= render "notes/notes_list"
%br %br
%br %br
...@@ -9,17 +9,16 @@ ...@@ -9,17 +9,16 @@
= render "notes/form" = render "notes/form"
:javascript :javascript
$('.delete-note').live('ajax:success', function() { $('.delete-note').live('ajax:success', function() {
$(this).closest('li').fadeOut(); }); $(this).closest('li').fadeOut(); });
$("#new_note").live("ajax:before", function(){ $("#new_note").live("ajax:before", function(){
$("#submit_note").attr("disabled", "disabled"); $("#submit_note").attr("disabled", "disabled");
}) })
$("#new_note").live("ajax:complete", function(){ $("#new_note").live("ajax:complete", function(){
$("#submit_note").removeAttr("disabled"); $("#submit_note").removeAttr("disabled");
}) })
- if ["issues", "projects"].include?(controller.controller_name) - if ["issues", "projects"].include?(controller.controller_name)
:javascript :javascript
......
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
:plain :plain
$("#new_note").replaceWith("#{escape_javascript(render('form'))}"); $("#new_note").replaceWith("#{escape_javascript(render('form'))}");
:plain :plain
$("#submit_note").removeAttr("disabled"); $("#submit_note").removeAttr("disabled");
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
%td{:align => "left", :style => "padding: 20px 0 0;"} %td{:align => "left", :style => "padding: 20px 0 0;"}
%h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
= link_to project_issue_url(@project, @issue) do = link_to project_issue_url(@project, @issue) do
= "Issue ##{@issue.id.to_s}" = "Issue ##{@issue.id.to_s}"
= truncate(@issue.title, :length => 45) = truncate(@issue.title, :length => 45)
%br %br
%cite{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} %cite{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "}
= @issue.content = @issue.content
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
%td{:align => "left", :style => "padding: 20px 0 0;"} %td{:align => "left", :style => "padding: 20px 0 0;"}
%h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
Hi #{@user.name}! Hi #{@user.name}!
%p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "}
Administrator created account for you. Now you are a member of company gitlab application. Administrator created account for you. Now you are a member of company gitlab application.
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
%td{:align => "left", :style => "padding: 20px 0 0;"} %td{:align => "left", :style => "padding: 20px 0 0;"}
%h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
New comment - New comment -
= link_to project_issue_url(@project, @issue, :anchor => "note_#{@note.id}") do = link_to project_issue_url(@project, @issue, :anchor => "note_#{@note.id}") do
= "Issue ##{@issue.id.to_s}" = "Issue ##{@issue.id.to_s}"
= truncate(@issue.title, :length => 35) = truncate(@issue.title, :length => 35)
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
%tr %tr
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
%td{:align => "left", :style => "padding: 20px 0 0;"} %td{:align => "left", :style => "padding: 20px 0 0;"}
%h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
New message on New message on
= link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}") = link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}")
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
%tr %tr
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
%td %td
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
%tr %tr
%td %td
.left= f.label :code .left= f.label :code
%cite.right http://yourserver/ %cite.right http://yourserver/
%td= f.text_field :code, :placeholder => "example" %td= f.text_field :code, :placeholder => "example"
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
= image_tag "ajax-loader.gif", :class => "append-bottom" = image_tag "ajax-loader.gif", :class => "append-bottom"
- if @project.new_record? - if @project.new_record?
%h3.prepend-top Creating project &amp; repository. Please wait for few minutes %h3.prepend-top Creating project &amp; repository. Please wait for few minutes
- else - else
%h3.prepend-top Updating project &amp; repository. Please wait for few minutes %h3.prepend-top Updating project &amp; repository. Please wait for few minutes
:javascript :javascript
$('.new_project, .edit_project').bind('ajax:before', function() { $('.new_project, .edit_project').bind('ajax:before', function() {
$(this).find(".form_content").hide(); $(this).find(".form_content").hide();
$('.ajax_loader').show(); $('.ajax_loader').show();
}); });
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
%td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled %td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled
%td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled %td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled
%td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled %td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled
%td %td
-if can? current_user, :admin_project, project -if can? current_user, :admin_project, project
= link_to 'Edit', edit_project_path(project), :class => "lbutton positive" = link_to 'Edit', edit_project_path(project), :class => "lbutton positive"
%br %br
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
$(".list").toggle(); $(".list").toggle();
if($(".tile").is(":visible")){ if($(".tile").is(":visible")){
$.cookie('project_view', 'tile', { expires: 14 }); $.cookie('project_view', 'tile', { expires: 14 });
} else { } else {
$.cookie('project_view', 'list', { expires: 14 }); $.cookie('project_view', 'list', { expires: 14 });
} }
} }
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%p{:style => "margin-bottom: 3px;"} %p{:style => "margin-bottom: 3px;"}
%strong %strong
= link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id) = link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id)
%span %span
%span.author %span.author
= commit.author.name.force_encoding("UTF-8") = commit.author.name.force_encoding("UTF-8")
......
...@@ -14,5 +14,5 @@ ...@@ -14,5 +14,5 @@
= render(:partial => 'team_members/show', :locals => {:member => up}) = render(:partial => 'team_members/show', :locals => {:member => up})
:javascript :javascript
$('.delete-team-member').live('ajax:success', function() { $('.delete-team-member').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); }); $(this).closest('tr').fadeOut(); });
...@@ -40,7 +40,7 @@ eos ...@@ -40,7 +40,7 @@ eos
<p> <p>
Be careful! <br/> Be careful! <br/>
Project cant be recovered after destroy.</p> Project cant be recovered after destroy.</p>
<%= link_to 'Destroy', @project, <%= link_to 'Destroy', @project,
:confirm => 'Are you sure?', :method => :delete, :confirm => 'Are you sure?', :method => :delete,
:class => "left button negative span-6", :style => "text-align:center" %> :class => "left button negative span-6", :style => "text-align:center" %>
<div class="clear"></div> <div class="clear"></div>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= render "tile" = render "tile"
%div{:class => "list", :style => view_mode_style("list")} %div{:class => "list", :style => view_mode_style("list")}
= render "list" = render "list"
- else - else
%center.prepend-top %center.prepend-top
%h2 %h2
%cite Nothing here %cite Nothing here
:plain :plain
$("#tree-holder table").hide("slide", { direction: "left" }, 150, function(){ $("#tree-holder table").hide("slide", { direction: "left" }, 150, function(){
$("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}");
$("#tree-holder table").show("slide", { direction: "right" }, 150); $("#tree-holder table").show("slide", { direction: "right" }, 150);
}); });
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
%hr %hr
= render "notes/notes" = render "notes/notes"
:javascript :javascript
$(function(){ $(function(){
$("#note_note").live("click", function(){ $("#note_note").live("click", function(){
$(this).css("height", "100px"); $(this).css("height", "100px");
......
:plain :plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
= f.label :content, "Code" = f.label :content, "Code"
%br %br
= f.text_area :content, :style => "height:240px;width:932px;" = f.text_area :content, :style => "height:240px;width:932px;"
.actions.prepend-top .actions.prepend-top
= f.submit 'Save', :class => "lbutton vm" = f.submit 'Save', :class => "lbutton vm"
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
%th %th
= render @snippets = render @snippets
:javascript :javascript
$('.delete-snippet').live('ajax:success', function() { $('.delete-snippet').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); }); $(this).closest('tr').fadeOut(); });
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
%td= truncate user.email, :lenght => 16 %td= truncate user.email, :lenght => 16
- if can? current_user, :admin_project, @project - if can? current_user, :admin_project, @project
= form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f| = form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f|
%td= f.check_box :read, :onclick => "$(this.form).submit();" %td= f.check_box :read, :onclick => "$(this.form).submit();"
%td= f.check_box :write, :onclick => "$(this.form).submit();" %td= f.check_box :write, :onclick => "$(this.form).submit();"
%td= f.check_box :admin, :onclick => "$(this.form).submit();" %td= f.check_box :admin, :onclick => "$(this.form).submit();"
- else - else
%td= check_box_tag "read", 1, member.read, :disabled => :disabled %td= check_box_tag "read", 1, member.read, :disabled => :disabled
%td= check_box_tag "commit", 1, member.write, :disabled => :disabled %td= check_box_tag "commit", 1, member.write, :disabled => :disabled
%td= check_box_tag "admin", 1, member.admin, :disabled => :disabled %td= check_box_tag "admin", 1, member.admin, :disabled => :disabled
......
...@@ -25,4 +25,3 @@ ...@@ -25,4 +25,3 @@
%b Twitter: %b Twitter:
= user.twitter = user.twitter
...@@ -58,7 +58,6 @@ Gitlab::Application.configure do ...@@ -58,7 +58,6 @@ Gitlab::Application.configure do
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :sendmail config.action_mailer.delivery_method = :sendmail
# Defaults to: # Defaults to:
# # config.action_mailer.sendmail_settings = { # # config.action_mailer.sendmail_settings = {
......
...@@ -7,6 +7,6 @@ Grit::Blob.class_eval do ...@@ -7,6 +7,6 @@ Grit::Blob.class_eval do
include Utils::Colorize include Utils::Colorize
end end
Grit::Commit.class_eval do Grit::Commit.class_eval do
include CommitExt include CommitExt
end end
Gitlab::Application.routes.draw do Gitlab::Application.routes.draw do
namespace :admin do namespace :admin do
resources :users resources :users
resources :projects resources :projects
resources :team_members resources :team_members
...@@ -10,7 +10,7 @@ Gitlab::Application.routes.draw do ...@@ -10,7 +10,7 @@ Gitlab::Application.routes.draw do
root :to => "users#index" root :to => "users#index"
end end
get "errors/gitosis" get "errors/gitosis"
get "profile/password", :to => "profile#password" get "profile/password", :to => "profile#password"
put "profile/password", :to => "profile#password_update" put "profile/password", :to => "profile#password_update"
put "profile/edit", :to => "profile#social_update" 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
resources :keys resources :keys
devise_for :users devise_for :users
resources :projects, :except => [:new, :create, :index], :path => "/" do resources :projects, :except => [:new, :create, :index], :path => "/" do
member do member do
get "tree" get "tree"
get "blob" get "blob"
get "team" get "team"
...@@ -32,7 +32,7 @@ Gitlab::Application.routes.draw do ...@@ -32,7 +32,7 @@ Gitlab::Application.routes.draw do
get "tree/:commit_id" => "projects#tree" get "tree/:commit_id" => "projects#tree"
get "tree/:commit_id/:path" => "projects#tree", get "tree/:commit_id/:path" => "projects#tree",
:as => :tree_file, :as => :tree_file,
:constraints => { :constraints => {
:id => /[a-zA-Z0-9_\-]+/, :id => /[a-zA-Z0-9_\-]+/,
:commit_id => /[a-zA-Z0-9]+/, :commit_id => /[a-zA-Z0-9]+/,
:path => /.*/ :path => /.*/
......
...@@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration ...@@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable # t.token_authenticatable
t.timestamps t.timestamps
end end
......
...@@ -17,7 +17,7 @@ module Color ...@@ -17,7 +17,7 @@ module Color
def command(string) def command(string)
`#{string}` `#{string}`
if $?.to_i > 0 if $?.to_i > 0
puts red " == #{string} - FAIL" puts red " == #{string} - FAIL"
puts red " == Error during configure" puts red " == Error during configure"
exit exit
......
module CommitExt module CommitExt
def safe_message def safe_message
message.encode("UTF-8", message.encode("UTF-8",
:invalid => :replace, :invalid => :replace,
:undef => :replace, :undef => :replace,
:universal_newline => true, :universal_newline => true,
:replace => "") :replace => "")
rescue rescue
"-- invalid encoding for commit message" "-- invalid encoding for commit message"
end end
end end
...@@ -33,7 +33,7 @@ class FileSizeValidator < ActiveModel::EachValidator ...@@ -33,7 +33,7 @@ class FileSizeValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value) def validate_each(record, attribute, value)
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String) value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
CHECKS.each do |key, validity_check| CHECKS.each do |key, validity_check|
...@@ -53,7 +53,7 @@ class FileSizeValidator < ActiveModel::EachValidator ...@@ -53,7 +53,7 @@ class FileSizeValidator < ActiveModel::EachValidator
record.errors.add(attribute, MESSAGES[key], errors_options) record.errors.add(attribute, MESSAGES[key], errors_options)
end end
end end
def help def help
Helper.instance Helper.instance
end end
......
module Utils module Utils
module FileHelper module FileHelper
def binary?(string) def binary?(string)
string.each_byte do |x| string.each_byte do |x|
x.nonzero? or return true x.nonzero? or return true
end end
false false
end end
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
text-decoration: none; text-decoration: none;
} }
#page { #page {
background-color: #f0f0f0; background-color: #f0f0f0;
width: 750px; width: 750px;
...@@ -57,7 +56,6 @@ ...@@ -57,7 +56,6 @@
padding-right: 30px; padding-right: 30px;
} }
#header { #header {
background-image: url("/assets/rails.png"); background-image: url("/assets/rails.png");
background-repeat: no-repeat; background-repeat: no-repeat;
...@@ -71,7 +69,6 @@ ...@@ -71,7 +69,6 @@
font-size: 16px; font-size: 16px;
} }
#about h3 { #about h3 {
margin: 0; margin: 0;
margin-bottom: 10px; margin-bottom: 10px;
...@@ -112,7 +109,6 @@ ...@@ -112,7 +109,6 @@
padding: 10px; padding: 10px;
} }
#getting-started { #getting-started {
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
margin-top: 25px; margin-top: 25px;
...@@ -149,7 +145,6 @@ ...@@ -149,7 +145,6 @@
font-size: 13px; font-size: 13px;
} }
#sidebar ul { #sidebar ul {
margin-left: 0; margin-left: 0;
padding-left: 0; padding-left: 0;
......
class Factory class Factory
@factories = {} @factories = {}
class << self class << self
def add(name, klass, &block) def add(name, klass, &block)
@factories[name] = [klass, block] @factories[name] = [klass, block]
end end
...@@ -13,10 +13,10 @@ class Factory ...@@ -13,10 +13,10 @@ class Factory
def new(name, opts) def new(name, opts)
factory = @factories[name] factory = @factories[name]
factory[0].new.tap do |obj| factory[0].new.tap do |obj|
factory[1].call(obj) factory[1].call(obj)
end.tap do |obj| end.tap do |obj|
opts.each do |k, opt| opts.each do |k, opt|
obj.send("#{k}=", opt) obj.send("#{k}=", opt)
end end
end end
end end
......
...@@ -14,7 +14,7 @@ describe Issue do ...@@ -14,7 +14,7 @@ describe Issue do
it { should validate_presence_of(:assignee_id) } it { should validate_presence_of(:assignee_id) }
end end
describe "Scope" do describe "Scope" do
it { Issue.should respond_to :closed } it { Issue.should respond_to :closed }
it { Issue.should respond_to :opened } it { Issue.should respond_to :opened }
end end
......
...@@ -10,7 +10,7 @@ describe Key do ...@@ -10,7 +10,7 @@ describe Key do
it { should validate_presence_of(:key) } it { should validate_presence_of(:key) }
end end
describe "Methods" do describe "Methods" do
it { should respond_to :projects } it { should respond_to :projects }
end end
......
...@@ -13,8 +13,8 @@ describe Note do ...@@ -13,8 +13,8 @@ describe Note do
it { Factory.create(:note, it { Factory.create(:note,
:project => Factory.create(:project)).should be_valid } :project => Factory.create(:project)).should be_valid }
describe :authorization do describe :authorization do
before do before do
@p1 = Factory :project @p1 = Factory :project
@p2 = Factory :project, :code => "alien", :path => "legit_1" @p2 = Factory :project, :code => "alien", :path => "legit_1"
@u1 = Factory :user @u1 = Factory :user
...@@ -24,10 +24,10 @@ describe Note do ...@@ -24,10 +24,10 @@ describe Note do
@abilities << Ability @abilities << Ability
end end
describe :read do describe :read do
before do before do
@p1.users_projects.create(:user => @u1, :read => false) @p1.users_projects.create(:user => @u1, :read => false)
@p1.users_projects.create(:user => @u2, :read => true) @p1.users_projects.create(:user => @u2, :read => true)
@p2.users_projects.create(:user => @u3, :read => true) @p2.users_projects.create(:user => @u3, :read => true)
end end
...@@ -36,11 +36,11 @@ describe Note do ...@@ -36,11 +36,11 @@ describe Note do
it { @abilities.allowed?(@u3, :read_note, @p1).should be_false } it { @abilities.allowed?(@u3, :read_note, @p1).should be_false }
end end
describe :write do describe :write do
before do before do
@p1.users_projects.create(:user => @u1, :write => false) @p1.users_projects.create(:user => @u1, :write => false)
@p1.users_projects.create(:user => @u2, :write => true) @p1.users_projects.create(:user => @u2, :write => true)
@p2.users_projects.create(:user => @u3, :write => true) @p2.users_projects.create(:user => @u3, :write => true)
end end
it { @abilities.allowed?(@u1, :write_note, @p1).should be_false } it { @abilities.allowed?(@u1, :write_note, @p1).should be_false }
...@@ -48,11 +48,11 @@ describe Note do ...@@ -48,11 +48,11 @@ describe Note do
it { @abilities.allowed?(@u3, :write_note, @p1).should be_false } it { @abilities.allowed?(@u3, :write_note, @p1).should be_false }
end end
describe :admin do describe :admin do
before do before do
@p1.users_projects.create(:user => @u1, :admin => false) @p1.users_projects.create(:user => @u1, :admin => false)
@p1.users_projects.create(:user => @u2, :admin => true) @p1.users_projects.create(:user => @u2, :admin => true)
@p2.users_projects.create(:user => @u3, :admin => true) @p2.users_projects.create(:user => @u3, :admin => true)
end end
it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false } it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false }
......
require 'spec_helper' require 'spec_helper'
describe Project do describe Project do
describe :authorization do describe :authorization do
before do before do
@p1 = Factory :project @p1 = Factory :project
@u1 = Factory :user @u1 = Factory :user
@u2 = Factory :user @u2 = Factory :user
...@@ -10,30 +10,30 @@ describe Project do ...@@ -10,30 +10,30 @@ describe Project do
@abilities << Ability @abilities << Ability
end end
describe :read do describe :read do
before do before do
@p1.users_projects.create(:project => @p1, :user => @u1, :read => false) @p1.users_projects.create(:project => @p1, :user => @u1, :read => false)
@p1.users_projects.create(:project => @p1, :user => @u2, :read => true) @p1.users_projects.create(:project => @p1, :user => @u2, :read => true)
end end
it { @abilities.allowed?(@u1, :read_project, @p1).should be_false } it { @abilities.allowed?(@u1, :read_project, @p1).should be_false }
it { @abilities.allowed?(@u2, :read_project, @p1).should be_true } it { @abilities.allowed?(@u2, :read_project, @p1).should be_true }
end end
describe :write do describe :write do
before do before do
@p1.users_projects.create(:project => @p1, :user => @u1, :write => false) @p1.users_projects.create(:project => @p1, :user => @u1, :write => false)
@p1.users_projects.create(:project => @p1, :user => @u2, :write => true) @p1.users_projects.create(:project => @p1, :user => @u2, :write => true)
end end
it { @abilities.allowed?(@u1, :write_project, @p1).should be_false } it { @abilities.allowed?(@u1, :write_project, @p1).should be_false }
it { @abilities.allowed?(@u2, :write_project, @p1).should be_true } it { @abilities.allowed?(@u2, :write_project, @p1).should be_true }
end end
describe :admin do describe :admin do
before do before do
@p1.users_projects.create(:project => @p1, :user => @u1, :admin => false) @p1.users_projects.create(:project => @p1, :user => @u1, :admin => false)
@p1.users_projects.create(:project => @p1, :user => @u2, :admin => true) @p1.users_projects.create(:project => @p1, :user => @u2, :admin => true)
end end
it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false } it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false }
......
...@@ -40,20 +40,20 @@ describe Project do ...@@ -40,20 +40,20 @@ describe Project do
should_not allow_value("gitosis-admin").for(:path) should_not allow_value("gitosis-admin").for(:path)
end end
it "should return valid url to repo" do it "should return valid url to repo" do
project = Project.new(:path => "somewhere") project = Project.new(:path => "somewhere")
project.url_to_repo.should == "git@localhost:somewhere.git" project.url_to_repo.should == "git@localhost:somewhere.git"
end end
it "should return path to repo" do it "should return path to repo" do
project = Project.new(:path => "somewhere") project = Project.new(:path => "somewhere")
project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere")
end end
describe :valid_repo? do describe :valid_repo? do
it "should be valid repo" do it "should be valid repo" do
project = Factory :project project = Factory :project
project.valid_repo?.should be_true project.valid_repo?.should be_true
end end
it "should be invalid repo" do it "should be invalid repo" do
...@@ -62,43 +62,43 @@ describe Project do ...@@ -62,43 +62,43 @@ describe Project do
end end
end end
describe "Git methods" do describe "Git methods" do
let(:project) { Factory :project } let(:project) { Factory :project }
describe :repo do describe :repo do
it "should return valid repo" do it "should return valid repo" do
project.repo.should be_kind_of(Grit::Repo) project.repo.should be_kind_of(Grit::Repo)
end end
it "should return nil" do it "should return nil" do
lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError) lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError)
end end
it "should return nil" do it "should return nil" do
lambda { Project.new.repo }.should raise_error(TypeError) lambda { Project.new.repo }.should raise_error(TypeError)
end end
end end
describe :commit do describe :commit do
it "should return first head commit if without params" do it "should return first head commit if without params" do
project.commit.id.should == project.repo.commits.first.id project.commit.id.should == project.repo.commits.first.id
end end
it "should return valid commit" do it "should return valid commit" do
project.commit(ValidCommit::ID).should be_valid_commit project.commit(ValidCommit::ID).should be_valid_commit
end end
it "should return nil" do it "should return nil" do
project.commit("+123_4532530XYZ").should be_nil project.commit("+123_4532530XYZ").should be_nil
end end
end end
describe :tree do describe :tree do
before do before do
@commit = project.commit(ValidCommit::ID) @commit = project.commit(ValidCommit::ID)
end end
it "should raise error w/o arguments" do it "should raise error w/o arguments" do
lambda { project.tree }.should raise_error lambda { project.tree }.should raise_error
end end
......
...@@ -14,7 +14,7 @@ describe User do ...@@ -14,7 +14,7 @@ describe User do
it { should respond_to(:name) } it { should respond_to(:name) }
end end
it "should return valid identifier" do it "should return valid identifier" do
user = User.new(:email => "test@mail.com") user = User.new(:email => "test@mail.com")
user.identifier.should == "test_mail.com" user.identifier.should == "test_mail.com"
end end
......
...@@ -11,7 +11,7 @@ describe UsersProject do ...@@ -11,7 +11,7 @@ describe UsersProject do
it { should validate_presence_of(:project_id) } it { should validate_presence_of(:project_id) }
end end
describe "Delegate methods" do describe "Delegate methods" do
it { should respond_to(:user_name) } it { should respond_to(:user_name) }
it { should respond_to(:user_email) } it { should respond_to(:user_email) }
end end
......
# Stubbing Project <-> gitosis path # Stubbing Project <-> gitosis path
# create project using Factory only # create project using Factory only
class Project class Project
def update_gitosis_project def update_gitosis_project
true true
end end
...@@ -9,12 +9,12 @@ class Project ...@@ -9,12 +9,12 @@ class Project
true true
end end
def path_to_repo def path_to_repo
File.join(Rails.root, "tmp", "tests", path) File.join(Rails.root, "tmp", "tests", path)
end end
end end
class Key class Key
def update_gitosis def update_gitosis
true true
end end
......
require 'spec_helper' require 'spec_helper'
describe "Admin::Projects" do describe "Admin::Projects" do
before do before do
@project = Factory :project, @project = Factory :project,
:name => "LeGiT", :name => "LeGiT",
:code => "LGT" :code => "LGT"
...@@ -9,7 +9,7 @@ describe "Admin::Projects" do ...@@ -9,7 +9,7 @@ describe "Admin::Projects" do
end end
describe "GET /admin/projects" do describe "GET /admin/projects" do
before do before do
visit admin_projects_path visit admin_projects_path
end end
...@@ -17,49 +17,49 @@ describe "Admin::Projects" do ...@@ -17,49 +17,49 @@ describe "Admin::Projects" do
current_path.should == admin_projects_path current_path.should == admin_projects_path
end end
it "should have projects list" do it "should have projects list" do
page.should have_content(@project.code) page.should have_content(@project.code)
page.should have_content(@project.name) page.should have_content(@project.name)
end end
end end
describe "GET /admin/projects/:id" do describe "GET /admin/projects/:id" do
before do before do
visit admin_projects_path visit admin_projects_path
click_link "Show" click_link "Show"
end end
it "should have project info" do it "should have project info" do
page.should have_content(@project.code) page.should have_content(@project.code)
page.should have_content(@project.name) page.should have_content(@project.name)
end end
end end
describe "GET /admin/projects/:id/edit" do describe "GET /admin/projects/:id/edit" do
before do before do
visit admin_projects_path visit admin_projects_path
click_link "edit_project_#{@project.id}" click_link "edit_project_#{@project.id}"
end end
it "should have project edit page" do it "should have project edit page" do
page.should have_content("Name") page.should have_content("Name")
page.should have_content("Code") page.should have_content("Code")
end end
describe "Update project" do describe "Update project" do
before do before do
fill_in "project_name", :with => "Big Bang" fill_in "project_name", :with => "Big Bang"
fill_in "project_code", :with => "BB1" fill_in "project_code", :with => "BB1"
click_button "Save" click_button "Save"
@project.reload @project.reload
end end
it "should show page with new data" do it "should show page with new data" do
page.should have_content("BB1") page.should have_content("BB1")
page.should have_content("Big Bang") page.should have_content("Big Bang")
end end
it "should change project entry" do it "should change project entry" do
@project.name.should == "Big Bang" @project.name.should == "Big Bang"
@project.code.should == "BB1" @project.code.should == "BB1"
end end
...@@ -67,24 +67,24 @@ describe "Admin::Projects" do ...@@ -67,24 +67,24 @@ describe "Admin::Projects" do
end end
describe "GET /admin/projects/new" do describe "GET /admin/projects/new" do
before do before do
visit admin_projects_path visit admin_projects_path
click_link "New Project" click_link "New Project"
end end
it "should be correct path" do it "should be correct path" do
current_path.should == new_admin_project_path current_path.should == new_admin_project_path
end end
it "should have labels for new project" do it "should have labels for new project" do
page.should have_content("Name") page.should have_content("Name")
page.should have_content("Path") page.should have_content("Path")
page.should have_content("Description") page.should have_content("Description")
end end
end end
describe "POST /admin/projects" do describe "POST /admin/projects" do
before do before do
visit new_admin_project_path visit new_admin_project_path
fill_in 'Name', :with => 'NewProject' fill_in 'Name', :with => 'NewProject'
fill_in 'Code', :with => 'NPR' fill_in 'Code', :with => 'NPR'
......
...@@ -4,7 +4,7 @@ describe "Admin::Users" do ...@@ -4,7 +4,7 @@ describe "Admin::Users" do
before { login_as :admin } before { login_as :admin }
describe "GET /admin/users" do describe "GET /admin/users" do
before do before do
visit admin_users_path visit admin_users_path
end end
...@@ -12,14 +12,14 @@ describe "Admin::Users" do ...@@ -12,14 +12,14 @@ describe "Admin::Users" do
current_path.should == admin_users_path current_path.should == admin_users_path
end end
it "should have users list" do it "should have users list" do
page.should have_content(@user.email) page.should have_content(@user.email)
page.should have_content(@user.name) page.should have_content(@user.name)
end end
end end
describe "GET /admin/users/new" do describe "GET /admin/users/new" do
before do before do
@password = "123ABC" @password = "123ABC"
visit new_admin_user_path visit new_admin_user_path
fill_in "user_name", :with => "Big Bang" fill_in "user_name", :with => "Big Bang"
...@@ -28,23 +28,23 @@ describe "Admin::Users" do ...@@ -28,23 +28,23 @@ describe "Admin::Users" do
fill_in "user_password_confirmation", :with => @password fill_in "user_password_confirmation", :with => @password
end end
it "should create new user" do it "should create new user" do
expect { click_button "Save" }.to change {User.count}.by(1) expect { click_button "Save" }.to change {User.count}.by(1)
end end
it "should create user with valid data" do it "should create user with valid data" do
click_button "Save" click_button "Save"
user = User.last user = User.last
user.name.should == "Big Bang" user.name.should == "Big Bang"
user.email.should == "bigbang@mail.com" user.email.should == "bigbang@mail.com"
end end
it "should call send mail" do it "should call send mail" do
Notify.should_receive(:new_user_email).and_return(stub(:deliver => true)) Notify.should_receive(:new_user_email).and_return(stub(:deliver => true))
click_button "Save" click_button "Save"
end end
it "should send valid email to user with email & password" do it "should send valid email to user with email & password" do
click_button "Save" click_button "Save"
user = User.last user = User.last
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
...@@ -54,45 +54,45 @@ describe "Admin::Users" do ...@@ -54,45 +54,45 @@ describe "Admin::Users" do
end end
end end
describe "GET /admin/users/:id" do describe "GET /admin/users/:id" do
before do before do
visit admin_users_path visit admin_users_path
click_link "Show" click_link "Show"
end end
it "should have user info" do it "should have user info" do
page.should have_content(@user.email) page.should have_content(@user.email)
page.should have_content(@user.name) page.should have_content(@user.name)
page.should have_content(@user.is_admin?) page.should have_content(@user.is_admin?)
end end
end end
describe "GET /admin/users/:id/edit" do describe "GET /admin/users/:id/edit" do
before do before do
@simple_user = Factory :user @simple_user = Factory :user
visit admin_users_path visit admin_users_path
click_link "edit_user_#{@simple_user.id}" click_link "edit_user_#{@simple_user.id}"
end end
it "should have user edit page" do it "should have user edit page" do
page.should have_content("Name") page.should have_content("Name")
page.should have_content("Password") page.should have_content("Password")
end end
describe "Update user" do describe "Update user" do
before do before do
fill_in "user_name", :with => "Big Bang" fill_in "user_name", :with => "Big Bang"
fill_in "user_email", :with => "bigbang@mail.com" fill_in "user_email", :with => "bigbang@mail.com"
check "user_admin" check "user_admin"
click_button "Save" click_button "Save"
end end
it "should show page with new data" do it "should show page with new data" do
page.should have_content("bigbang@mail.com") page.should have_content("bigbang@mail.com")
page.should have_content("Big Bang") page.should have_content("Big Bang")
end end
it "should change user entry" do it "should change user entry" do
@simple_user.reload @simple_user.reload
@simple_user.name.should == "Big Bang" @simple_user.name.should == "Big Bang"
@simple_user.is_admin?.should be_true @simple_user.is_admin?.should be_true
......
require 'spec_helper' require 'spec_helper'
describe "Admin::Projects" do describe "Admin::Projects" do
describe "GET /admin/projects" do describe "GET /admin/projects" do
it { admin_projects_path.should be_allowed_for :admin } it { admin_projects_path.should be_allowed_for :admin }
it { admin_projects_path.should be_denied_for :user } it { admin_projects_path.should be_denied_for :user }
it { admin_projects_path.should be_denied_for :visitor } it { admin_projects_path.should be_denied_for :visitor }
end end
describe "GET /admin/users" do describe "GET /admin/users" do
it { admin_users_path.should be_allowed_for :admin } it { admin_users_path.should be_allowed_for :admin }
it { admin_users_path.should be_denied_for :user } it { admin_users_path.should be_denied_for :user }
it { admin_users_path.should be_denied_for :visitor } it { admin_users_path.should be_denied_for :visitor }
end end
describe "GET /admin/team_members" do describe "GET /admin/team_members" do
it { admin_team_members_path.should be_allowed_for :admin } it { admin_team_members_path.should be_allowed_for :admin }
it { admin_team_members_path.should be_denied_for :user } it { admin_team_members_path.should be_denied_for :user }
it { admin_team_members_path.should be_denied_for :visitor } it { admin_team_members_path.should be_denied_for :visitor }
end end
describe "GET /admin/emails" do describe "GET /admin/emails" do
it { admin_emails_path.should be_allowed_for :admin } it { admin_emails_path.should be_allowed_for :admin }
it { admin_emails_path.should be_denied_for :user } it { admin_emails_path.should be_denied_for :user }
it { admin_emails_path.should be_denied_for :visitor } it { admin_emails_path.should be_denied_for :visitor }
......
...@@ -4,13 +4,13 @@ describe "Issues" do ...@@ -4,13 +4,13 @@ describe "Issues" do
let(:project) { Factory :project } let(:project) { Factory :project }
let!(:commit) { project.repo.commits.first } let!(:commit) { project.repo.commits.first }
before do before do
login_as :user login_as :user
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
end end
describe "add new note", :js => true do describe "add new note", :js => true do
before do before do
visit project_commit_path(project, commit) visit project_commit_path(project, commit)
click_link "Comments" # notes tab click_link "Comments" # notes tab
fill_in "note_note", :with => "I commented this commit" fill_in "note_note", :with => "I commented this commit"
......
...@@ -3,13 +3,13 @@ require 'spec_helper' ...@@ -3,13 +3,13 @@ require 'spec_helper'
describe "Commits" do describe "Commits" do
let(:project) { Factory :project } let(:project) { Factory :project }
let!(:commit) { project.repo.commits.first } let!(:commit) { project.repo.commits.first }
before do before do
login_as :user login_as :user
project.add_access(@user, :read) project.add_access(@user, :read)
end end
describe "GET /commits" do describe "GET /commits" do
before do before do
visit project_commits_path(project) visit project_commits_path(project)
end end
...@@ -17,22 +17,22 @@ describe "Commits" do ...@@ -17,22 +17,22 @@ describe "Commits" do
current_path.should == project_commits_path(project) current_path.should == project_commits_path(project)
end end
it "should have project name" do it "should have project name" do
page.should have_content(project.name) page.should have_content(project.name)
end end
it "should list commits" do it "should list commits" do
page.should have_content(commit.author) page.should have_content(commit.author)
page.should have_content(commit.message) page.should have_content(commit.message)
end end
end end
describe "GET /commits/:id" do describe "GET /commits/:id" do
before do before do
visit project_commit_path(project, commit) visit project_commit_path(project, commit)
end end
it "should have valid path" do it "should have valid path" do
current_path.should == project_commit_path(project, commit) current_path.should == project_commit_path(project, commit)
end end
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe "Issues" do describe "Issues" do
let(:project) { Factory :project } let(:project) { Factory :project }
before do before do
login_as :user login_as :user
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
...@@ -13,8 +13,8 @@ describe "Issues" do ...@@ -13,8 +13,8 @@ describe "Issues" do
:project => project :project => project
end end
describe "add new note", :js => true do describe "add new note", :js => true do
before do before do
visit project_issue_path(project, @issue) visit project_issue_path(project, @issue)
fill_in "note_note", :with => "I commented this issue" fill_in "note_note", :with => "I commented this issue"
click_button "Add note" click_button "Add note"
......
...@@ -3,13 +3,13 @@ require 'spec_helper' ...@@ -3,13 +3,13 @@ require 'spec_helper'
describe "Issues" do describe "Issues" do
let(:project) { Factory :project } let(:project) { Factory :project }
before do before do
login_as :user login_as :user
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
end end
describe "GET /issues" do describe "GET /issues" do
before do before do
@issue = Factory :issue, @issue = Factory :issue,
:author => @user, :author => @user,
:assignee => @user, :assignee => @user,
...@@ -24,23 +24,23 @@ describe "Issues" do ...@@ -24,23 +24,23 @@ describe "Issues" do
it { should have_content(@issue.project.name) } it { should have_content(@issue.project.name) }
it { should have_content(@issue.assignee.name) } it { should have_content(@issue.assignee.name) }
describe "Destroy" do describe "Destroy" do
before do before do
# admin access to remove issue # admin access to remove issue
@user.users_projects.destroy_all @user.users_projects.destroy_all
project.add_access(@user, :read, :write, :admin) project.add_access(@user, :read, :write, :admin)
visit project_issues_path(project) visit project_issues_path(project)
end end
it "should remove entry" do it "should remove entry" do
expect { expect {
click_link "destroy_issue_#{@issue.id}" click_link "destroy_issue_#{@issue.id}"
}.to change { Issue.count }.by(-1) }.to change { Issue.count }.by(-1)
end end
end end
describe "statuses", :js => true do describe "statuses", :js => true do
before do before do
@closed_issue = Factory :issue, @closed_issue = Factory :issue,
:author => @user, :author => @user,
:assignee => @user, :assignee => @user,
...@@ -48,18 +48,18 @@ describe "Issues" do ...@@ -48,18 +48,18 @@ describe "Issues" do
:closed => true :closed => true
end end
it "should show only open" do it "should show only open" do
should have_content(@issue.title) should have_content(@issue.title)
should have_no_content(@closed_issue.title) should have_no_content(@closed_issue.title)
end end
it "should show only closed" do it "should show only closed" do
choose "closed_issues" choose "closed_issues"
should have_no_content(@issue.title) should have_no_content(@issue.title)
should have_content(@closed_issue.title) should have_content(@closed_issue.title)
end end
it "should show all" do it "should show all" do
choose "all_issues" choose "all_issues"
should have_content(@issue.title) should have_content(@issue.title)
should have_content(@closed_issue.title) should have_content(@closed_issue.title)
...@@ -67,17 +67,17 @@ describe "Issues" do ...@@ -67,17 +67,17 @@ describe "Issues" do
end end
end end
describe "New issue", :js => true do describe "New issue", :js => true do
before do before do
visit project_issues_path(project) visit project_issues_path(project)
click_link "New Issue" click_link "New Issue"
end end
it "should open new issue popup" do it "should open new issue popup" do
page.should have_content("Add new issue") page.should have_content("Add new issue")
end end
describe "fill in" do describe "fill in" do
before do before do
fill_in "issue_title", :with => "bug 345" fill_in "issue_title", :with => "bug 345"
fill_in "issue_content", :with => "app bug 345" fill_in "issue_content", :with => "app bug 345"
...@@ -87,7 +87,7 @@ describe "Issues" do ...@@ -87,7 +87,7 @@ describe "Issues" do
it { expect { click_button "Save" }.to change {Issue.count}.by(1) } it { expect { click_button "Save" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do it "should add new issue to table" do
click_button "Save" click_button "Save"
page.should_not have_content("Add new issue") page.should_not have_content("Add new issue")
...@@ -96,12 +96,12 @@ describe "Issues" do ...@@ -96,12 +96,12 @@ describe "Issues" do
page.should have_content project.name page.should have_content project.name
end end
it "should call send mail" do it "should call send mail" do
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
click_button "Save" click_button "Save"
end end
it "should send valid email to user with email & password" do it "should send valid email to user with email & password" do
click_button "Save" click_button "Save"
issue = Issue.last issue = Issue.last
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
...@@ -112,8 +112,8 @@ describe "Issues" do ...@@ -112,8 +112,8 @@ describe "Issues" do
end end
end end
describe "Edit issue", :js => true do describe "Edit issue", :js => true do
before do before do
@issue = Factory :issue, @issue = Factory :issue,
:author => @user, :author => @user,
:assignee => @user, :assignee => @user,
...@@ -122,11 +122,11 @@ describe "Issues" do ...@@ -122,11 +122,11 @@ describe "Issues" do
click_link "Edit" click_link "Edit"
end end
it "should open new issue popup" do it "should open new issue popup" do
page.should have_content("Issue ##{@issue.id}") page.should have_content("Issue ##{@issue.id}")
end end
describe "fill in" do describe "fill in" do
before do before do
fill_in "issue_title", :with => "bug 345" fill_in "issue_title", :with => "bug 345"
fill_in "issue_content", :with => "app bug 345" fill_in "issue_content", :with => "app bug 345"
...@@ -134,7 +134,7 @@ describe "Issues" do ...@@ -134,7 +134,7 @@ describe "Issues" do
it { expect { click_button "Save" }.to_not change {Issue.count} } it { expect { click_button "Save" }.to_not change {Issue.count} }
it "should update issue fields" do it "should update issue fields" do
click_button "Save" click_button "Save"
page.should_not have_content("Issue ##{@issue.id}") page.should_not have_content("Issue ##{@issue.id}")
......
require 'spec_helper' require 'spec_helper'
describe "Issues" do describe "Issues" do
before do before do
login_as :user login_as :user
end end
describe "GET /keys" do describe "GET /keys" do
before do before do
@key = Factory :key, :user => @user @key = Factory :key, :user => @user
visit keys_path visit keys_path
end end
...@@ -15,8 +15,8 @@ describe "Issues" do ...@@ -15,8 +15,8 @@ describe "Issues" do
it { should have_content(@key.title) } it { should have_content(@key.title) }
describe "Destroy" do describe "Destroy" do
it "should remove entry" do it "should remove entry" do
expect { expect {
click_link "destroy_key_#{@key.id}" click_link "destroy_key_#{@key.id}"
}.to change { @user.keys.count }.by(-1) }.to change { @user.keys.count }.by(-1)
...@@ -24,17 +24,17 @@ describe "Issues" do ...@@ -24,17 +24,17 @@ describe "Issues" do
end end
end end
describe "New key", :js => true do describe "New key", :js => true do
before do before do
visit keys_path visit keys_path
click_link "Add new" click_link "Add new"
end end
it "should open new key popup" do it "should open new key popup" do
page.should have_content("Add new public key") page.should have_content("Add new public key")
end end
describe "fill in" do describe "fill in" do
before do before do
fill_in "key_title", :with => "laptop" fill_in "key_title", :with => "laptop"
fill_in "key_key", :with => "publickey234=" fill_in "key_key", :with => "publickey234="
...@@ -42,7 +42,7 @@ describe "Issues" do ...@@ -42,7 +42,7 @@ describe "Issues" do
it { expect { click_button "Save" }.to change {Key.count}.by(1) } it { expect { click_button "Save" }.to change {Key.count}.by(1) }
it "should add new key to table" do it "should add new key to table" do
click_button "Save" click_button "Save"
page.should_not have_content("Add new public key") page.should_not have_content("Add new public key")
......
require 'spec_helper' require 'spec_helper'
describe "Profile" do describe "Profile" do
before do before do
login_as :user login_as :user
end end
describe "Show profile" do describe "Show profile" do
before do before do
visit profile_path visit profile_path
end end
...@@ -15,13 +15,13 @@ describe "Profile" do ...@@ -15,13 +15,13 @@ describe "Profile" do
end end
describe "Profile update" do describe "Profile update" do
before do before do
visit profile_path visit profile_path
fill_in "user_skype", :with => "testskype" fill_in "user_skype", :with => "testskype"
fill_in "user_linkedin", :with => "testlinkedin" fill_in "user_linkedin", :with => "testlinkedin"
fill_in "user_twitter", :with => "testtwitter" fill_in "user_twitter", :with => "testtwitter"
click_button "Save" click_button "Save"
@user.reload @user.reload
end end
it { @user.skype.should == 'testskype' } it { @user.skype.should == 'testskype' }
...@@ -29,18 +29,17 @@ describe "Profile" do ...@@ -29,18 +29,17 @@ describe "Profile" do
it { @user.twitter.should == 'testtwitter' } it { @user.twitter.should == 'testtwitter' }
end end
describe "Password update" do describe "Password update" do
before do before do
visit profile_password_path visit profile_password_path
end end
it { page.should have_content("Password") } it { page.should have_content("Password") }
it { page.should have_content("Password confirmation") } it { page.should have_content("Password confirmation") }
describe "change password" do describe "change password" do
before do before do
@old_pwd = @user.encrypted_password @old_pwd = @user.encrypted_password
fill_in "user_password", :with => "777777" fill_in "user_password", :with => "777777"
fill_in "user_password_confirmation", :with => "777777" fill_in "user_password_confirmation", :with => "777777"
click_button "Save" click_button "Save"
...@@ -51,18 +50,18 @@ describe "Profile" do ...@@ -51,18 +50,18 @@ describe "Profile" do
current_path.should == new_user_session_path current_path.should == new_user_session_path
end end
it "should change password" do it "should change password" do
@user.encrypted_password.should_not == @old_pwd @user.encrypted_password.should_not == @old_pwd
end end
describe "login with new password" do describe "login with new password" do
before do before do
fill_in "user_email", :with => @user.email fill_in "user_email", :with => @user.email
fill_in "user_password", :with => "777777" fill_in "user_password", :with => "777777"
click_button "Sign in" click_button "Sign in"
end end
it "should login user" do it "should login user" do
current_path.should == root_path current_path.should == root_path
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe "Projects" do describe "Projects" do
describe "GET /projects" do describe "GET /projects" do
it { projects_path.should be_allowed_for :admin } it { projects_path.should be_allowed_for :admin }
it { projects_path.should be_allowed_for :user } it { projects_path.should be_allowed_for :user }
it { projects_path.should be_denied_for :visitor } it { projects_path.should be_denied_for :visitor }
end end
describe "GET /projects/new" do describe "GET /projects/new" do
it { projects_path.should be_allowed_for :admin } it { projects_path.should be_allowed_for :admin }
it { projects_path.should be_allowed_for :user } it { projects_path.should be_allowed_for :user }
it { projects_path.should be_denied_for :visitor } it { projects_path.should be_denied_for :visitor }
end end
describe "Project" do describe "Project" do
before do before do
@project = Factory :project @project = Factory :project
@u1 = Factory :user @u1 = Factory :user
@u2 = Factory :user @u2 = Factory :user
@u3 = Factory :user @u3 = Factory :user
# full access # full access
@project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true) @project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true)
# no access # no access
@project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false) @project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false)
# readonly # readonly
@project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false) @project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false)
end end
describe "GET /project_code" do describe "GET /project_code" do
it { project_path(@project).should be_allowed_for @u1 } it { project_path(@project).should be_allowed_for @u1 }
it { project_path(@project).should be_allowed_for @u3 } it { project_path(@project).should be_allowed_for @u3 }
it { project_path(@project).should be_denied_for :admin } it { project_path(@project).should be_denied_for :admin }
...@@ -36,7 +36,7 @@ describe "Projects" do ...@@ -36,7 +36,7 @@ describe "Projects" do
it { project_path(@project).should be_denied_for :visitor } it { project_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/tree" do describe "GET /project_code/tree" do
it { tree_project_path(@project).should be_allowed_for @u1 } it { tree_project_path(@project).should be_allowed_for @u1 }
it { tree_project_path(@project).should be_allowed_for @u3 } it { tree_project_path(@project).should be_allowed_for @u3 }
it { tree_project_path(@project).should be_denied_for :admin } it { tree_project_path(@project).should be_denied_for :admin }
...@@ -45,7 +45,7 @@ describe "Projects" do ...@@ -45,7 +45,7 @@ describe "Projects" do
it { tree_project_path(@project).should be_denied_for :visitor } it { tree_project_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/commits" do describe "GET /project_code/commits" do
it { project_commits_path(@project).should be_allowed_for @u1 } it { project_commits_path(@project).should be_allowed_for @u1 }
it { project_commits_path(@project).should be_allowed_for @u3 } it { project_commits_path(@project).should be_allowed_for @u3 }
it { project_commits_path(@project).should be_denied_for :admin } it { project_commits_path(@project).should be_denied_for :admin }
...@@ -54,7 +54,7 @@ describe "Projects" do ...@@ -54,7 +54,7 @@ describe "Projects" do
it { project_commits_path(@project).should be_denied_for :visitor } it { project_commits_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/commit" do describe "GET /project_code/commit" do
it { project_commit_path(@project, @project.commit).should be_allowed_for @u1 } it { project_commit_path(@project, @project.commit).should be_allowed_for @u1 }
it { project_commit_path(@project, @project.commit).should be_allowed_for @u3 } it { project_commit_path(@project, @project.commit).should be_allowed_for @u3 }
it { project_commit_path(@project, @project.commit).should be_denied_for :admin } 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
it { project_commit_path(@project, @project.commit).should be_denied_for :visitor } it { project_commit_path(@project, @project.commit).should be_denied_for :visitor }
end end
describe "GET /project_code/team" do describe "GET /project_code/team" do
it { team_project_path(@project).should be_allowed_for @u1 } it { team_project_path(@project).should be_allowed_for @u1 }
it { team_project_path(@project).should be_allowed_for @u3 } it { team_project_path(@project).should be_allowed_for @u3 }
it { team_project_path(@project).should be_denied_for :admin } it { team_project_path(@project).should be_denied_for :admin }
...@@ -72,7 +72,7 @@ describe "Projects" do ...@@ -72,7 +72,7 @@ describe "Projects" do
it { team_project_path(@project).should be_denied_for :visitor } it { team_project_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/wall" do describe "GET /project_code/wall" do
it { wall_project_path(@project).should be_allowed_for @u1 } it { wall_project_path(@project).should be_allowed_for @u1 }
it { wall_project_path(@project).should be_allowed_for @u3 } it { wall_project_path(@project).should be_allowed_for @u3 }
it { wall_project_path(@project).should be_denied_for :admin } it { wall_project_path(@project).should be_denied_for :admin }
...@@ -81,8 +81,8 @@ describe "Projects" do ...@@ -81,8 +81,8 @@ describe "Projects" do
it { wall_project_path(@project).should be_denied_for :visitor } it { wall_project_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/blob" do describe "GET /project_code/blob" do
before do before do
@commit = @project.commit @commit = @project.commit
@path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name
@blob_path = blob_project_path(@project, :commit_id => @commit.id, :path => @path) @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
it { @blob_path.should be_denied_for :visitor } it { @blob_path.should be_denied_for :visitor }
end end
describe "GET /project_code/edit" do describe "GET /project_code/edit" do
it { edit_project_path(@project).should be_allowed_for @u1 } it { edit_project_path(@project).should be_allowed_for @u1 }
it { edit_project_path(@project).should be_denied_for @u3 } it { edit_project_path(@project).should be_denied_for @u3 }
it { edit_project_path(@project).should be_denied_for :admin } it { edit_project_path(@project).should be_denied_for :admin }
...@@ -105,7 +105,7 @@ describe "Projects" do ...@@ -105,7 +105,7 @@ describe "Projects" do
it { edit_project_path(@project).should be_denied_for :visitor } it { edit_project_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/issues" do describe "GET /project_code/issues" do
it { project_issues_path(@project).should be_allowed_for @u1 } it { project_issues_path(@project).should be_allowed_for @u1 }
it { project_issues_path(@project).should be_allowed_for @u3 } it { project_issues_path(@project).should be_allowed_for @u3 }
it { project_issues_path(@project).should be_denied_for :admin } it { project_issues_path(@project).should be_denied_for :admin }
...@@ -114,7 +114,7 @@ describe "Projects" do ...@@ -114,7 +114,7 @@ describe "Projects" do
it { project_issues_path(@project).should be_denied_for :visitor } it { project_issues_path(@project).should be_denied_for :visitor }
end end
describe "GET /project_code/snippets" do describe "GET /project_code/snippets" do
it { project_snippets_path(@project).should be_allowed_for @u1 } it { project_snippets_path(@project).should be_allowed_for @u1 }
it { project_snippets_path(@project).should be_allowed_for @u3 } it { project_snippets_path(@project).should be_allowed_for @u3 }
it { project_snippets_path(@project).should be_denied_for :admin } it { project_snippets_path(@project).should be_denied_for :admin }
......
...@@ -4,38 +4,38 @@ describe "Projects" do ...@@ -4,38 +4,38 @@ describe "Projects" do
before { login_as :user } before { login_as :user }
describe "GET /projects" do describe "GET /projects" do
before do before do
visit projects_path visit projects_path
end end
it "should be on projects page" do it "should be on projects page" do
current_path.should == projects_path current_path.should == projects_path
end end
it "should have link to new project" do it "should have link to new project" do
page.should have_content("New Project") page.should have_content("New Project")
end end
end end
describe "GET /projects/new" do describe "GET /projects/new" do
before do before do
visit projects_path visit projects_path
click_link "New Project" click_link "New Project"
end end
it "should be correct path" do it "should be correct path" do
current_path.should == new_project_path current_path.should == new_project_path
end end
it "should have labels for new project" do it "should have labels for new project" do
page.should have_content("Name") page.should have_content("Name")
page.should have_content("Path") page.should have_content("Path")
page.should have_content("Description") page.should have_content("Description")
end end
end end
describe "POST /projects" do describe "POST /projects" do
before do before do
visit new_project_path visit new_project_path
fill_in 'Name', :with => 'NewProject' fill_in 'Name', :with => 'NewProject'
fill_in 'Code', :with => 'NPR' fill_in 'Code', :with => 'NPR'
...@@ -61,7 +61,7 @@ describe "Projects" do ...@@ -61,7 +61,7 @@ describe "Projects" do
end end
describe "GET /projects/show" do describe "GET /projects/show" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -72,14 +72,14 @@ describe "Projects" do ...@@ -72,14 +72,14 @@ describe "Projects" do
current_path.should == project_path(@project) current_path.should == project_path(@project)
end end
it "should beahave like dashboard" do it "should beahave like dashboard" do
page.should have_content("History") page.should have_content("History")
end end
end end
describe "GET /projects/team" do describe "GET /projects/team" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -92,13 +92,13 @@ describe "Projects" do ...@@ -92,13 +92,13 @@ describe "Projects" do
current_path.should == team_project_path(@project) current_path.should == team_project_path(@project)
end end
it "should have as as team member" do it "should have as as team member" do
page.should have_content(@user.name) page.should have_content(@user.name)
end end
end end
describe "GET /projects/:id/edit" do describe "GET /projects/:id/edit" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :admin, :read) @project.add_access(@user, :admin, :read)
...@@ -110,14 +110,14 @@ describe "Projects" do ...@@ -110,14 +110,14 @@ describe "Projects" do
end end
it "should have labels for new project" do it "should have labels for new project" do
page.should have_content("Name") page.should have_content("Name")
page.should have_content("Path") page.should have_content("Path")
page.should have_content("Description") page.should have_content("Description")
end end
end end
describe "PUT /projects/:id" do describe "PUT /projects/:id" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :admin, :read) @project.add_access(@user, :admin, :read)
...@@ -140,14 +140,14 @@ describe "Projects" do ...@@ -140,14 +140,14 @@ describe "Projects" do
end end
#describe "DELETE /projects/:id", :js => true do #describe "DELETE /projects/:id", :js => true do
#before do #before do
#@project = Factory :project #@project = Factory :project
#@project.add_access(@user, :read, :admin) #@project.add_access(@user, :read, :admin)
#visit projects_path #visit projects_path
#end #end
#it "should be correct path" do #it "should be correct path" do
#expect { click_link "Destroy" }.to change {Project.count}.by(1) #expect { click_link "Destroy" }.to change {Project.count}.by(1)
#end #end
#end #end
end end
...@@ -6,13 +6,13 @@ describe "Projects" do ...@@ -6,13 +6,13 @@ describe "Projects" do
describe "GET /projects/tree" do describe "GET /projects/tree" do
describe "head" do describe "head" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
end end
it "should be fast" do it "should be fast" do
time = Benchmark.realtime do time = Benchmark.realtime do
visit tree_project_path(@project) visit tree_project_path(@project)
end end
...@@ -21,12 +21,12 @@ describe "Projects" do ...@@ -21,12 +21,12 @@ describe "Projects" do
end end
describe ValidCommit::ID do describe ValidCommit::ID do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
end end
it "should be fast" do it "should be fast" do
time = Benchmark.realtime do time = Benchmark.realtime do
visit tree_project_path(@project, :commit_id => ValidCommit::ID) visit tree_project_path(@project, :commit_id => ValidCommit::ID)
end end
......
...@@ -5,7 +5,7 @@ describe "Projects" do ...@@ -5,7 +5,7 @@ describe "Projects" do
describe "GET /projects/tree" do describe "GET /projects/tree" do
describe "head" do describe "head" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -20,7 +20,7 @@ describe "Projects" do ...@@ -20,7 +20,7 @@ describe "Projects" do
end end
describe ValidCommit::ID do describe ValidCommit::ID do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -36,7 +36,7 @@ describe "Projects" do ...@@ -36,7 +36,7 @@ describe "Projects" do
end end
describe "branch passed" do describe "branch passed" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -53,7 +53,7 @@ describe "Projects" do ...@@ -53,7 +53,7 @@ describe "Projects" do
# TREE FILE PREVIEW # TREE FILE PREVIEW
describe "file preview" do describe "file preview" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -70,9 +70,9 @@ describe "Projects" do ...@@ -70,9 +70,9 @@ describe "Projects" do
end end
end end
# RAW FILE # RAW FILE
describe "GET /projects/blob" do describe "GET /projects/blob" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
...@@ -85,7 +85,7 @@ describe "Projects" do ...@@ -85,7 +85,7 @@ describe "Projects" do
current_path.should == blob_project_path(@project) current_path.should == blob_project_path(@project)
end end
it "raw file response" do it "raw file response" do
page.source.should == ValidCommit::BLOB_FILE page.source.should == ValidCommit::BLOB_FILE
end end
end end
......
...@@ -3,13 +3,13 @@ require 'spec_helper' ...@@ -3,13 +3,13 @@ require 'spec_helper'
describe "Projects", "Wall" do describe "Projects", "Wall" do
let(:project) { Factory :project } let(:project) { Factory :project }
before do before do
login_as :user login_as :user
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
end end
describe "View notes on wall" do describe "View notes on wall" do
before do before do
Factory :note, :project => project, :note => "Project specs", :author => @user Factory :note, :project => project, :note => "Project specs", :author => @user
visit wall_project_path(project) visit wall_project_path(project)
end end
...@@ -19,8 +19,8 @@ describe "Projects", "Wall" do ...@@ -19,8 +19,8 @@ describe "Projects", "Wall" do
it { page.should have_content("less than a minute ago") } it { page.should have_content("less than a minute ago") }
end end
describe "add new note", :js => true do describe "add new note", :js => true do
before do before do
visit wall_project_path(project) visit wall_project_path(project)
fill_in "note_note", :with => "my post on wall" fill_in "note_note", :with => "my post on wall"
click_button "Add note" click_button "Add note"
......
...@@ -3,13 +3,13 @@ require 'spec_helper' ...@@ -3,13 +3,13 @@ require 'spec_helper'
describe "Snippets" do describe "Snippets" do
let(:project) { Factory :project } let(:project) { Factory :project }
before do before do
login_as :user login_as :user
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
end end
describe "GET /snippets" do describe "GET /snippets" do
before do before do
@snippet = Factory :snippet, @snippet = Factory :snippet,
:author => @user, :author => @user,
:project => project :project => project
...@@ -23,15 +23,15 @@ describe "Snippets" do ...@@ -23,15 +23,15 @@ describe "Snippets" do
it { should have_content(@snippet.project.name) } it { should have_content(@snippet.project.name) }
it { should have_content(@snippet.author.name) } it { should have_content(@snippet.author.name) }
describe "Destroy" do describe "Destroy" do
before do before do
# admin access to remove snippet # admin access to remove snippet
@user.users_projects.destroy_all @user.users_projects.destroy_all
project.add_access(@user, :read, :write, :admin) project.add_access(@user, :read, :write, :admin)
visit project_snippets_path(project) visit project_snippets_path(project)
end end
it "should remove entry" do it "should remove entry" do
expect { expect {
click_link "destroy_snippet_#{@snippet.id}" click_link "destroy_snippet_#{@snippet.id}"
}.to change { Snippet.count }.by(-1) }.to change { Snippet.count }.by(-1)
...@@ -39,17 +39,17 @@ describe "Snippets" do ...@@ -39,17 +39,17 @@ describe "Snippets" do
end end
end end
describe "New snippet" do describe "New snippet" do
before do before do
visit project_snippets_path(project) visit project_snippets_path(project)
click_link "New Snippet" click_link "New Snippet"
end end
it "should open new snippet popup" do it "should open new snippet popup" do
page.current_path.should == new_project_snippet_path(project) page.current_path.should == new_project_snippet_path(project)
end end
describe "fill in" do describe "fill in" do
before do before do
fill_in "snippet_title", :with => "login function" fill_in "snippet_title", :with => "login function"
fill_in "snippet_file_name", :with => "test.rb" fill_in "snippet_file_name", :with => "test.rb"
...@@ -58,7 +58,7 @@ describe "Snippets" do ...@@ -58,7 +58,7 @@ describe "Snippets" do
it { expect { click_button "Save" }.to change {Snippet.count}.by(1) } it { expect { click_button "Save" }.to change {Snippet.count}.by(1) }
it "should add new snippet to table" do it "should add new snippet to table" do
click_button "Save" click_button "Save"
page.current_path.should == project_snippet_path(project, Snippet.last) page.current_path.should == project_snippet_path(project, Snippet.last)
page.should have_content "login function" page.should have_content "login function"
...@@ -67,8 +67,8 @@ describe "Snippets" do ...@@ -67,8 +67,8 @@ describe "Snippets" do
end end
end end
describe "Edit snippet" do describe "Edit snippet" do
before do before do
@snippet = Factory :snippet, @snippet = Factory :snippet,
:author => @user, :author => @user,
:project => project :project => project
...@@ -76,11 +76,11 @@ describe "Snippets" do ...@@ -76,11 +76,11 @@ describe "Snippets" do
click_link "Edit" click_link "Edit"
end end
it "should open edit page" do it "should open edit page" do
page.current_path.should == edit_project_snippet_path(project, @snippet) page.current_path.should == edit_project_snippet_path(project, @snippet)
end end
describe "fill in" do describe "fill in" do
before do before do
fill_in "snippet_title", :with => "login function" fill_in "snippet_title", :with => "login function"
fill_in "snippet_file_name", :with => "test.rb" fill_in "snippet_file_name", :with => "test.rb"
...@@ -89,7 +89,7 @@ describe "Snippets" do ...@@ -89,7 +89,7 @@ describe "Snippets" do
it { expect { click_button "Save" }.to_not change {Snippet.count} } it { expect { click_button "Save" }.to_not change {Snippet.count} }
it "should update snippet fields" do it "should update snippet fields" do
click_button "Save" click_button "Save"
page.current_path.should == project_snippet_path(project, @snippet) page.current_path.should == project_snippet_path(project, @snippet)
......
require 'spec_helper' require 'spec_helper'
describe "TeamMembers" do describe "TeamMembers" do
before do before do
login_as :user login_as :user
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read, :admin) @project.add_access(@user, :read, :admin)
...@@ -10,7 +10,7 @@ describe "TeamMembers" do ...@@ -10,7 +10,7 @@ describe "TeamMembers" do
describe "View profile" do describe "View profile" do
it "should be available" do it "should be available" do
visit(team_project_path(@project)) visit(team_project_path(@project))
within "#team-table" do within "#team-table" do
click_link(@user.name) click_link(@user.name)
end end
page.should have_content @user.skype page.should have_content @user.skype
...@@ -18,23 +18,23 @@ describe "TeamMembers" do ...@@ -18,23 +18,23 @@ describe "TeamMembers" do
end end
end end
describe "New Team member", :js => true do describe "New Team member", :js => true do
before do before do
@user_1 = Factory :user @user_1 = Factory :user
visit team_project_path(@project) visit team_project_path(@project)
click_link "Add new" click_link "Add new"
end end
it "should open new team member popup" do it "should open new team member popup" do
page.should have_content("Add new member to project") page.should have_content("Add new member to project")
end end
describe "fill in" do describe "fill in" do
before do before do
click_link "Select user" click_link "Select user"
click_link @user_1.name click_link @user_1.name
within "#team_member_new" do within "#team_member_new" do
check "team_member_read" check "team_member_read"
check "team_member_write" check "team_member_write"
end end
...@@ -42,7 +42,7 @@ describe "TeamMembers" do ...@@ -42,7 +42,7 @@ describe "TeamMembers" do
it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) } it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) }
it "should add new member to table" do it "should add new member to table" do
click_button "Save" click_button "Save"
@member = UsersProject.last @member = UsersProject.last
...@@ -53,8 +53,8 @@ describe "TeamMembers" do ...@@ -53,8 +53,8 @@ describe "TeamMembers" do
@member.admin.should be_false @member.admin.should be_false
end end
it "should not allow creation without access selected" do it "should not allow creation without access selected" do
within "#team_member_new" do within "#team_member_new" do
uncheck "team_member_read" uncheck "team_member_read"
uncheck "team_member_write" uncheck "team_member_write"
uncheck "team_member_admin" uncheck "team_member_admin"
...@@ -66,8 +66,8 @@ describe "TeamMembers" do ...@@ -66,8 +66,8 @@ describe "TeamMembers" do
end end
end end
describe "Cancel membership" do describe "Cancel membership" do
it "should cancel membership" do it "should cancel membership" do
visit team_project_path(@project) visit team_project_path(@project)
expect { click_link "Cancel" }.to change { UsersProject.count }.by(-1) expect { click_link "Cancel" }.to change { UsersProject.count }.by(-1)
end end
......
...@@ -4,7 +4,7 @@ describe "Top Panel", :js => true do ...@@ -4,7 +4,7 @@ describe "Top Panel", :js => true do
before { login_as :user } before { login_as :user }
describe "Search autocomplete" do describe "Search autocomplete" do
before do before do
visit projects_path visit projects_path
fill_in "search", :with => "Ke" fill_in "search", :with => "Ke"
sleep(2) sleep(2)
...@@ -12,12 +12,12 @@ describe "Top Panel", :js => true do ...@@ -12,12 +12,12 @@ describe "Top Panel", :js => true do
end end
it "should be on projects page" do it "should be on projects page" do
current_path.should == keys_path current_path.should == keys_path
end end
end end
describe "with project" do describe "with project" do
before do before do
@project = Factory :project @project = Factory :project
@project.add_access(@user, :read) @project.add_access(@user, :read)
visit project_path(@project) visit project_path(@project)
...@@ -28,7 +28,7 @@ describe "Top Panel", :js => true do ...@@ -28,7 +28,7 @@ describe "Top Panel", :js => true do
end end
it "should be on projects page" do it "should be on projects page" do
current_path.should == project_commits_path(@project) current_path.should == project_commits_path(@project)
end end
end end
end end
...@@ -2,32 +2,32 @@ require 'spec_helper' ...@@ -2,32 +2,32 @@ require 'spec_helper'
describe "Users Security" do describe "Users Security" do
describe "Project" do describe "Project" do
before do before do
@u1 = Factory :user @u1 = Factory :user
end end
describe "GET /login" do describe "GET /login" do
#it { new_user_session_path.should be_denied_for @u1 } #it { new_user_session_path.should be_denied_for @u1 }
#it { new_user_session_path.should be_denied_for :admin } #it { new_user_session_path.should be_denied_for :admin }
#it { new_user_session_path.should be_denied_for :user } #it { new_user_session_path.should be_denied_for :user }
it { new_user_session_path.should_not be_404_for :visitor } it { new_user_session_path.should_not be_404_for :visitor }
end end
describe "GET /keys" do describe "GET /keys" do
it { keys_path.should be_allowed_for @u1 } it { keys_path.should be_allowed_for @u1 }
it { keys_path.should be_allowed_for :admin } it { keys_path.should be_allowed_for :admin }
it { keys_path.should be_allowed_for :user } it { keys_path.should be_allowed_for :user }
it { keys_path.should be_denied_for :visitor } it { keys_path.should be_denied_for :visitor }
end end
describe "GET /profile" do describe "GET /profile" do
it { profile_path.should be_allowed_for @u1 } it { profile_path.should be_allowed_for @u1 }
it { profile_path.should be_allowed_for :admin } it { profile_path.should be_allowed_for :admin }
it { profile_path.should be_allowed_for :user } it { profile_path.should be_allowed_for :user }
it { profile_path.should be_denied_for :visitor } it { profile_path.should be_denied_for :visitor }
end end
describe "GET /profile/password" do describe "GET /profile/password" do
it { profile_password_path.should be_allowed_for @u1 } it { profile_password_path.should be_allowed_for @u1 }
it { profile_password_path.should be_allowed_for :admin } it { profile_password_path.should be_allowed_for :admin }
it { profile_password_path.should be_allowed_for :user } it { profile_password_path.should be_allowed_for :user }
......
...@@ -11,7 +11,6 @@ require 'capybara/dsl' ...@@ -11,7 +11,6 @@ require 'capybara/dsl'
require 'factories' require 'factories'
require 'monkeypatch' require 'monkeypatch'
# Requires supporting ruby files with custom matchers and macros, etc, # Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories. # in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
......
module LoginMacros module LoginMacros
def login_as role def login_as role
@user = User.create(:email => "user#{User.count}@mail.com", @user = User.create(:email => "user#{User.count}@mail.com",
:name => "John Smith", :name => "John Smith",
:password => "123456", :password => "123456",
:password_confirmation => "123456", :password_confirmation => "123456",
:skype => 'user_skype') :skype => 'user_skype')
if role == :admin if role == :admin
@user.admin = true @user.admin = true
@user.save! @user.save!
end end
...@@ -23,7 +23,7 @@ module LoginMacros ...@@ -23,7 +23,7 @@ module LoginMacros
fill_in "Password", :with => "123456" fill_in "Password", :with => "123456"
click_button "Sign in" click_button "Sign in"
end end
def logout def logout
click_link "Logout" rescue nil click_link "Logout" rescue nil
end end
......
...@@ -18,17 +18,17 @@ RSpec::Matchers.define :be_denied_for do |user| ...@@ -18,17 +18,17 @@ RSpec::Matchers.define :be_denied_for do |user|
match do |url| match do |url|
include UrlAccess include UrlAccess
url_denied?(user, url) url_denied?(user, url)
end end
end end
RSpec::Matchers.define :be_404_for do |user| RSpec::Matchers.define :be_404_for do |user|
match do |url| match do |url|
include UrlAccess include UrlAccess
url_404?(user, url) url_404?(user, url)
end end
end end
module UrlAccess module UrlAccess
def url_allowed?(user, url) def url_allowed?(user, url)
emulate_user(user) emulate_user(user)
visit url visit url
......
...@@ -6,13 +6,12 @@ shared_examples_for :project_side_pane do ...@@ -6,13 +6,12 @@ shared_examples_for :project_side_pane do
it { should have_content("Tree") } it { should have_content("Tree") }
end end
shared_examples_for :tree_view do shared_examples_for :tree_view do
subject { page } subject { page }
it "should have Tree View of project" do it "should have Tree View of project" do
should have_content("app") should have_content("app")
should have_content("history") should have_content("history")
should have_content("Gemfile") should have_content("Gemfile")
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment