Merge branch 'dev'
5
Gemfile
|
@ -5,7 +5,7 @@ gem 'rails', '3.1.0'
|
|||
gem 'sqlite3'
|
||||
gem 'devise', "1.4.7"
|
||||
gem 'stamp'
|
||||
gem 'will_paginate', '~> 3.0'
|
||||
gem 'kaminari'
|
||||
gem 'haml-rails'
|
||||
gem 'jquery-rails'
|
||||
gem 'grit', :git => 'git://github.com/gitlabhq/grit.git'
|
||||
|
@ -16,7 +16,6 @@ gem 'faker'
|
|||
gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git'
|
||||
gem "inifile"
|
||||
gem "pygments.rb", "0.2.3"
|
||||
gem "kaminari"
|
||||
gem "thin"
|
||||
gem "git"
|
||||
gem "acts_as_list"
|
||||
|
@ -34,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'
|
||||
|
|
10
Gemfile.lock
|
@ -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)
|
||||
|
@ -232,7 +236,6 @@ GEM
|
|||
multi_json (>= 1.0.2)
|
||||
warden (1.0.5)
|
||||
rack (>= 1.0)
|
||||
will_paginate (3.0.0)
|
||||
xpath (0.1.4)
|
||||
nokogiri (~> 1.3)
|
||||
|
||||
|
@ -265,7 +268,7 @@ DEPENDENCIES
|
|||
ruby-debug19
|
||||
sass-rails (~> 3.1.0)
|
||||
seed-fu!
|
||||
shoulda
|
||||
shoulda (~> 3.0.0.beta2)
|
||||
simplecov
|
||||
six
|
||||
sqlite3
|
||||
|
@ -274,4 +277,3 @@ DEPENDENCIES
|
|||
thin
|
||||
turn
|
||||
uglifier
|
||||
will_paginate (~> 3.0)
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
845
app/assets/javascripts/jquery.ui.selectmenu.js
vendored
|
@ -1,845 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
|
@ -667,6 +662,10 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
|
|||
background: #4466cc;
|
||||
color:white;
|
||||
}
|
||||
&.normal {
|
||||
background: #2c5ca6;
|
||||
color:white;
|
||||
}
|
||||
&.notes {
|
||||
background: #2c5c66;
|
||||
color:white;
|
||||
|
@ -681,3 +680,23 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top_panel_issues{
|
||||
#issue_search_form {
|
||||
margin:5px 0;
|
||||
input {
|
||||
border:1px solid #D3D3D3;
|
||||
padding: 3px;
|
||||
height: 28px;
|
||||
width: 300px;
|
||||
-webkit-appearance:none;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
|
||||
&:focus {
|
||||
border-color:#c2e1ef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,29 +4,14 @@ class Admin::ProjectsController < ApplicationController
|
|||
|
||||
def index
|
||||
@admin_projects = Project.page(params[:page])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @admin_projects }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@admin_project = Project.find_by_code(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @admin_project }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@admin_project = Project.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @admin_project }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -37,28 +22,20 @@ class Admin::ProjectsController < ApplicationController
|
|||
@admin_project = Project.new(params[:project])
|
||||
@admin_project.owner = current_user
|
||||
|
||||
respond_to do |format|
|
||||
if @admin_project.save
|
||||
format.html { redirect_to [:admin, @admin_project], notice: 'Project was successfully created.' }
|
||||
format.json { render json: @admin_project, status: :created, location: @admin_project }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @admin_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
if @admin_project.save
|
||||
redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
|
||||
else
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@admin_project = Project.find_by_code(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @admin_project.update_attributes(params[:project])
|
||||
format.html { redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' }
|
||||
format.json { head :ok }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @admin_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
if @admin_project.update_attributes(params[:project])
|
||||
redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -66,9 +43,6 @@ class Admin::ProjectsController < ApplicationController
|
|||
@admin_project = Project.find_by_code(params[:id])
|
||||
@admin_project.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_projects_url }
|
||||
format.json { head :ok }
|
||||
end
|
||||
redirect_to admin_projects_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,29 +4,14 @@ class Admin::TeamMembersController < ApplicationController
|
|||
|
||||
def index
|
||||
@admin_team_members = UsersProject.page(params[:page]).per(100).order("project_id DESC")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @admin_team_members }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@admin_team_member = UsersProject.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @admin_team_member }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@admin_team_member = UsersProject.new(params[:team_member])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @admin_team_member }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -37,14 +22,10 @@ class Admin::TeamMembersController < ApplicationController
|
|||
@admin_team_member = UsersProject.new(params[:team_member])
|
||||
@admin_team_member.project_id = params[:team_member][:project_id]
|
||||
|
||||
respond_to do |format|
|
||||
if @admin_team_member.save
|
||||
format.html { redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.' }
|
||||
format.json { render json: @admin_team_member, status: :created, location: @team_member }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @admin_team_member.errors, status: :unprocessable_entity }
|
||||
end
|
||||
if @admin_team_member.save
|
||||
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.'
|
||||
else
|
||||
render action: "new"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -52,14 +33,10 @@ class Admin::TeamMembersController < ApplicationController
|
|||
@admin_team_member = UsersProject.find(params[:id])
|
||||
@admin_team_member.project_id = params[:team_member][:project_id]
|
||||
|
||||
respond_to do |format|
|
||||
if @admin_team_member.update_attributes(params[:team_member])
|
||||
format.html { redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.' }
|
||||
format.json { head :ok }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @admin_team_member.errors, status: :unprocessable_entity }
|
||||
end
|
||||
if @admin_team_member.update_attributes(params[:team_member])
|
||||
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.'
|
||||
else
|
||||
render action: "edit"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,9 +44,6 @@ class Admin::TeamMembersController < ApplicationController
|
|||
@admin_team_member = UsersProject.find(params[:id])
|
||||
@admin_team_member.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_team_members_url }
|
||||
format.json { head :ok }
|
||||
end
|
||||
redirect_to admin_team_members_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,29 +4,14 @@ class Admin::UsersController < ApplicationController
|
|||
|
||||
def index
|
||||
@admin_users = User.page(params[:page])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @admin_users }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@admin_user = User.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @admin_user }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@admin_user = User.new(:projects_limit => 10)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @admin_user }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -34,7 +34,7 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@notes = @issue.notes
|
||||
@notes = @issue.notes.order("created_at ASC")
|
||||
@note = @project.notes.new(:noteable => @issue)
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,6 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
return access_denied! unless can?(current_user, :admin_issue, @issue)
|
||||
|
||||
|
@ -78,6 +77,22 @@ class IssuesController < ApplicationController
|
|||
render :nothing => true
|
||||
end
|
||||
|
||||
def search
|
||||
terms = params['terms']
|
||||
|
||||
@project = Project.find(params['project'])
|
||||
@issues = case params[:status].to_i
|
||||
when 1 then @project.issues
|
||||
when 2 then @project.issues.closed
|
||||
when 3 then @project.issues.opened.assigned(current_user)
|
||||
else @project.issues.opened
|
||||
end
|
||||
|
||||
@issues = @issues.where("title LIKE ? OR content LIKE ?", "%#{terms}%", "%#{terms}%") unless terms.blank?
|
||||
|
||||
render :partial => 'issues'
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def 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
|
||||
|
|
|
@ -115,7 +115,7 @@ class ProjectsController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.js do
|
||||
# disable 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["Pragma"] = "no-cache"
|
||||
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
||||
|
|
|
@ -1,2 +1,11 @@
|
|||
module SnippetsHelper
|
||||
def lifetime_select_options
|
||||
options = [
|
||||
['forever', nil],
|
||||
['1 day', "#{Date.current + 1.day}"],
|
||||
['1 week', "#{Date.current + 1.week}"],
|
||||
['1 month', "#{Date.current + 1.month}"]
|
||||
]
|
||||
options_for_select(options)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,9 +14,9 @@ class Issue < ActiveRecord::Base
|
|||
:presence => true,
|
||||
:length => { :within => 0..255 }
|
||||
|
||||
validates :content,
|
||||
:presence => true,
|
||||
:length => { :within => 0..2000 }
|
||||
#validates :content,
|
||||
#:presence => true,
|
||||
#:length => { :within => 0..2000 }
|
||||
|
||||
scope :critical, where(:critical => true)
|
||||
scope :non_critical, where(:critical => false)
|
||||
|
|
|
@ -13,7 +13,7 @@ class Note < ActiveRecord::Base
|
|||
|
||||
validates :note,
|
||||
:presence => true,
|
||||
:length => { :within => 0..255 }
|
||||
:length => { :within => 0..5000 }
|
||||
|
||||
validates :attachment,
|
||||
:file_size => {
|
||||
|
|
|
@ -22,6 +22,8 @@ class Snippet < ActiveRecord::Base
|
|||
:presence => true,
|
||||
:length => { :within => 0..10000 }
|
||||
|
||||
scope :fresh, order("created_at DESC")
|
||||
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
|
||||
|
||||
def self.content_types
|
||||
[
|
||||
|
@ -34,6 +36,10 @@ class Snippet < ActiveRecord::Base
|
|||
def colorize
|
||||
system_colorize(content, file_name)
|
||||
end
|
||||
|
||||
def expired?
|
||||
expires_at && expires_at < Time.current
|
||||
end
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
@ -47,5 +53,6 @@ end
|
|||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# file_name :string(255)
|
||||
# expires_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
@ -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)
|
||||
\|
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
- line_new = 0
|
||||
- lines_arr = diff.diff.lines.to_a
|
||||
- lines_arr.each do |line|
|
||||
- next if line.match(/^--- \/dev\/null/)
|
||||
- next if line.match(/^--- a/)
|
||||
- next if line.match(/^\+\+\+ b/)
|
||||
- if line.match(/^@@ -/)
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
.span-8
|
||||
= f.label :title
|
||||
= f.text_field :title, :style => "width:450px"
|
||||
.span-8
|
||||
= f.label :content
|
||||
= f.text_area :content, :style => "width:450px; height:130px"
|
||||
= f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255
|
||||
-#.span-8
|
||||
-#= f.label :content
|
||||
-#= f.text_area :content, :style => "width:450px; height:130px"
|
||||
.span-8.append-bottom
|
||||
= f.label :assignee_id
|
||||
= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) }
|
||||
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
|
||||
- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
|
||||
%td
|
||||
= image_tag "move.png" , :class => [:handle, :left]
|
||||
%td
|
||||
|
@ -7,7 +7,7 @@
|
|||
= truncate issue.assignee.name, :lenght => 20
|
||||
%td ##{issue.id}
|
||||
%td
|
||||
= html_escape issue.title
|
||||
= truncate(html_escape(issue.title), :length => 60)
|
||||
%br
|
||||
- if issue.critical
|
||||
%span.tag.high critical
|
||||
|
|
|
@ -1,27 +1,51 @@
|
|||
%div
|
||||
- if can? current_user, :write_issue, @project
|
||||
.left= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
|
||||
.right
|
||||
= form_tag project_issues_path(@project), :method => :get do
|
||||
.span-2
|
||||
= radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues"
|
||||
= label_tag "open_issues","Open"
|
||||
.span-2
|
||||
= radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues"
|
||||
= label_tag "closed_issues","Closed"
|
||||
.span-2
|
||||
= radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues"
|
||||
= label_tag "my_issues","To Me"
|
||||
.top_panel_issues
|
||||
- if can? current_user, :write_issue, @project
|
||||
%div{:class => "left", :style => "margin-right: 10px;" }
|
||||
= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
|
||||
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :left, :id => "issue_search_form" do
|
||||
= hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
|
||||
= search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }
|
||||
|
||||
.span-2
|
||||
= radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues"
|
||||
= label_tag "all_issues","All"
|
||||
.right
|
||||
= form_tag project_issues_path(@project), :method => :get do
|
||||
.span-2
|
||||
= radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"
|
||||
= label_tag "open_issues","Open"
|
||||
.span-2
|
||||
= radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"
|
||||
= label_tag "closed_issues","Closed"
|
||||
.span-2
|
||||
= radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"
|
||||
= label_tag "my_issues","To Me"
|
||||
.span-2
|
||||
= radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"
|
||||
= label_tag "all_issues","All"
|
||||
|
||||
#issues-table-holder= render "issues"
|
||||
%br
|
||||
:javascript
|
||||
var href = $('.issue_search').parent().attr('action');
|
||||
var last_terms = '';
|
||||
|
||||
$('.issue_search').keyup(function() {
|
||||
var terms = $(this).val();
|
||||
var project_id = $('#project_id').val();
|
||||
var status = $('.status:checked').val();
|
||||
if (terms != last_terms) {
|
||||
last_terms = terms;
|
||||
|
||||
if (terms.length >= 2 || terms.length == 0) {
|
||||
$.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
|
||||
$('#issues-table').html(response);
|
||||
setSortable();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.delete-issue').live('ajax:success', function() {
|
||||
$(this).closest('tr').fadeOut(); });
|
||||
$(this).closest('tr').fadeOut(); updatePage();});
|
||||
|
||||
function setSortable(){
|
||||
$('#issues-table>tbody').sortable({
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
%h2
|
||||
= "Issue ##{@issue.id} - #{@issue.title}"
|
||||
|
||||
= "Issue ##{@issue.id} - #{html_escape(@issue.title)}"
|
||||
.span-15
|
||||
= simple_format html_escape(@issue.content)
|
||||
-#= simple_format html_escape(@issue.content)
|
||||
.issue_notes= render "notes/notes"
|
||||
.span-8.right
|
||||
.span-8
|
||||
|
@ -29,6 +28,16 @@
|
|||
%td
|
||||
= image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
|
||||
= @issue.assignee.name
|
||||
%tr
|
||||
%td Tags
|
||||
%td
|
||||
- if @issue.critical
|
||||
%span.tag.high critical
|
||||
- else
|
||||
%span.tag.normal normal
|
||||
|
||||
- if @issue.today?
|
||||
%span.tag.today today
|
||||
%tr
|
||||
%td Closed?
|
||||
%td
|
||||
|
@ -40,5 +49,9 @@
|
|||
= check_box_tag "closed", 1, @issue.closed, :disabled => true
|
||||
|
||||
|
||||
- if can?(current_user, :admin_issue, @issue)
|
||||
.clear
|
||||
= link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "lbutton positive", :remote => true
|
||||
.right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}"
|
||||
.clear
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
- if @issue.valid?
|
||||
:plain
|
||||
$("#edit_issue_dialog").dialog("close");
|
||||
$.ajax({type: "GET", url: location.href, dataType: "script"});
|
||||
updatePage();
|
||||
- else
|
||||
:plain
|
||||
$("#edit_issue_dialog").empty();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
%div
|
||||
= f.label :note
|
||||
%cite (255 symbols only)
|
||||
%cite
|
||||
%br
|
||||
= f.text_area :note, :size => 255
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
$("#submit_note").removeAttr("disabled");
|
||||
})
|
||||
|
||||
|
||||
- if ["issues", "projects"].include?(controller.controller_name)
|
||||
:javascript
|
||||
$(function(){
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
= link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
|
||||
Snippets
|
||||
- if @project.snippets.count > 0
|
||||
%span{ :class => "top_menu_count" }= @project.snippets.count
|
||||
%span{ :class => "top_menu_count" }= @project.snippets.non_expired.count
|
||||
|
||||
- if @commit
|
||||
%span= link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
%tr
|
||||
%td= f.label :file_name
|
||||
%td= f.text_field :file_name, :placeholder => "example.rb"
|
||||
%tr
|
||||
%td= f.label "Lifetime"
|
||||
%td= f.select :expires_at, lifetime_select_options
|
||||
%tr
|
||||
%td{:colspan => 2}
|
||||
= f.label :content, "Code"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
%tr{ :id => dom_id(snippet), :class => "snippet", :url => project_snippet_path(@project, snippet) }
|
||||
%td
|
||||
= image_tag gravatar_icon(snippet.author.email), :class => "left", :width => 40, :style => "padding:0 5px;"
|
||||
= truncate snippet.author.name, :lenght => 20
|
||||
%td= html_escape snippet.title
|
||||
%td= html_escape snippet.file_name
|
||||
%td
|
||||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user
|
||||
= link_to 'Edit', edit_project_snippet_path(@project, snippet), :class => "lbutton positive"
|
||||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user
|
||||
= link_to 'Destroy', [@project, snippet], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{snippet.id}"
|
||||
- unless snippet.expired?
|
||||
%tr{ :id => dom_id(snippet), :class => "snippet", :url => project_snippet_path(@project, snippet) }
|
||||
%td
|
||||
= image_tag gravatar_icon(snippet.author.email), :class => "left", :width => 40, :style => "padding:0 5px;"
|
||||
= truncate snippet.author.name, :lenght => 20
|
||||
%td= html_escape snippet.title
|
||||
%td= html_escape snippet.file_name
|
||||
%td
|
||||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user
|
||||
= link_to 'Edit', edit_project_snippet_path(@project, snippet), :class => "lbutton positive"
|
||||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user
|
||||
= link_to 'Destroy', [@project, snippet], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{snippet.id}"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
%th Title
|
||||
%th File name
|
||||
%th
|
||||
= render @snippets
|
||||
= render @snippets.fresh
|
||||
:javascript
|
||||
$('.delete-snippet').live('ajax:success', function() {
|
||||
$(this).closest('tr').fadeOut(); });
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
%h2
|
||||
= "Snippet ##{@snippet.id} - #{@snippet.title}"
|
||||
- if !@snippet.expired?
|
||||
%h2
|
||||
= "Snippet ##{@snippet.id} - #{@snippet.title}"
|
||||
|
||||
.view_file
|
||||
.view_file_header
|
||||
%strong
|
||||
= @snippet.file_name
|
||||
%br/
|
||||
.view_file_content
|
||||
:erb
|
||||
<%= raw @snippet.colorize %>
|
||||
.view_file
|
||||
.view_file_header
|
||||
%strong
|
||||
= @snippet.file_name
|
||||
%br/
|
||||
.view_file_content
|
||||
:erb
|
||||
<%= raw @snippet.colorize %>
|
||||
|
||||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
|
||||
= link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive"
|
||||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
|
||||
= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}"
|
||||
.clear
|
||||
%br
|
||||
.snippet_notes= render "notes/notes"
|
||||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
|
||||
= link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive"
|
||||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
|
||||
= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}"
|
||||
.clear
|
||||
%br
|
||||
.snippet_notes= render "notes/notes"
|
||||
|
||||
.clear
|
||||
.clear
|
||||
|
||||
- else
|
||||
%h2
|
||||
Sorry, this snippet is no longer exists
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -47,6 +47,9 @@ Gitlab::Application.routes.draw do
|
|||
collection do
|
||||
post :sort
|
||||
end
|
||||
collection do
|
||||
get :search
|
||||
end
|
||||
end
|
||||
resources :notes, :only => [:create, :destroy]
|
||||
end
|
||||
|
|
|
@ -11,7 +11,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
|
|||
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
|
||||
# t.token_authenticatable
|
||||
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
|
|
5
db/migrate/20111027051828_add_expires_at_to_snippets.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddExpiresAtToSnippets < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :snippets, :expires_at, :datetime
|
||||
end
|
||||
end
|
8
db/migrate/20111027142641_change_note_note_to_text.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class ChangeNoteNoteToText < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :notes, :note, :text, :limit => false
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
34
db/migrate/20111027152724_issue_conten_to_note.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
class IssueContenToNote < ActiveRecord::Migration
|
||||
def up
|
||||
puts "Issue content is deprecated -> move to notes"
|
||||
Issue.find_each(:batch_size => 100) do |issue|
|
||||
next if issue.content.blank?
|
||||
note = Note.new(
|
||||
:note => issue.content,
|
||||
:project_id => issue.project_id,
|
||||
:noteable => issue,
|
||||
:created_at => issue.created_at,
|
||||
:updated_at => issue.created_at
|
||||
)
|
||||
note.author_id = issue.author_id
|
||||
|
||||
if note.save
|
||||
issue.update_attributes(:content => nil)
|
||||
print "."
|
||||
else
|
||||
print "F"
|
||||
end
|
||||
end
|
||||
|
||||
total = Issue.where("content is not null").count
|
||||
|
||||
if total > 0
|
||||
puts "content of #{total} issues were not migrated"
|
||||
else
|
||||
puts "Done"
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20111025134235) do
|
||||
ActiveRecord::Schema.define(:version => 20111027152724) do
|
||||
|
||||
create_table "issues", :force => true do |t|
|
||||
t.string "title"
|
||||
|
@ -36,7 +36,7 @@ ActiveRecord::Schema.define(:version => 20111025134235) do
|
|||
end
|
||||
|
||||
create_table "notes", :force => true do |t|
|
||||
t.string "note"
|
||||
t.text "note"
|
||||
t.string "noteable_id"
|
||||
t.string "noteable_type"
|
||||
t.integer "author_id"
|
||||
|
@ -65,6 +65,7 @@ ActiveRecord::Schema.define(:version => 20111025134235) do
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "file_name"
|
||||
t.datetime "expires_at"
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -32,7 +32,6 @@ end
|
|||
|
||||
Factory.add(:issue, Issue) do |obj|
|
||||
obj.title = Faker::Lorem.sentence
|
||||
obj.content = Faker::Lorem.sentences
|
||||
end
|
||||
|
||||
Factory.add(:snippet, Snippet) do |obj|
|
||||
|
|
|
@ -26,5 +26,6 @@ end
|
|||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# file_name :string(255)
|
||||
# expires_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ describe "Issues" do
|
|||
describe "fill in" do
|
||||
before do
|
||||
fill_in "issue_title", :with => "bug 345"
|
||||
fill_in "issue_content", :with => "app bug 345"
|
||||
click_link "Select user"
|
||||
click_link @user.name
|
||||
end
|
||||
|
@ -112,6 +111,23 @@ describe "Issues" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "Show issue" do
|
||||
before do
|
||||
@issue = Factory :issue,
|
||||
:author => @user,
|
||||
:assignee => @user,
|
||||
:project => project
|
||||
|
||||
visit project_issue_path(project, @issue)
|
||||
end
|
||||
|
||||
it "should have valid show page for issue" do
|
||||
page.should have_content @issue.title
|
||||
page.should have_content @user.name
|
||||
page.should have_content "today"
|
||||
end
|
||||
end
|
||||
|
||||
describe "Edit issue", :js => true do
|
||||
before do
|
||||
@issue = Factory :issue,
|
||||
|
@ -129,7 +145,6 @@ describe "Issues" do
|
|||
describe "fill in" do
|
||||
before do
|
||||
fill_in "issue_title", :with => "bug 345"
|
||||
fill_in "issue_content", :with => "app bug 345"
|
||||
end
|
||||
|
||||
it { expect { click_button "Save" }.to_not change {Issue.count} }
|
||||
|
@ -144,4 +159,51 @@ describe "Issues" do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "Search issue", :js => true do
|
||||
before do
|
||||
['foobar', 'foobar2', 'gitlab'].each do |title|
|
||||
@issue = Factory :issue,
|
||||
:author => @user,
|
||||
:assignee => @user,
|
||||
:project => project,
|
||||
:title => title
|
||||
@issue.save
|
||||
end
|
||||
end
|
||||
|
||||
it "should be able to search on different statuses" do
|
||||
@issue = Issue.first
|
||||
@issue.closed = true
|
||||
@issue.save
|
||||
|
||||
visit project_issues_path(project)
|
||||
choose 'closed_issues'
|
||||
fill_in 'issue_search', :with => 'foobar'
|
||||
|
||||
page.should have_content 'foobar'
|
||||
page.should_not have_content 'foobar2'
|
||||
page.should_not have_content 'gitlab'
|
||||
end
|
||||
|
||||
it "should search for term and return the correct results" do
|
||||
visit project_issues_path(project)
|
||||
fill_in 'issue_search', :with => 'foobar'
|
||||
|
||||
page.should have_content 'foobar'
|
||||
page.should have_content 'foobar2'
|
||||
page.should_not have_content 'gitlab'
|
||||
end
|
||||
|
||||
it "should return all results if term has been cleared" do
|
||||
visit project_issues_path(project)
|
||||
fill_in "issue_search", :with => "foobar"
|
||||
# Because fill_in, :with => "" triggers nothing we need to trigger a keyup event
|
||||
page.execute_script("$('.issue_search').val('').keyup();");
|
||||
|
||||
page.should have_content 'foobar'
|
||||
page.should have_content 'foobar2'
|
||||
page.should have_content 'gitlab'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,6 @@ describe "Profile" do
|
|||
it { @user.twitter.should == 'testtwitter' }
|
||||
end
|
||||
|
||||
|
||||
describe "Password update" do
|
||||
before do
|
||||
visit profile_password_path
|
||||
|
|
|
@ -23,6 +23,14 @@ describe "Snippets" do
|
|||
it { should have_content(@snippet.project.name) }
|
||||
it { should have_content(@snippet.author.name) }
|
||||
|
||||
it "doesn't show expired snippets" do
|
||||
@snippet.update_attribute(:expires_at, 1.day.ago.to_time)
|
||||
visit project_snippet_path(project, @snippet)
|
||||
page.should have_content("Sorry, this snippet is no longer exists")
|
||||
page.should_not have_content(@snippet.title)
|
||||
page.should_not have_content(@snippet.content)
|
||||
end
|
||||
|
||||
describe "Destroy" do
|
||||
before do
|
||||
# admin access to remove snippet
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 101 B After Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
@ -41,7 +41,7 @@ c);return this},enable:function(){return this._setOption("disabled",false)},disa
|
|||
* http://docs.jquery.com/UI/Mouse
|
||||
*
|
||||
* 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("."+
|
||||
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
|
|||
* http://docs.jquery.com/UI/Draggables
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.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==
|
||||
"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.
|
|||
* http://docs.jquery.com/UI/Droppables
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.draggable.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.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);
|
||||
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);
|
|||
* http://docs.jquery.com/UI/Resizables
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.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,
|
||||
_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
|
|||
* http://docs.jquery.com/UI/Selectables
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.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"),
|
||||
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("
|
|||
* http://docs.jquery.com/UI/Sortables
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.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");
|
||||
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
|
|||
* http://docs.jquery.com/UI/Accordion
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.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");
|
||||
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",
|
|||
* http://docs.jquery.com/UI/Autocomplete
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.position.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.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=
|
||||
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
|
|||
* http://docs.jquery.com/UI/Button
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.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!==
|
||||
"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);
|
|||
* http://docs.jquery.com/UI/Dialog
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.button.js
|
||||
* jquery.ui.draggable.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.position.js
|
||||
* jquery.ui.resizable.js
|
||||
* jquery.ui.draggable.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.position.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,
|
||||
position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
|
||||
|
@ -411,9 +411,9 @@ c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.b
|
|||
* http://docs.jquery.com/UI/Slider
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.mouse.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-"+
|
||||
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":
|
|||
* http://docs.jquery.com/UI/Tabs
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.core.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…</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=
|
||||
|
@ -479,7 +479,7 @@ a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow"
|
|||
* http://docs.jquery.com/UI/Datepicker
|
||||
*
|
||||
* 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=
|
||||
"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);
|
|||
* http://docs.jquery.com/UI/Effects/Blind
|
||||
*
|
||||
* 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,
|
||||
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
|
|||
* http://docs.jquery.com/UI/Effects/Bounce
|
||||
*
|
||||
* 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})/
|
||||
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"?"-=
|
|||
* http://docs.jquery.com/UI/Effects/Clip
|
||||
*
|
||||
* 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,
|
||||
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,
|
|||
* http://docs.jquery.com/UI/Effects/Drop
|
||||
*
|
||||
* 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==
|
||||
"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,
|
|||
* http://docs.jquery.com/UI/Effects/Explode
|
||||
*
|
||||
* 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=
|
||||
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
|
|||
* http://docs.jquery.com/UI/Effects/Fade
|
||||
*
|
||||
* 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);
|
||||
;/*
|
||||
|
@ -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
|
||||
*
|
||||
* 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],
|
||||
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
|
|||
* http://docs.jquery.com/UI/Effects/Highlight
|
||||
*
|
||||
* 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&&
|
||||
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
|
|||
* http://docs.jquery.com/UI/Effects/Pulsate
|
||||
*
|
||||
* 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,
|
||||
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(
|
|||
* http://docs.jquery.com/UI/Effects/Scale
|
||||
*
|
||||
* 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,
|
||||
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
|
|||
* http://docs.jquery.com/UI/Effects/Shake
|
||||
*
|
||||
* 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]=
|
||||
(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
|
|||
* http://docs.jquery.com/UI/Effects/Slide
|
||||
*
|
||||
* 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);
|
||||
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,7 +784,7 @@ var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{q
|
|||
* http://docs.jquery.com/UI/Effects/Transfer
|
||||
*
|
||||
* 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);
|
||||
b.dequeue()})})}})(jQuery);
|
844
vendor/assets/javascripts/jquery.ui.selectmenu.js
vendored
Normal file
|
@ -0,0 +1,844 @@
|
|||
/*
|
||||
* 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)
|