From f8b984852ae27f14a5f44e651193f00977737ab1 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 26 May 2015 23:59:57 +0800 Subject: Bug 1146782: backport bug 1159589 to bmo (migrate autocomplete from yui to jquery) --- template/en/default/global/userselect.html.tmpl | 62 ++++++++++--------------- 1 file changed, 25 insertions(+), 37 deletions(-) (limited to 'template/en/default/global/userselect.html.tmpl') diff --git a/template/en/default/global/userselect.html.tmpl b/template/en/default/global/userselect.html.tmpl index d7b4786f9..f7dc03d89 100644 --- a/template/en/default/global/userselect.html.tmpl +++ b/template/en/default/global/userselect.html.tmpl @@ -1,19 +1,9 @@ -[%# The contents of this file are subject to the Mozilla Public - # License Version 1.1 (the "License"); you may not use this file - # except in compliance with the License. You may obtain a copy of - # the License at http://www.mozilla.org/MPL/ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. # - # Software distributed under the License is distributed on an "AS - # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - # implied. See the License for the specific language governing - # rights and limitations under the License. - # - # The Original Code is the Bugzilla Bug Tracking System. - # - # Contributor(s): Byron Jones - # Frédéric Buclin - # Guy Pyrzak - # Reed Loden + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. #%] [%# INTERFACE: @@ -31,6 +21,7 @@ # custom_userlist: optional, specify a limited list of users to use # field_title: optional, extra information to display as a tooltip # placeholder: optional, input only; placeholder attribute value + # mandatory: optional; if true, the field cannot be empty. #%] [% IF Param("usemenuforusers") %] @@ -42,6 +33,7 @@ [% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %] [% IF multiple %] multiple="multiple" size="[% multiple FILTER html %]" [% END %] [% IF field_title %] title="[% field_title FILTER html %]" [% END %] + [% IF mandatory %] required [% END %] > [% IF emptyok %] @@ -54,12 +46,14 @@ [% custom_userlist = user.get_userlist %] [% END %] - [% SET selected = {} %] - [% IF value.defined %] - [% FOREACH selected_value IN value.split(', ') %] - [% SET selected.$selected_value = 1 %] - [% END %] - [% END %] + [% + SET selected = {}; + IF value.defined; + FOREACH selected_value IN value.split(', '); + SET selected.$selected_value = 1; + END; + END; + %] [% FOREACH tmpuser = custom_userlist %] [% IF tmpuser.visible OR selected.${tmpuser.login} == 1 %] @@ -80,10 +74,14 @@ [% END %] [% ELSE %] - [% IF feature_enabled('jsonrpc') && Param('ajax_user_autocompletion') && id %] -
- [% END %] + [% + IF id && feature_enabled('jsonrpc') && Param('ajax_user_autocompletion'); + IF !classes.defined; + classes = []; + END; + classes.push("bz_autocomplete_user"); + END; + %] - [% IF feature_enabled('jsonrpc') && Param('ajax_user_autocompletion') && id %] -
-
- - [% END %] [% END %] -- cgit v1.2.3-24-g4f1b