Use grid instead of three-column (fixes #2130)
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* m59peacemaker's filterStabilize
|
||||
*
|
||||
* See https://github.com/m59peacemaker/angular-pmkr-components/tree/master/src/filterStabilize
|
||||
* Released under the MIT license
|
||||
*/
|
||||
angular.module('syncthing.core')
|
||||
.factory('pmkr.filterStabilize', [
|
||||
'pmkr.memoize',
|
||||
function(memoize) {
|
||||
function service(fn) {
|
||||
function filter() {
|
||||
var args = [].slice.call(arguments);
|
||||
// always pass a copy of the args so that the original input can't be modified
|
||||
args = angular.copy(args);
|
||||
// return the `fn` return value or input reference (makes `fn` return optional)
|
||||
var filtered = fn.apply(this, args) || args[0];
|
||||
return filtered;
|
||||
}
|
||||
|
||||
var memoized = memoize(filter);
|
||||
return memoized;
|
||||
|
||||
}
|
||||
return service;
|
||||
}
|
||||
]);
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Groups input in chunks of the specified size
|
||||
*
|
||||
* E.g. [1, 2, 3, 4, 5] with groupSize = 3 => [[1, 2, 3], [4, 5]]
|
||||
* Uses pmkr.memoize to avoid infdig, see 'Johnny Hauser's "Filter Stablize" Solution'
|
||||
* here: http://sobrepere.com/blog/2014/10/14/creating-groupby-filter-angularjs/
|
||||
*/
|
||||
angular.module('syncthing.core')
|
||||
.filter('group', [
|
||||
'pmkr.filterStabilize',
|
||||
function (stabilize) {
|
||||
return stabilize(function(items, groupSize) {
|
||||
var groups = [];
|
||||
var inner;
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (i % groupSize === 0) {
|
||||
inner = [];
|
||||
groups.push(inner);
|
||||
}
|
||||
inner.push(items[i]);
|
||||
}
|
||||
return groups;
|
||||
});
|
||||
}
|
||||
]);
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* m59peacemaker's memoize
|
||||
*
|
||||
* See https://github.com/m59peacemaker/angular-pmkr-components/tree/master/src/memoize
|
||||
* Released under the MIT license
|
||||
*/
|
||||
angular.module('syncthing.core')
|
||||
.factory('pmkr.memoize', [
|
||||
function() {
|
||||
function service() {
|
||||
return memoizeFactory.apply(this, arguments);
|
||||
}
|
||||
function memoizeFactory(fn) {
|
||||
var cache = {};
|
||||
function memoized() {
|
||||
var args = [].slice.call(arguments);
|
||||
var key = JSON.stringify(args);
|
||||
if (cache.hasOwnProperty(key)) {
|
||||
return cache[key];
|
||||
}
|
||||
cache[key] = fn.apply(this, arguments);
|
||||
return cache[key];
|
||||
}
|
||||
return memoized;
|
||||
}
|
||||
return service;
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user