Commit 84457708 authored by DZ's avatar DZ

Merge branch 'dev' of dev.gitlabhq.com:gitlabhq into dev

parents d64f23e2 bd219fcc
......@@ -33,7 +33,7 @@ end
group :development, :test do
gem 'rspec-rails'
gem 'shoulda'
gem "shoulda", "~> 3.0.0.beta2"
gem 'capybara'
gem 'autotest'
gem 'autotest-rails'
......
......@@ -200,7 +200,11 @@ GEM
ffi (>= 1.0.7)
json_pure
rubyzip
shoulda (2.11.3)
shoulda (3.0.0.beta2)
shoulda-context (~> 1.0.0.beta1)
shoulda-matchers (~> 1.0.0.beta1)
shoulda-context (1.0.0.beta1)
shoulda-matchers (1.0.0.beta3)
simplecov (0.5.3)
multi_json (~> 1.0.3)
simplecov-html (~> 0.5.3)
......@@ -264,7 +268,7 @@ DEPENDENCIES
ruby-debug19
sass-rails (~> 3.1.0)
seed-fu!
shoulda
shoulda (~> 3.0.0.beta2)
simplecov
six
sqlite3
......
......@@ -5,11 +5,14 @@
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.ui.selectmenu
//= require jquery.cookie
//= require_tree .
$(function(){
$(".one_click_select").click(function(){
$(".one_click_select").live("click", function(){
$(this).select();
});
......
/*
* jQuery UI selectmenu dev version
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
* https://github.com/fnagel/jquery-ui/wiki/Selectmenu
*/
(function($) {
$.widget("ui.selectmenu", {
getter: "value",
version: "1.8",
eventPrefix: "selectmenu",
options: {
transferClasses: true,
typeAhead: "sequential",
style: 'dropdown',
positionOptions: {
my: "left top",
at: "left bottom",
offset: null
},
width: null,
menuWidth: null,
handleWidth: 26,
maxHeight: null,
icons: null,
format: null,
bgImage: function() {},
wrapperElement: "<div />"
},
_create: function() {
var self = this, o = this.options;
// 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 );
// quick array of button and menu id's
this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ];
// define safe mouseup for future toggling
this._safemouseup = true;
// create menu button wrapper
this.newelement = $( '<a />', {
'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all',
'id' : this.ids[ 0 ],
'role': 'button',
'href': '#nogo',
'tabindex': this.element.attr( 'disabled' ) ? 1 : 0,
'aria-haspopup': true,
'aria-owns': this.ids[ 1 ]
});
this.newelementWrap = $( o.wrapperElement )
.append( this.newelement )
.insertAfter( this.element );
// transfer tabindex
var tabindex = this.element.attr( 'tabindex' );
if ( tabindex ) {
this.newelement.attr( 'tabindex', tabindex );
}
// save reference to select in data for ease in calling methods
this.newelement.data( 'selectelement', this.element );
// menu icon
this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' )
.prependTo( this.newelement );
// append status span to button
this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' );
// make associated form label trigger focus
$( 'label[for="' + selectmenuId + '"]' )
.attr( 'for', this.ids[0] )
.bind( 'click.selectmenu', function() {
self.newelement[0].focus();
return false;
});
// click toggle for menu visibility
this.newelement
.bind('mousedown.selectmenu', function(event) {
self._toggle(event, true);
// make sure a click won't open/close instantly
if (o.style == "popup") {
self._safemouseup = false;
setTimeout(function() { self._safemouseup = true; }, 300);
}
return false;
})
.bind('click.selectmenu', function() {
return false;
})
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.ENTER:
ret = true;
break;
case $.ui.keyCode.SPACE:
self._toggle(event);
break;
case $.ui.keyCode.UP:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveSelection(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveSelection(1);
break;
case $.ui.keyCode.TAB:
ret = true;
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'mouseup');
return true;
})
.bind('mouseover.selectmenu focus.selectmenu', function() {
if (!o.disabled) {
$(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
}
})
.bind('mouseout.selectmenu blur.selectmenu', function() {
if (!o.disabled) {
$(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover');
}
});
// document click closes menu
$(document).bind("mousedown.selectmenu", function(event) {
self.close(event);
});
// change event on original selectmenu
this.element
.bind("click.selectmenu", function() {
self._refreshValue();
})
// FIXME: newelement can be null under unclear circumstances in IE8
// TODO not sure if this is still a problem (fnagel 20.03.11)
.bind("focus.selectmenu", function() {
if (self.newelement) {
self.newelement[0].focus();
}
});
// set width when not set via options
if (!o.width) {
o.width = this.element.outerWidth();
}
// set menu button width
this.newelement.width(o.width);
// hide original selectmenu element
this.element.hide();
// create menu portion, append to body
this.list = $( '<ul />', {
'class': 'ui-widget ui-widget-content',
'aria-hidden': true,
'role': 'listbox',
'aria-labelledby': this.ids[0],
'id': this.ids[1]
});
this.listWrap = $( o.wrapperElement )
.addClass( self.widgetBaseClass + '-menu' )
.append( this.list )
.appendTo( 'body' );
// transfer menu click to menu button
this.list
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.UP:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveFocus(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveFocus(1);
break;
case $.ui.keyCode.HOME:
self._moveFocus(':first');
break;
case $.ui.keyCode.PAGE_UP:
self._scrollPage('up');
break;
case $.ui.keyCode.PAGE_DOWN:
self._scrollPage('down');
break;
case $.ui.keyCode.END:
self._moveFocus(':last');
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.TAB:
ret = true;
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.ESCAPE:
self.close(event, true);
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'focus');
return true;
})
// this allows for using the scrollbar in an overflowed list
.bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; });
// needed when window is resized
// TODO seems to be useless, but causes errors (fnagel 01.08.11)
// see: https://github.com/fnagel/jquery-ui/issues/147
// $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) );
},
_init: function() {
var self = this, o = this.options;
// serialize selectmenu element options
var selectOptionData = [];
this.element
.find('option')
.each(function() {
var opt = $(this);
selectOptionData.push({
value: opt.attr('value'),
text: self._formatText(opt.text()),
selected: opt.attr('selected'),
disabled: opt.attr('disabled'),
classes: opt.attr('class'),
typeahead: opt.attr('typeahead'),
parentOptGroup: opt.parent('optgroup'),
bgImage: o.bgImage.call(opt)
});
});
// active state class is only used in popup style
var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
// empty list so we can refresh the selectmenu via selectmenu()
this.list.html("");
// write li's
if (selectOptionData.length) {
for (var i = 0; i < selectOptionData.length; i++) {
var thisLiAttr = { role : 'presentation' };
if ( selectOptionData[ i ].disabled ) {
thisLiAttr[ 'class' ] = this.namespace + '-state-disabled';
}
var thisAAttr = {
html: selectOptionData[i].text,
href : '#nogo',
tabindex : -1,
role : 'option',
'aria-selected' : false
};
if ( selectOptionData[ i ].disabled ) {
thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled;
}
if ( selectOptionData[ i ].typeahead ) {
thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead;
}
var thisA = $('<a/>', thisAAttr);
var thisLi = $('<li/>', thisLiAttr)
.append(thisA)
.data('index', i)
.addClass(selectOptionData[i].classes)
.data('optionClasses', selectOptionData[i].classes || '')
.bind("mouseup.selectmenu", function(event) {
if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) {
var changed = $(this).data('index') != self._selectedIndex();
self.index($(this).data('index'));
self.select(event);
if (changed) {
self.change(event);
}
self.close(event, true);
}
return false;
})
.bind("click.selectmenu", function() {
return false;
})
.bind('mouseover.selectmenu focus.selectmenu', function(e) {
// no hover if diabled
if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) {
self._selectedOptionLi().addClass(activeClass);
self._focusedOptionLi().removeClass(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() {
if ($(this).is(self._selectedOptionLi().selector)) {
$(this).addClass(activeClass);
}
$(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
});
// optgroup or not...
if ( selectOptionData[i].parentOptGroup.length ) {
var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup );
if (this.list.find( 'li.' + optGroupName ).length ) {
this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi );
} 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> ')
.appendTo( this.list )
.find( 'ul' )
.append( thisLi );
}
} else {
thisLi.appendTo(this.list);
}
// append icon if option is specified
if (o.icons) {
for (var j in o.icons) {
if (thisLi.is(o.icons[j].find)) {
thisLi
.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
.addClass(self.widgetBaseClass + '-hasIcon');
var iconClass = o.icons[j].icon || "";
thisLi
.find('a:eq(0)')
.prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>');
if (selectOptionData[i].bgImage) {
thisLi.find('span').css('background-image', selectOptionData[i].bgImage);
}
}
}
}
}
} else {
$('<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
var isDropDown = ( o.style == 'dropdown' );
this.newelement
.toggleClass( self.widgetBaseClass + '-dropdown', isDropDown )
.toggleClass( self.widgetBaseClass + '-popup', !isDropDown );
this.list
.toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown )
.toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown )
// add corners to top and bottom menu items
.find( 'li:first' )
.toggleClass( 'ui-corner-top', !isDropDown )
.end().find( 'li:last' )
.addClass( 'ui-corner-bottom' );
this.selectmenuIcon
.toggleClass( 'ui-icon-triangle-1-s', isDropDown )
.toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown );
// transfer classes to selectmenu and list
if ( o.transferClasses ) {
var transferClasses = this.element.attr( 'class' ) || '';
this.newelement.add( this.list ).addClass( transferClasses );
}
// set menu width to either menuWidth option value, width option value, or select width
if ( o.style == 'dropdown' ) {
this.list.width( o.menuWidth ? o.menuWidth : o.width );
} else {
this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth );
}
// reset height to auto
this.list.css( 'height', 'auto' );
var listH = this.listWrap.height();
// calculate default max height
if ( o.maxHeight && o.maxHeight < listH ) {
this.list.height( o.maxHeight );
} else {
var winH = $( window ).height() / 3;
if ( winH < listH ) this.list.height( winH );
}
// save reference to actionable li's (not group label li's)
this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' );
// transfer disabled state
if ( this.element.attr( 'disabled' ) ) {
this.disable();
} else {
this.enable()
}
// update value
this.index( this._selectedIndex() );
// needed when selectmenu is placed at the very bottom / top of the page
window.setTimeout( function() {
self._refreshPosition();
}, 200 );
},
destroy: function() {
this.element.removeData( this.widgetName )
.removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
.removeAttr( 'aria-disabled' )
.unbind( ".selectmenu" );
// TODO unneded as event binding has been disabled
// $( window ).unbind( ".selectmenu" );
$( document ).unbind( ".selectmenu" );
// unbind click on label, reset its for attr
$( 'label[for=' + this.newelement.attr('id') + ']' )
.attr( 'for', this.element.attr( 'id' ) )
.unbind( '.selectmenu' );
this.newelementWrap.remove();
this.listWrap.remove();
this.element.show();
// call widget destroy function
$.Widget.prototype.destroy.apply(this, arguments);
},
_typeAhead: function( code, eventType ){
var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
c = C.toLowerCase();
if ( self.options.typeAhead == 'sequential' ) {
// clear the timeout so we can use _prevChar
window.clearTimeout('ui.selectmenu-' + self.selectmenuId);
// define our find var
var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' );
function focusOptSeq( elem, ind, c ){
focusFound = true;
$( elem ).trigger( eventType );
typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c;
}
this.list.find( 'li a' ).each( function( i ) {
if ( !focusFound ) {
// allow the typeahead attribute on the option tag for a more specific lookup
var thisText = $( this ).attr( 'typeahead' ) || $(this).text();
if ( thisText.indexOf( find + C ) === 0 ) {
focusOptSeq( this, i, C );
} else if (thisText.indexOf(find+c) === 0 ) {
focusOptSeq( this, i, c );
}
}
});
// set a 1 second timeout for sequenctial typeahead
// keep this set even if we have no matches so it doesnt typeahead somewhere else
window.setTimeout( function( el ) {
self._prevChar = undefined;
}, 1000, self );
} else {
// define self._prevChar if needed
if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; }
focusFound = false;
function focusOpt( elem, ind ){
focusFound = true;
$( elem ).trigger( eventType );
self._prevChar[ 1 ] = ind;
}
this.list.find( 'li a' ).each(function( i ){
if (!focusFound){
var thisText = $(this).text();
if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) {
if (self._prevChar[0] == C){
if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); }
} else{
focusOpt( this, i );
}
}
}
});
this._prevChar[ 0 ] = C;
}
},
// returns some usefull information, called by callbacks only
_uiHash: function() {
var index = this.index();
return {
index: index,
option: $("option", this.element).get(index),
value: this.element[0].value
};
},
open: function(event) {
var self = this, o = this.options;
if ( self.newelement.attr("aria-disabled") != 'true' ) {
self._closeOthers(event);
self.newelement.addClass('ui-state-active');
self.listWrap.appendTo( o.appendTo );
self.list.attr('aria-hidden', false);
if ( o.style == "dropdown" ) {
self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
}
self.listWrap.addClass( self.widgetBaseClass + '-open' );
// positioning needed for IE7 (tested 01.08.11 on MS VPC Image)
// see https://github.com/fnagel/jquery-ui/issues/147
if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) {
self._refreshPosition();
}
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();
// positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image)
self._refreshPosition();
self._trigger("open", event, self._uiHash());
}
},
close: function(event, retainFocus) {
if ( this.newelement.is('.ui-state-active') ) {
this.newelement
.removeClass('ui-state-active');
this.listWrap.removeClass(this.widgetBaseClass + '-open');
this.list.attr('aria-hidden', true);
if ( this.options.style == "dropdown" ) {
this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all');
}
if ( retainFocus ) {
this.newelement.focus();
}
this._trigger("close", event, this._uiHash());
}
},
change: function(event) {
this.element.trigger("change");
this._trigger("change", event, this._uiHash());
},
select: function(event) {
if (this._disabled(event.currentTarget)) { return false; }
this._trigger("select", event, this._uiHash());
},
_closeOthers: function(event) {
$('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() {
$(this).data('selectelement').selectmenu('close', event);
});
$('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout');
},
_toggle: function(event, retainFocus) {
if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) {
this.close(event, retainFocus);
} else {
this.open(event);
}
},
_formatText: function(text) {
return (this.options.format ? this.options.format(text) : text);
},
_selectedIndex: function() {
return this.element[0].selectedIndex;
},
_selectedOptionLi: function() {
return this._optionLis.eq(this._selectedIndex());
},
_focusedOptionLi: function() {
return this.list.find('.' + this.widgetBaseClass + '-item-focus');
},
_moveSelection: function(amt, recIndex) {
// do nothing if disabled
if (!this.options.disabled) {
var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
// do not loop when using up key
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
// Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveSelection(amt, newIndex);
} else {
return this._optionLis.eq(newIndex).trigger('mouseup');
}
}
},
_moveFocus: function(amt, recIndex) {
if (!isNaN(amt)) {
var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
} else {
var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10);
}
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
//Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
this._focusedOptionLi().find('a:eq(0)').attr('id', '');
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveFocus(amt, newIndex);
} else {
this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus();
}
this.list.attr('aria-activedescendant', activeID);
},
_scrollPage: function(direction) {
var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
numPerPage = (direction == 'up' ? -numPerPage : numPerPage);
this._moveFocus(numPerPage);
},
_setOption: function(key, value) {
this.options[key] = value;
// set
if (key == 'disabled') {
this.close();
this.element
.add(this.newelement)
.add(this.list)[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled' + ' ' +
this.namespace + '-state-disabled')
.attr("aria-disabled", value);
}
},
disable: function(index, type){
// if options is not provided, call the parents disable function
if ( typeof( index ) == 'undefined' ) {
this._setOption( 'disabled', true );
} else {
if ( type == "optgroup" ) {
this._disableOptgroup(index);
} else {
this._disableOption(index);
}
}
},
enable: function(index, type) {
// if options is not provided, call the parents enable function
if ( typeof( index ) == 'undefined' ) {
this._setOption('disabled', false);
} else {
if ( type == "optgroup" ) {
this._enableOptgroup(index);
} else {
this._enableOption(index);
}
}
},
_disabled: function(elem) {
return $(elem).hasClass( this.namespace + '-state-disabled' );
},
_disableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.addClass(this.namespace + '-state-disabled')
.find("a").attr("aria-disabled", true);
this.element.find("option").eq(index).attr("disabled", "disabled");
}
},
_enableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.removeClass( this.namespace + '-state-disabled' )
.find("a").attr("aria-disabled", false);
this.element.find("option").eq(index).removeAttr("disabled");
}
},
_disableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.addClass(this.namespace + '-state-disabled')
.attr("aria-disabled", true);
this.element.find("optgroup").eq(index).attr("disabled", "disabled");
}
},
_enableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.removeClass(this.namespace + '-state-disabled')
.attr("aria-disabled", false);
this.element.find("optgroup").eq(index).removeAttr("disabled");
}
},
index: function(newValue) {
if (arguments.length) {
if (!this._disabled($(this._optionLis[newValue]))) {
this.element[0].selectedIndex = newValue;
this._refreshValue();
} else {
return false;
}
} else {
return this._selectedIndex();
}
},
value: function(newValue) {
if (arguments.length) {
this.element[0].value = newValue;
this._refreshValue();
} else {
return this.element[0].value;
}
},
_refreshValue: function() {
var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
// deselect previous
this.list
.find('.' + this.widgetBaseClass + '-item-selected')
.removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'false')
.attr('id', '');
// select new
this._selectedOptionLi()
.addClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'true')
.attr('id', activeID);
// toggle any class brought in from option
var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "");
var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "");
this.newelement
.removeClass(currentOptionClasses)
.data('optionClasses', newOptionClasses)
.addClass( newOptionClasses )
.find('.' + this.widgetBaseClass + '-status')
.html(
this._selectedOptionLi()
.find('a:eq(0)')
.html()
);
this.list.attr('aria-activedescendant', activeID);
},
_refreshPosition: function() {
var o = this.options;
// if its a native pop-up we need to calculate the position of the selected li
if ( o.style == "popup" && !o.positionOptions.offset ) {
var selected = this._selectedOptionLi();
var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top );
}
// update zIndex if jQuery UI is able to process
var zIndexElement = this.element.zIndex();
if ( zIndexElement ) {
this.listWrap.css( 'zIndex', zIndexElement );
}
this.listWrap.position({
// set options for position plugin
of: o.positionOptions.of || this.newelement,
my: o.positionOptions.my,
at: o.positionOptions.at,
offset: o.positionOptions.offset || _offset,
collision: o.positionOptions.collision || 'flip'
});
}
});
})(jQuery);
......@@ -2,6 +2,8 @@
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* 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.
*= require jquery-ui/jquery-ui
*= require jquery-ui/jquery.ui.selectmenu
*= require_self
*= require_tree .
*/
......@@ -53,7 +53,6 @@ table.highlighttable pre{
text-align:left;
}
.git-empty .highlight {
@include round-borders-all(4px);
background:#eee;
......@@ -74,7 +73,6 @@ table.highlighttable pre{
box-shadow:0 5px 15px #000;
}
.hll { background-color: #ffffff }
.c { color: #888888; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
......
......@@ -157,7 +157,6 @@ table.round-borders {
background: transparent 9 !important;
}
#header-panel {
@include panel-color;
height:40px;
......@@ -230,7 +229,6 @@ a {
}
}
.view_file_content{
.old_line, .new_line {
background:#ECECEC;
......@@ -281,8 +279,6 @@ input.ssh_project_url {
text-align:center;
}
.day-commits-table li.commit {
cursor:pointer;
......@@ -599,7 +595,6 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
}
}
span{
border: 1px solid #aaa;
color:black;
......
......@@ -57,7 +57,6 @@ class IssuesController < ApplicationController
end
end
def destroy
return access_denied! unless can?(current_user, :admin_issue, @issue)
......
......@@ -15,7 +15,6 @@ class NotesController < ApplicationController
notify if params[:notify] == '1'
end
respond_to do |format|
format.html {redirect_to :back}
format.js
......
......@@ -22,7 +22,6 @@ class Snippet < ActiveRecord::Base
:presence => true,
:length => { :within => 0..10000 }
def self.content_types
[
".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
......
......@@ -23,7 +23,6 @@
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"}
:javascript
$(function() {
$( "#accordion" ).accordion(); });
......@@ -11,7 +11,6 @@
%b Since:
= @admin_team_member.updated_at
.span-10
.span-6
%b Access:
......
......@@ -2,5 +2,4 @@
= render 'form'
= link_to 'Back', admin_users_path, :class => "right lbutton"
......@@ -24,7 +24,6 @@
%b Twitter:
= @admin_user.twitter
.clear
= link_to 'Edit', edit_admin_user_path(@admin_user)
\|
......
......@@ -39,6 +39,5 @@
- else
= check_box_tag "closed", 1, @issue.closed, :disabled => true
.clear
......@@ -22,7 +22,6 @@
</div>
</div>
<% if current_user %>
<%= javascript_tag do %>
$(function() {
......
......@@ -7,7 +7,6 @@
= stylesheet_link_tag 'blueprint/print', :media => "print"
= stylesheet_link_tag 'blueprint/plugins/buttons/screen', :media => "screen, projection"
= stylesheet_link_tag 'blueprint/plugins/link-icons/screen', :media => "screen, projection"
= stylesheet_link_tag 'jquery_ui/jquery-ui-1.8.16.custom', :media => "screen, projection"
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
......
......@@ -20,7 +20,6 @@
$("#submit_note").removeAttr("disabled");
})
- if ["issues", "projects"].include?(controller.controller_name)
:javascript
$(function(){
......
......@@ -21,3 +21,8 @@
%h3 Talk
=render "projects/recent_messages"
:javascript
function updateDashboard(){
$('#content-container').load("#{escape_javascript(project_path(@project))} #content-container>*");
}
setInterval("updateDashboard()", 300000);
......@@ -25,4 +25,3 @@
%b Twitter:
= user.twitter
......@@ -44,5 +44,8 @@ module Gitlab
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Extend assets path
config.assets.paths << Rails.root.join('vendor', 'assets', 'images', 'jquery-ui')
end
end
......@@ -58,7 +58,6 @@ Gitlab::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :sendmail
# Defaults to:
# # config.action_mailer.sendmail_settings = {
......
......@@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
t.timestamps
end
......
......@@ -25,7 +25,6 @@
text-decoration: none;
}
#page {
background-color: #f0f0f0;
width: 750px;
......@@ -57,7 +56,6 @@
padding-right: 30px;
}
#header {
background-image: url("/assets/rails.png");
background-repeat: no-repeat;
......@@ -71,7 +69,6 @@
font-size: 16px;
}
#about h3 {
margin: 0;
margin-bottom: 10px;
......@@ -112,7 +109,6 @@
padding: 10px;
}
#getting-started {
border-top: 1px solid #ccc;
margin-top: 25px;
......@@ -149,7 +145,6 @@
font-size: 13px;
}
#sidebar ul {
margin-left: 0;
padding-left: 0;
......
......@@ -29,7 +29,6 @@ describe "Profile" do
it { @user.twitter.should == 'testtwitter' }
end
describe "Password update" do
before do
visit profile_password_path
......
......@@ -11,7 +11,6 @@ require 'capybara/dsl'
require 'factories'
require 'monkeypatch'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
......
......@@ -6,7 +6,6 @@ shared_examples_for :project_side_pane do
it { should have_content("Tree") }
end
shared_examples_for :tree_view do
subject { page }
......
/*
* jQuery UI selectmenu dev version
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
* https://github.com/fnagel/jquery-ui/wiki/Selectmenu
*/
(function($) {
$.widget("ui.selectmenu", {
getter: "value",
version: "1.8",
eventPrefix: "selectmenu",
options: {
transferClasses: true,
typeAhead: "sequential",
style: 'dropdown',
positionOptions: {
my: "left top",
at: "left bottom",
offset: null
},
width: null,
menuWidth: null,
handleWidth: 26,
maxHeight: null,
icons: null,
format: null,
bgImage: function() {},
wrapperElement: "<div />"
},
_create: function() {
var self = this, o = this.options;
// 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 );
// quick array of button and menu id's
this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ];
// define safe mouseup for future toggling
this._safemouseup = true;
// create menu button wrapper
this.newelement = $( '<a />', {
'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all',
'id' : this.ids[ 0 ],
'role': 'button',
'href': '#nogo',
'tabindex': this.element.attr( 'disabled' ) ? 1 : 0,
'aria-haspopup': true,
'aria-owns': this.ids[ 1 ]
});
this.newelementWrap = $( o.wrapperElement )
.append( this.newelement )
.insertAfter( this.element );
// transfer tabindex
var tabindex = this.element.attr( 'tabindex' );
if ( tabindex ) {
this.newelement.attr( 'tabindex', tabindex );
}
// save reference to select in data for ease in calling methods
this.newelement.data( 'selectelement', this.element );
// menu icon
this.selectmenuIcon = $( '<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>' )
.prependTo( this.newelement );
// append status span to button
this.newelement.prepend( '<span class="' + self.widgetBaseClass + '-status" />' );
// make associated form label trigger focus
$( 'label[for="' + selectmenuId + '"]' )
.attr( 'for', this.ids[0] )
.bind( 'click.selectmenu', function() {
self.newelement[0].focus();
return false;
});
// click toggle for menu visibility
this.newelement
.bind('mousedown.selectmenu', function(event) {
self._toggle(event, true);
// make sure a click won't open/close instantly
if (o.style == "popup") {
self._safemouseup = false;
setTimeout(function() { self._safemouseup = true; }, 300);
}
return false;
})
.bind('click.selectmenu', function() {
return false;
})
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.ENTER:
ret = true;
break;
case $.ui.keyCode.SPACE:
self._toggle(event);
break;
case $.ui.keyCode.UP:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.open(event);
} else {
self._moveSelection(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveSelection(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveSelection(1);
break;
case $.ui.keyCode.TAB:
ret = true;
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'mouseup');
return true;
})
.bind('mouseover.selectmenu focus.selectmenu', function() {
if (!o.disabled) {
$(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
}
})
.bind('mouseout.selectmenu blur.selectmenu', function() {
if (!o.disabled) {
$(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover');
}
});
// document click closes menu
$(document).bind("mousedown.selectmenu", function(event) {
self.close(event);
});
// change event on original selectmenu
this.element
.bind("click.selectmenu", function() {
self._refreshValue();
})
// FIXME: newelement can be null under unclear circumstances in IE8
// TODO not sure if this is still a problem (fnagel 20.03.11)
.bind("focus.selectmenu", function() {
if (self.newelement) {
self.newelement[0].focus();
}
});
// set width when not set via options
if (!o.width) {
o.width = this.element.outerWidth();
}
// set menu button width
this.newelement.width(o.width);
// hide original selectmenu element
this.element.hide();
// create menu portion, append to body
this.list = $( '<ul />', {
'class': 'ui-widget ui-widget-content',
'aria-hidden': true,
'role': 'listbox',
'aria-labelledby': this.ids[0],
'id': this.ids[1]
});
this.listWrap = $( o.wrapperElement )
.addClass( self.widgetBaseClass + '-menu' )
.append( this.list )
.appendTo( 'body' );
// transfer menu click to menu button
this.list
.bind("keydown.selectmenu", function(event) {
var ret = false;
switch (event.keyCode) {
case $.ui.keyCode.UP:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(-1);
}
break;
case $.ui.keyCode.DOWN:
if (event.altKey) {
self.close(event, true);
} else {
self._moveFocus(1);
}
break;
case $.ui.keyCode.LEFT:
self._moveFocus(-1);
break;
case $.ui.keyCode.RIGHT:
self._moveFocus(1);
break;
case $.ui.keyCode.HOME:
self._moveFocus(':first');
break;
case $.ui.keyCode.PAGE_UP:
self._scrollPage('up');
break;
case $.ui.keyCode.PAGE_DOWN:
self._scrollPage('down');
break;
case $.ui.keyCode.END:
self._moveFocus(':last');
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.TAB:
ret = true;
self.close(event, true);
$(event.target).parents('li:eq(0)').trigger('mouseup');
break;
case $.ui.keyCode.ESCAPE:
self.close(event, true);
break;
default:
ret = true;
}
return ret;
})
.bind('keypress.selectmenu', function(event) {
self._typeAhead(event.which, 'focus');
return true;
})
// this allows for using the scrollbar in an overflowed list
.bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; });
// needed when window is resized
// TODO seems to be useless, but causes errors (fnagel 01.08.11)
// see: https://github.com/fnagel/jquery-ui/issues/147
// $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) );
},
_init: function() {
var self = this, o = this.options;
// serialize selectmenu element options
var selectOptionData = [];
this.element
.find('option')
.each(function() {
var opt = $(this);
selectOptionData.push({
value: opt.attr('value'),
text: self._formatText(opt.text()),
selected: opt.attr('selected'),
disabled: opt.attr('disabled'),
classes: opt.attr('class'),
typeahead: opt.attr('typeahead'),
parentOptGroup: opt.parent('optgroup'),
bgImage: o.bgImage.call(opt)
});
});
// active state class is only used in popup style
var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";
// empty list so we can refresh the selectmenu via selectmenu()
this.list.html("");
// write li's
if (selectOptionData.length) {
for (var i = 0; i < selectOptionData.length; i++) {
var thisLiAttr = { role : 'presentation' };
if ( selectOptionData[ i ].disabled ) {
thisLiAttr[ 'class' ] = this.namespace + '-state-disabled';
}
var thisAAttr = {
html: selectOptionData[i].text,
href : '#nogo',
tabindex : -1,
role : 'option',
'aria-selected' : false
};
if ( selectOptionData[ i ].disabled ) {
thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled;
}
if ( selectOptionData[ i ].typeahead ) {
thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead;
}
var thisA = $('<a/>', thisAAttr);
var thisLi = $('<li/>', thisLiAttr)
.append(thisA)
.data('index', i)
.addClass(selectOptionData[i].classes)
.data('optionClasses', selectOptionData[i].classes || '')
.bind("mouseup.selectmenu", function(event) {
if (self._safemouseup && !self._disabled(event.currentTarget) && !self._disabled($( event.currentTarget ).parents( "ul>li." + self.widgetBaseClass + "-group " )) ) {
var changed = $(this).data('index') != self._selectedIndex();
self.index($(this).data('index'));
self.select(event);
if (changed) {
self.change(event);
}
self.close(event, true);
}
return false;
})
.bind("click.selectmenu", function() {
return false;
})
.bind('mouseover.selectmenu focus.selectmenu', function(e) {
// no hover if diabled
if (!$(e.currentTarget).hasClass(self.namespace + '-state-disabled') && !$(e.currentTarget).parent("ul").parent("li").hasClass(self.namespace + '-state-disabled')) {
self._selectedOptionLi().addClass(activeClass);
self._focusedOptionLi().removeClass(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() {
if ($(this).is(self._selectedOptionLi().selector)) {
$(this).addClass(activeClass);
}
$(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
});
// optgroup or not...
if ( selectOptionData[i].parentOptGroup.length ) {
var optGroupName = self.widgetBaseClass + '-group-' + this.element.find( 'optgroup' ).index( selectOptionData[i].parentOptGroup );
if (this.list.find( 'li.' + optGroupName ).length ) {
this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi );
} 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> ')
.appendTo( this.list )
.find( 'ul' )
.append( thisLi );
}
} else {
thisLi.appendTo(this.list);
}
// append icon if option is specified
if (o.icons) {
for (var j in o.icons) {
if (thisLi.is(o.icons[j].find)) {
thisLi
.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
.addClass(self.widgetBaseClass + '-hasIcon');
var iconClass = o.icons[j].icon || "";
thisLi
.find('a:eq(0)')
.prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>');
if (selectOptionData[i].bgImage) {
thisLi.find('span').css('background-image', selectOptionData[i].bgImage);
}
}
}
}
}
} else {
$('<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
var isDropDown = ( o.style == 'dropdown' );
this.newelement
.toggleClass( self.widgetBaseClass + '-dropdown', isDropDown )
.toggleClass( self.widgetBaseClass + '-popup', !isDropDown );
this.list
.toggleClass( self.widgetBaseClass + '-menu-dropdown ui-corner-bottom', isDropDown )
.toggleClass( self.widgetBaseClass + '-menu-popup ui-corner-all', !isDropDown )
// add corners to top and bottom menu items
.find( 'li:first' )
.toggleClass( 'ui-corner-top', !isDropDown )
.end().find( 'li:last' )
.addClass( 'ui-corner-bottom' );
this.selectmenuIcon
.toggleClass( 'ui-icon-triangle-1-s', isDropDown )
.toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown );
// transfer classes to selectmenu and list
if ( o.transferClasses ) {
var transferClasses = this.element.attr( 'class' ) || '';
this.newelement.add( this.list ).addClass( transferClasses );
}
// set menu width to either menuWidth option value, width option value, or select width
if ( o.style == 'dropdown' ) {
this.list.width( o.menuWidth ? o.menuWidth : o.width );
} else {
this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth );
}
// reset height to auto
this.list.css( 'height', 'auto' );
var listH = this.listWrap.height();
// calculate default max height
if ( o.maxHeight && o.maxHeight < listH ) {
this.list.height( o.maxHeight );
} else {
var winH = $( window ).height() / 3;
if ( winH < listH ) this.list.height( winH );
}
// save reference to actionable li's (not group label li's)
this._optionLis = this.list.find( 'li:not(.' + self.widgetBaseClass + '-group)' );
// transfer disabled state
if ( this.element.attr( 'disabled' ) ) {
this.disable();
} else {
this.enable()
}
// update value
this.index( this._selectedIndex() );
// needed when selectmenu is placed at the very bottom / top of the page
window.setTimeout( function() {
self._refreshPosition();
}, 200 );
},
destroy: function() {
this.element.removeData( this.widgetName )
.removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
.removeAttr( 'aria-disabled' )
.unbind( ".selectmenu" );
// TODO unneded as event binding has been disabled
// $( window ).unbind( ".selectmenu" );
$( document ).unbind( ".selectmenu" );
// unbind click on label, reset its for attr
$( 'label[for=' + this.newelement.attr('id') + ']' )
.attr( 'for', this.element.attr( 'id' ) )
.unbind( '.selectmenu' );
this.newelementWrap.remove();
this.listWrap.remove();
this.element.show();
// call widget destroy function
$.Widget.prototype.destroy.apply(this, arguments);
},
_typeAhead: function( code, eventType ){
var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
c = C.toLowerCase();
if ( self.options.typeAhead == 'sequential' ) {
// clear the timeout so we can use _prevChar
window.clearTimeout('ui.selectmenu-' + self.selectmenuId);
// define our find var
var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' );
function focusOptSeq( elem, ind, c ){
focusFound = true;
$( elem ).trigger( eventType );
typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c;
}
this.list.find( 'li a' ).each( function( i ) {
if ( !focusFound ) {
// allow the typeahead attribute on the option tag for a more specific lookup
var thisText = $( this ).attr( 'typeahead' ) || $(this).text();
if ( thisText.indexOf( find + C ) === 0 ) {
focusOptSeq( this, i, C );
} else if (thisText.indexOf(find+c) === 0 ) {
focusOptSeq( this, i, c );
}
}
});
// set a 1 second timeout for sequenctial typeahead
// keep this set even if we have no matches so it doesnt typeahead somewhere else
window.setTimeout( function( el ) {
self._prevChar = undefined;
}, 1000, self );
} else {
// define self._prevChar if needed
if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; }
focusFound = false;
function focusOpt( elem, ind ){
focusFound = true;
$( elem ).trigger( eventType );
self._prevChar[ 1 ] = ind;
}
this.list.find( 'li a' ).each(function( i ){
if (!focusFound){
var thisText = $(this).text();
if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) {
if (self._prevChar[0] == C){
if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); }
} else{
focusOpt( this, i );
}
}
}
});
this._prevChar[ 0 ] = C;
}
},
// returns some usefull information, called by callbacks only
_uiHash: function() {
var index = this.index();
return {
index: index,
option: $("option", this.element).get(index),
value: this.element[0].value
};
},
open: function(event) {
var self = this, o = this.options;
if ( self.newelement.attr("aria-disabled") != 'true' ) {
self._closeOthers(event);
self.newelement.addClass('ui-state-active');
self.listWrap.appendTo( o.appendTo );
self.list.attr('aria-hidden', false);
if ( o.style == "dropdown" ) {
self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
}
self.listWrap.addClass( self.widgetBaseClass + '-open' );
// positioning needed for IE7 (tested 01.08.11 on MS VPC Image)
// see https://github.com/fnagel/jquery-ui/issues/147
if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) {
self._refreshPosition();
}
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();
// positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image)
self._refreshPosition();
self._trigger("open", event, self._uiHash());
}
},
close: function(event, retainFocus) {
if ( this.newelement.is('.ui-state-active') ) {
this.newelement
.removeClass('ui-state-active');
this.listWrap.removeClass(this.widgetBaseClass + '-open');
this.list.attr('aria-hidden', true);
if ( this.options.style == "dropdown" ) {
this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all');
}
if ( retainFocus ) {
this.newelement.focus();
}
this._trigger("close", event, this._uiHash());
}
},
change: function(event) {
this.element.trigger("change");
this._trigger("change", event, this._uiHash());
},
select: function(event) {
if (this._disabled(event.currentTarget)) { return false; }
this._trigger("select", event, this._uiHash());
},
_closeOthers: function(event) {
$('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() {
$(this).data('selectelement').selectmenu('close', event);
});
$('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout');
},
_toggle: function(event, retainFocus) {
if ( this.list.parent().is('.' + this.widgetBaseClass + '-open') ) {
this.close(event, retainFocus);
} else {
this.open(event);
}
},
_formatText: function(text) {
return (this.options.format ? this.options.format(text) : text);
},
_selectedIndex: function() {
return this.element[0].selectedIndex;
},
_selectedOptionLi: function() {
return this._optionLis.eq(this._selectedIndex());
},
_focusedOptionLi: function() {
return this.list.find('.' + this.widgetBaseClass + '-item-focus');
},
_moveSelection: function(amt, recIndex) {
// do nothing if disabled
if (!this.options.disabled) {
var currIndex = parseInt(this._selectedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
// do not loop when using up key
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
// Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveSelection(amt, newIndex);
} else {
return this._optionLis.eq(newIndex).trigger('mouseup');
}
}
},
_moveFocus: function(amt, recIndex) {
if (!isNaN(amt)) {
var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
var newIndex = currIndex + amt;
} else {
var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10);
}
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > this._optionLis.size() - 1) {
newIndex = this._optionLis.size() - 1;
}
//Occurs when a full loop has been made
if (newIndex === recIndex) { return false; }
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
this._focusedOptionLi().find('a:eq(0)').attr('id', '');
if (this._optionLis.eq(newIndex).hasClass( this.namespace + '-state-disabled' )) {
// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
(amt > 0) ? ++amt : --amt;
this._moveFocus(amt, newIndex);
} else {
this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID).focus();
}
this.list.attr('aria-activedescendant', activeID);
},
_scrollPage: function(direction) {
var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
numPerPage = (direction == 'up' ? -numPerPage : numPerPage);
this._moveFocus(numPerPage);
},
_setOption: function(key, value) {
this.options[key] = value;
// set
if (key == 'disabled') {
this.close();
this.element
.add(this.newelement)
.add(this.list)[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled' + ' ' +
this.namespace + '-state-disabled')
.attr("aria-disabled", value);
}
},
disable: function(index, type){
// if options is not provided, call the parents disable function
if ( typeof( index ) == 'undefined' ) {
this._setOption( 'disabled', true );
} else {
if ( type == "optgroup" ) {
this._disableOptgroup(index);
} else {
this._disableOption(index);
}
}
},
enable: function(index, type) {
// if options is not provided, call the parents enable function
if ( typeof( index ) == 'undefined' ) {
this._setOption('disabled', false);
} else {
if ( type == "optgroup" ) {
this._enableOptgroup(index);
} else {
this._enableOption(index);
}
}
},
_disabled: function(elem) {
return $(elem).hasClass( this.namespace + '-state-disabled' );
},
_disableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.addClass(this.namespace + '-state-disabled')
.find("a").attr("aria-disabled", true);
this.element.find("option").eq(index).attr("disabled", "disabled");
}
},
_enableOption: function(index) {
var optionElem = this._optionLis.eq(index);
if (optionElem) {
optionElem.removeClass( this.namespace + '-state-disabled' )
.find("a").attr("aria-disabled", false);
this.element.find("option").eq(index).removeAttr("disabled");
}
},
_disableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.addClass(this.namespace + '-state-disabled')
.attr("aria-disabled", true);
this.element.find("optgroup").eq(index).attr("disabled", "disabled");
}
},
_enableOptgroup: function(index) {
var optGroupElem = this.list.find( 'li.' + this.widgetBaseClass + '-group-' + index );
if (optGroupElem) {
optGroupElem.removeClass(this.namespace + '-state-disabled')
.attr("aria-disabled", false);
this.element.find("optgroup").eq(index).removeAttr("disabled");
}
},
index: function(newValue) {
if (arguments.length) {
if (!this._disabled($(this._optionLis[newValue]))) {
this.element[0].selectedIndex = newValue;
this._refreshValue();
} else {
return false;
}
} else {
return this._selectedIndex();
}
},
value: function(newValue) {
if (arguments.length) {
this.element[0].value = newValue;
this._refreshValue();
} else {
return this.element[0].value;
}
},
_refreshValue: function() {
var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000);
// deselect previous
this.list
.find('.' + this.widgetBaseClass + '-item-selected')
.removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'false')
.attr('id', '');
// select new
this._selectedOptionLi()
.addClass(this.widgetBaseClass + "-item-selected" + activeClass)
.find('a')
.attr('aria-selected', 'true')
.attr('id', activeID);
// toggle any class brought in from option
var currentOptionClasses = (this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "");
var newOptionClasses = (this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "");
this.newelement
.removeClass(currentOptionClasses)
.data('optionClasses', newOptionClasses)
.addClass( newOptionClasses )
.find('.' + this.widgetBaseClass + '-status')
.html(
this._selectedOptionLi()
.find('a:eq(0)')
.html()
);
this.list.attr('aria-activedescendant', activeID);
},
_refreshPosition: function() {
var o = this.options;
// if its a native pop-up we need to calculate the position of the selected li
if ( o.style == "popup" && !o.positionOptions.offset ) {
var selected = this._selectedOptionLi();
var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top );
}
// update zIndex if jQuery UI is able to process
var zIndexElement = this.element.zIndex();
if ( zIndexElement ) {
this.listWrap.css( 'zIndex', zIndexElement );
}
this.listWrap.position({
// set options for position plugin
of: o.positionOptions.of || this.newelement,
my: o.positionOptions.my,
at: o.positionOptions.at,
offset: o.positionOptions.offset || _offset,
collision: o.positionOptions.collision || 'flip'
});
}
});
})(jQuery);
......@@ -59,26 +59,26 @@
.ui-widget { font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
.ui-widget-content { border: 1px solid #dddddd; background: #ffffff url(ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
.ui-widget-content a { color: #222222; }
.ui-widget-header { color: #222222; font-weight: bold; }
.ui-widget-header a { color: #222222; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
......@@ -89,14 +89,14 @@
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
.ui-icon { width: 16px; height: 16px; background-image: url(ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(ui-icons_222222_256x240.png); }
.ui-state-default .ui-icon { background-image: url(ui-icons_888888_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-icons_454545_256x240.png); }
.ui-state-active .ui-icon {background-image: url(ui-icons_454545_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(ui-icons_2e83ff_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-icons_cd0a0a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
......@@ -286,8 +286,8 @@
/*.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }*/
/* Overlays */
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
.ui-widget-overlay { background: #aaaaaa url(ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
* jQuery UI Resizable 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
......
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