1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 07:08:55 +00:00

[select2] upgraded it to v4.0

This commit is contained in:
llj
2018-07-26 18:28:17 +08:00
parent d9fbe44381
commit 62c3519e85
35 changed files with 428 additions and 4568 deletions

View File

@@ -241,14 +241,13 @@ define([
$('[name="email"]', $form).select2($.extend(
Common.contactInputOptionsForSelect2(), {
width: '280px',
maximumSelectionSize: 1,
placeholder: gettext("Search user or enter email and press Enter"), // to override 'placeholder' returned by `Common.conta...`
formatSelectionTooBig: gettext("You cannot select any more choices")
maximumSelectionLength: 1,
placeholder: gettext("Search user or enter email and press Enter")
}));
$form.on('submit', function() {
var email = $.trim($('[name="email"]', $(this)).val());
if (!email) {
var email = $('[name="email"]', $(this)).val(); // []
if (!email.length) {
return false;
}
if (email == _this.model.get('owner')) {
@@ -266,7 +265,7 @@ define([
dataType: 'json',
beforeSend: Common.prepareCSRFToken,
data: {
'owner': email
'owner': email[0]
},
success: function() {
$.modal.close();
@@ -387,7 +386,12 @@ define([
});
}
$('#simplemodal-data').html($form);
$('[name="labels"]', $form).select2({tags: s2_data});
$('[name="labels"]', $form).select2({
language: Common.i18nForSelect2(),
width: '100%',
multiple: true,
tags: s2_data
});
},
error: function(xhr) {
var error_msg;
@@ -403,11 +407,11 @@ define([
$form.on('submit', function() {
var $input = $('[name="labels"]', $form);
var labels = $input.select2('val');
var labels = $input.val();
var $error = $('.error', $form);
var $submit = $('[type="submit"]', $form);
if (labels.length == 0) {
if (!labels.length) {
$error.html(gettext("It is required.")).show();
return false;
}