/*
* Copyright (c) 2014
*
* This file is licensed under the Affero General Public License version 3
* or later.
*
* See the COPYING-README file.
*
*/
(function(){
// TODO: move to a separate file
var MOUNT_OPTIONS_DROPDOWN_TEMPLATE =
'
' +
// FIXME: options are hard-coded for now
'
' +
' ' +
' ' +
'
' +
'
' +
' ' +
' ' +
'
' +
'
';
/**
* Returns the selection of applicable users in the given configuration row
*
* @param $row configuration row
* @return array array of user names
*/
function getSelection($row) {
var values = $row.find('.applicableUsers').select2('val');
if (!values || values.length === 0) {
values = [];
}
return values;
}
function highlightBorder($element, highlight) {
$element.toggleClass('warning-input', highlight);
return highlight;
}
function highlightInput($input) {
if ($input.attr('type') === 'text' || $input.attr('type') === 'password') {
return highlightBorder($input,
($input.val() === '' && !$input.hasClass('optional')));
}
}
/**
* Initialize select2 plugin on the given elements
*
* @param {Array