-
-
Notifications
You must be signed in to change notification settings - Fork 364
Added autocomplete input field for assigning bulk default user #3250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,16 +539,52 @@ function toolbarEvents (testPlanId, permissions) { | |
| return false | ||
| }) | ||
|
|
||
| $('#default-tester-button').click(function (ev) { | ||
| $(this).parents('.dropdown').toggleClass('open') | ||
| $('input.user-field.typeahead').on('focusin', function () { | ||
| // Prevents sub-menu options from hidding when | ||
| // selecting typeahead suggestion. | ||
| $(this).parents('ul').css('display', 'block') | ||
| }) | ||
|
|
||
| $('input.user-field.typeahead').typeahead({ | ||
| minLength: 3, | ||
| highlight: true | ||
| }, { | ||
| name: 'default-tester-autocomplete', | ||
| // will display up to X results even if more were returned | ||
| limit: 100, | ||
| async: true, | ||
| display: function (element) { | ||
| return element.username | ||
| }, | ||
| source: function (query, processSync, processAsync) { | ||
| jsonRPC('User.filter', { username__icontains: query }, function (data) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I'm not sure if/how we want to inform users that their auto-complete searches may not work because they are missing the permission. Maybe we should default to the old implementation if permission isn't granted and allow auto-complete only when it is. |
||
| return processAsync(data) | ||
| }) | ||
| } | ||
| }) | ||
|
|
||
| $('#default-tester-button').click(function () { | ||
| addDefaultTester() | ||
| }) | ||
|
|
||
| $('#id_tags').keyup(function (event) { | ||
| if (event.keyCode === 13) { | ||
| addDefaultTester() | ||
| }; | ||
| }) | ||
|
|
||
| function addDefaultTester () { | ||
| $('#default-tester-button').parents('.dropdown').removeClass('open') | ||
| // Closes the sub-menu option that contains input field | ||
| $('#default-tester-button').parents('ul').css('display', '') | ||
| const selectedCases = getSelectedTestCases() | ||
|
|
||
| if (!selectedCases.length) { | ||
| alert($('#test_plan_pk').data('trans-no-testcases-selected')) | ||
| return false | ||
| } | ||
|
|
||
| const emailOrUsername = window.prompt($('#test_plan_pk').data('trans-username-email-prompt')) | ||
| const emailOrUsername = $('input.typeahead.user-field.tt-input').val() | ||
|
|
||
| if (!emailOrUsername) { | ||
| return false | ||
|
|
@@ -558,7 +594,7 @@ function toolbarEvents (testPlanId, permissions) { | |
| testPlanId, permissions) | ||
|
|
||
| return false | ||
| }) | ||
| } | ||
|
|
||
| $('#bulk-reviewer-button').click(function (ev) { | ||
| $(this).parents('.dropdown').toggleClass('open') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.