summaryrefslogtreecommitdiff
path: root/src/client/util.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-04-10 14:27:55 +0200
committerAlon Levy <alon@pobox.com>2015-04-10 14:27:55 +0200
commitf29bbaa624991cedc1bfdec06aeb254357472555 (patch)
treeda39751f28e1fafae379275eb7a2d15d0ca00fcf /src/client/util.js
parenta3691e04c8e43d2482fc7be3193455c8c72adc0e (diff)
client: hack to allow collaborator/person to be default (will fix today)
Diffstat (limited to 'src/client/util.js')
-rw-r--r--src/client/util.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/client/util.js b/src/client/util.js
index 88226a4d..fcb0eec7 100644
--- a/src/client/util.js
+++ b/src/client/util.js
@@ -1,6 +1,6 @@
"use strict"
-define(['jquery'], function($) {
+define(['underscore', 'jquery'], function(_, $) {
function assert(condition, message) {
if (false == condition) {
@@ -53,6 +53,16 @@ define(['jquery'], function($) {
return set_diff(sa, sb);
}
+ function first_contained(list, candidates, default_result) {
+ for (var k in candidates) {
+ var list_item = list[k];
+ if (_.contains(candidates, list_item)) {
+ return list_item;
+ }
+ };
+ return default_result;
+ }
+
// TODO: jquery BBQ: $.deparam.querystring().json;
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
@@ -251,6 +261,7 @@ define(['jquery'], function($) {
set_from_array: set_from_array,
set_from_object: set_from_object,
set_diff: set_diff,
+ first_contained: first_contained,
setSelection: setSelection,
selectionStart: selectionStart,