Merge branch 'master' into updated-gems
Conflicts: Gemfile Gemfile.lock
This commit is contained in:
commit
bdce1b5872
64 changed files with 1039 additions and 472 deletions
|
|
@ -7,6 +7,10 @@
|
|||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.de
|
||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.nl
|
||||
//= require jquery.observe_field
|
||||
//= require list
|
||||
//= require list.unlist
|
||||
//= require list.delay
|
||||
//= require list.reset
|
||||
//= require rails.validations
|
||||
//= require rails.validations.simple_form
|
||||
//= require_self
|
||||
|
|
|
|||
50
app/assets/javascripts/list.delay.js
Normal file
50
app/assets/javascripts/list.delay.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// for use with listjs 0.2.0
|
||||
// https://github.com/javve/list.js
|
||||
|
||||
(function(window, undefined) {
|
||||
|
||||
window.List.prototype.plugins.delay = function(locals, options) {
|
||||
var list = this;
|
||||
|
||||
this.searchTimeout = undefined;
|
||||
|
||||
var init = {
|
||||
start: function(options) {
|
||||
this.defaults(options);
|
||||
this.callbacks(options);
|
||||
this.onload(options);
|
||||
},
|
||||
defaults: function(options) {
|
||||
options.delayedSearchClass = options.delayedSearchClass || 'delayed-search';
|
||||
options.delayedSearchTime = options.delayedSearchTime || 500;
|
||||
},
|
||||
callbacks: function(options) {
|
||||
$('.' + options.delayedSearchClass, list.listContainer).keyup(list.searchDelayStart);
|
||||
},
|
||||
onload: function(options) {
|
||||
var initialSearchTerm = $('.' + options.delayedSearchClass, list.listContainer).val();
|
||||
if('' != initialSearchTerm) {
|
||||
list.search(initialSearchTerm);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.searchDelayStart = function(searchString, columns) {
|
||||
// TODO: if keycode corresponds to 'ENTER' ? skip delay
|
||||
clearTimeout(list.searchTimeout);
|
||||
list.searchTimeout = window.setTimeout(
|
||||
function() {list.searchDelayEnd(searchString, columns)},
|
||||
options.delayedSearchTime
|
||||
);
|
||||
|
||||
$(list.listContainer).trigger('updateComing');
|
||||
};
|
||||
|
||||
this.searchDelayEnd = function(searchString, columns) {
|
||||
list.search(searchString, columns);
|
||||
};
|
||||
|
||||
init.start(options);
|
||||
}
|
||||
|
||||
})(window);
|
||||
42
app/assets/javascripts/list.reset.js
Normal file
42
app/assets/javascripts/list.reset.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// for use with listjs 0.2.0
|
||||
// https://github.com/javve/list.js
|
||||
|
||||
(function(window, undefined) {
|
||||
|
||||
window.List.prototype.plugins.reset = function(locals, options) {
|
||||
var list = this;
|
||||
|
||||
var init = {
|
||||
start: function(options) {
|
||||
this.defaults(options);
|
||||
this.callbacks(options);
|
||||
},
|
||||
defaults: function(options) {
|
||||
options.highlightClass = options.highlightClass || 'btn-primary';
|
||||
options.resetSearchClass = options.resetSearchClass || 'reset-search';
|
||||
options.resettableClass = options.resettableClass || 'resettable';
|
||||
},
|
||||
callbacks: function(options) {
|
||||
$('.' + options.resetSearchClass, list.listContainer).click(list.resetSearch);
|
||||
list.on('updated', list.highlightResetButton);
|
||||
|
||||
$(list.listContainer).on('updateComing', function() {
|
||||
list.highlightResetButton(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.highlightResetButton = function(highlightEnabled) {
|
||||
highlightEnabled = (undefined === highlightEnabled) ? (list.searched) : (highlightEnabled);
|
||||
$('.' + options.resetSearchClass, list.listContainer).toggleClass(options.highlightClass, highlightEnabled);
|
||||
};
|
||||
|
||||
this.resetSearch = function() {
|
||||
$('.' + options.resettableClass, list.listContainer).val('');
|
||||
list.search('');
|
||||
};
|
||||
|
||||
init.start(options);
|
||||
}
|
||||
|
||||
})(window);
|
||||
124
app/assets/javascripts/list.unlist.js
Normal file
124
app/assets/javascripts/list.unlist.js
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
// for use with listjs 0.2.0
|
||||
// https://github.com/javve/list.js
|
||||
|
||||
/*******************************************************************************
|
||||
********************************************************************************
|
||||
|
||||
The following code is a modification of list.js. It was created by copy-pasting
|
||||
the original code with the copyright notice below.
|
||||
|
||||
********************************************************************************
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Begin copyright notice of the original code
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
ListJS Beta 0.2.0
|
||||
By Jonny Strömberg (www.jonnystromberg.com, www.listjs.com)
|
||||
|
||||
OBS. The API is not frozen. It MAY change!
|
||||
|
||||
License (MIT)
|
||||
|
||||
Copyright (c) 2011 Jonny Strömberg http://jonnystromberg.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
End copyright notice of the original code
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
|
||||
(function(w, undefined) {
|
||||
/*******************************************************************************
|
||||
Begin copy-pasted and modified code
|
||||
*******************************************************************************/
|
||||
|
||||
// * template engine which adds class 'unlisted' instead of removing from DOM
|
||||
// * especially useful in case of formulars
|
||||
// * uses jQuery's $
|
||||
w.List.prototype.templateEngines.unlist = function(list, settings) {
|
||||
var h = w.ListJsHelpers;
|
||||
|
||||
// start with standard engine, override specific methods afterwards
|
||||
this.superClass = w.List.prototype.templateEngines.standard;
|
||||
this.superClass(list, settings);
|
||||
|
||||
// todo refer to listjs code instead of copy-pasting
|
||||
var listSource = h.getByClass(settings.listClass, list.listContainer, true);
|
||||
var templater = this;
|
||||
var ensure = {
|
||||
created: function(item) {
|
||||
if(item.elm === undefined) {
|
||||
templater.create(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var init = {
|
||||
start: function(options) {
|
||||
this.defaults(options);
|
||||
this.callbacks(options);
|
||||
},
|
||||
defaults: function(options) {
|
||||
options.listHeadingsClass = options.listHeadingsClass || 'list-heading';
|
||||
},
|
||||
callbacks: function(options) {
|
||||
list.on('updated', templater.updateListHeadings);
|
||||
}
|
||||
};
|
||||
|
||||
this.show = function(item) {
|
||||
ensure.created(item);
|
||||
listSource.appendChild(item.elm); // append item (or move it to the end)
|
||||
$(item.elm).removeClass('unlisted');
|
||||
};
|
||||
this.hide = function(item) {
|
||||
ensure.created(item);
|
||||
$(item.elm).addClass('unlisted');
|
||||
listSource.appendChild(item.elm);
|
||||
};
|
||||
this.clear = function() {
|
||||
$(listSource.childNodes).addClass('unlisted');
|
||||
};
|
||||
|
||||
this.updateListHeadings = function() {
|
||||
var headSel = '.' + settings.listHeadingsClass;
|
||||
|
||||
$(headSel, listSource).each(function() {
|
||||
var listedCount = $(this).nextUntil(headSel, ':not(.unlisted)').length;
|
||||
$(this).toggleClass('unlisted', 0==listedCount);
|
||||
});
|
||||
};
|
||||
|
||||
init.start(settings);
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
End copy-pasted and modified code
|
||||
*******************************************************************************/
|
||||
})(window);
|
||||
Loading…
Add table
Add a link
Reference in a new issue