diff --git a/media/css/seahub.css b/media/css/seahub.css index 2b343ef7d3..aea2a33f6d 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -1817,38 +1817,39 @@ button.sf-dropdown-toggle:focus { text-align:center; } /**** custom select2 ****/ -.select2-container .select2-selection { - min-height:30px; - border-color:#ddd; - border-radius:2px; +.select2-container-multi .select2-choices { + border-color: #ddd; + border-radius: 2px; + background-image: none; /* rm the shadow */ +} +.select2-container-multi .select2-choices .select2-search-field { + float:none; +} +.select2-container-multi .select2-choices .select2-search-field input { + padding:2px 2px 2px 5px; + font-family:inherit; font-size:13px; - line-height:0; /* to remove the extra height */ } -.select2-container.select2-container--focus .select2-selection { - border-color: #66afe9; -} -.select2-container .select2-selection .select2-selection__rendered { - padding:0; -} -.select2-container .select2-selection .select2-selection__choice { +.select2-container-multi .select2-choices .select2-search-choice { border:none; + border-radius:0; background:#eee; - border-radius:2px; - margin:4px 0 0 5px; } -.select2-container--default .select2-search--inline .select2-search__field { - padding:0 5px; - box-sizing:content-box; +.select2-container .avatar, +.select2-results .select2-result-label .avatar { + vertical-align:middle; + margin-right:3px; } -.select2-results__option .avatar { - margin-right:10px; -} -.select2-results__option .text { +.select2-result-label .text { display:inline-block; width:calc(100% - 42px); } -.select2-container .select2-selection__rendered { - line-height:1.5; +.select2-results .select2-result-label .avatar { + margin-right:10px; +} +.select2-result-label .avatar, +.select2-result-label .text { + vertical-align:middle; } /**** custom magnificPopup ****/ .mfp-bottom-bar { diff --git a/media/js/base.js b/media/js/base.js index 9d4cebba49..d240ea823d 100644 --- a/media/js/base.js +++ b/media/js/base.js @@ -341,17 +341,7 @@ function HTMLescape(html){ function userInputOPtionsForSelect2(user_search_url) { return { - - // with 'tags', the user can directly enter, not just select - tags: true, - tokenSeparators: [',', ' '], - createTag: function(params) { - var term = $.trim(params.term); - return { - 'id': term, - 'text': term - }; - }, + tags: [], minimumInputLength: 1, // input at least 1 character @@ -362,10 +352,10 @@ function userInputOPtionsForSelect2(user_search_url) { cache: true, data: function (params) { return { - q: params.term + q: params }; }, - processResults: function(data) { + results: function (data) { var user_list = [], users = data['users']; for (var i = 0, len = users.length; i < len; i++) { user_list.push({ // 'id' & 'text' are required by the plugin @@ -384,19 +374,25 @@ function userInputOPtionsForSelect2(user_search_url) { }, // format items shown in the drop-down menu - templateResult: function(item) { + formatResult: function(item) { if (item.avatar_url) { - return '' + '' + HTMLescape(item.name) + '
' + HTMLescape(item.id) + '
'; + return '' + '' + HTMLescape(item.name) + '
' + HTMLescape(item.id) + '
'; } else { return; // if no match, show nothing } }, // format selected item shown in the input - templateSelection: function(item) { + formatSelection: function(item) { return HTMLescape(item.name || item.id); // if no name, show the email, i.e., when directly input, show the email }, + createSearchChoice: function(term) { + return { + 'id': $.trim(term) + }; + }, + escapeMarkup: function(m) { return m; } }; } diff --git a/seahub/templates/base.html b/seahub/templates/base.html index 84d16ab09d..8899c9767b 100644 --- a/seahub/templates/base.html +++ b/seahub/templates/base.html @@ -14,7 +14,6 @@ - {% block extra_style %}{% endblock %} {% if branding_css != '' %}{% endif %} @@ -153,44 +152,6 @@ function ajaxErrorHandler(xhr, textStatus, errorThrown) { var error_msg = prepareAjaxErrorMsg(xhr); feedback(error_msg, 'error'); } - -// i18n for select2 -var i18n_select2 = { - errorLoading: function() { - return "{% trans "Loading failed" %}"; - }, - inputTooLong: function(e) { // not used in seahub - var t = e.input.length - e.maximum, - n = "Please delete " + t + " character"; - return t != 1 && (n += "s"), n - }, - inputTooShort: function(e) { - /* - var t = e.minimum - e.input.length, - n = "Please enter " + t + " or more characters"; - return n - */ - return "{% trans "Please enter 1 or more character" %}"; - }, - loadingMore: function() { // not used in seahub - return "Loading more results…" - }, - maximumSelected: function(e) { - /* - var t = "You can only select " + e.maximum + " item"; - return e.maximum != 1 && (t += "s"), t - */ - return "{% trans "You cannot select any more choices" %}"; - }, - noResults: function() { - //return "No results found" - return "{% trans "No matches" %}"; - }, - searching: function() { - return "{% trans "Searching..." %}"; - } -}; - {% if request.user.is_authenticated %} {% if request.cur_note %} $('#info-bar .close').on('click', function() { diff --git a/seahub/templates/base_for_backbone.html b/seahub/templates/base_for_backbone.html index 5118bdb727..f0f4d4bffa 100644 --- a/seahub/templates/base_for_backbone.html +++ b/seahub/templates/base_for_backbone.html @@ -13,7 +13,7 @@ {% compress css %} - + {% endcompress %} diff --git a/seahub/templates/js/sysadmin-templates.html b/seahub/templates/js/sysadmin-templates.html index 6f7cf6a13a..84f907ae12 100644 --- a/seahub/templates/js/sysadmin-templates.html +++ b/seahub/templates/js/sysadmin-templates.html @@ -400,7 +400,7 @@
{% trans "(If left blank, owner will be admin)" %}
-
+

@@ -614,7 +614,7 @@ + + {# for tabs #} - +