-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Add user search autocomplete #2108
Add user search autocomplete #2108
Conversation
app/assets/onepager/js/send.js
Outdated
@@ -66,12 +66,14 @@ $(document).ready(function() { | |||
if ($(this).hasClass('disabled')) | |||
return; | |||
loading_button($(this)); | |||
|
|||
console.log('dentro') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon. (semi)
app/assets/onepager/js/send.js
Outdated
// get form data | ||
var email = $('#email').val(); | ||
var github_url = $('#issueURL').val(); | ||
var from_name = $('#fromName').val(); | ||
var username = $('#username').val(); | ||
// var username = $('#username').val(); | ||
var username = $('.username-search').select2('data')[0].text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected blank line after variable declarations. (newline-after-var)
Missing semicolon. (semi)
app/assets/onepager/js/send.js
Outdated
var username = $('#username').val(); | ||
// var username = $('#username').val(); | ||
var username = $('.username-search').select2('data')[0].text | ||
console.log(username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon. (semi)
app/assets/v2/js/user-search.js
Outdated
url: '/api/v0.1/users_search/', | ||
dataType: 'json', | ||
delay: 250, | ||
data: function (params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected space before function parentheses. (space-before-function-paren)
app/assets/v2/js/user-search.js
Outdated
dataType: 'json', | ||
delay: 250, | ||
data: function (params) { | ||
var query = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected blank line after variable declarations. (newline-after-var)
app/assets/v2/js/user-search.js
Outdated
minimumInputLength: 3, | ||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work | ||
templateResult: formatUser, | ||
templateSelection: formatUserSelection, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected trailing comma. (comma-dangle)
app/assets/v2/js/user-search.js
Outdated
// theme: "bootstrap4" | ||
}); | ||
|
||
function formatUser (user) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected space before function parentheses. (space-before-function-paren)
app/assets/v2/js/user-search.js
Outdated
return markup; | ||
} | ||
|
||
function formatUserSelection (user) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected space before function parentheses. (space-before-function-paren)
app/assets/v2/js/user-search.js
Outdated
if (user.id) { | ||
var selected = `<img class="rounded-circle" src="${user.avatar_url || static_url + 'v2/images/user-placeholder.png'}" width="20" height="20"/> ${user.text}`; | ||
} | ||
return selected || user.text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'selected' used outside of binding context. (block-scoped-var)
app/dashboard/views.py
Outdated
else: | ||
data = 'fail' | ||
mimetype = 'application/json' | ||
return HttpResponse(data, mimetype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W292 no newline at end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't understand in my file is an empty last line
app/assets/v2/js/user-search.js
Outdated
delay: 250, | ||
data: function(params) { | ||
|
||
var query = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected blank line after variable declarations. (newline-after-var)
app/assets/v2/js/user-search.js
Outdated
data: function(params) { | ||
|
||
var query = { | ||
term: params.term, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected trailing comma. (comma-dangle)
app/assets/v2/js/user-search.js
Outdated
|
||
var query = { | ||
term: params.term, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon. (semi)
app/assets/v2/js/user-search.js
Outdated
}, | ||
processResults: function(data) { | ||
return { | ||
results: data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected trailing comma. (comma-dangle)
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/user-search.js
Outdated
}, | ||
placeholder: 'Search by username', | ||
minimumInputLength: 3, | ||
escapeMarkup: function(markup) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/user-search.js
Outdated
minimumInputLength: 3, | ||
escapeMarkup: function(markup) { | ||
|
||
return markup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/user-search.js
Outdated
|
||
function formatUserSelection(user) { | ||
if (user.id) { | ||
var selected = `<img class="rounded-circle" src="${user.avatar_url || static_url + 'v2/images/user-placeholder.png'}" width="20" height="20"/> ${user.text}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'selected' used outside of binding context. (block-scoped-var)
app/assets/v2/js/user-search.js
Outdated
if (user.id) { | ||
var selected = `<img class="rounded-circle" src="${user.avatar_url || static_url + 'v2/images/user-placeholder.png'}" width="20" height="20"/> ${user.text}`; | ||
} else { | ||
var selected = user.text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'selected' is already defined. (no-redeclare)
'selected' used outside of binding context. (block-scoped-var)
Missing semicolon. (semi)
app/assets/v2/js/user-search.js
Outdated
} else { | ||
var selected = user.text | ||
} | ||
return selected; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'selected' used outside of binding context. (block-scoped-var)
@octavioamu could we
|
…ioamu/web into feature/autocomplete-users
if (user.loading) { | ||
return user.text; | ||
} | ||
let markup = `<div class="d-flex align-items-baseline"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected blank line after variable declarations. (newline-after-var)
app/assets/v2/js/user-search.js
Outdated
} | ||
|
||
function formatUserSelection(user) { | ||
let selected; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected blank line after variable declarations. (newline-after-var)
app/assets/v2/js/user-search.js
Outdated
if (user.id) { | ||
selected = `<img class="rounded-circle" src="${user.avatar_url || static_url + 'v2/images/user-placeholder.png'}" width="20" height="20"/> ${user.text}`; | ||
} else { | ||
selected = user.text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon. (semi)
app/dashboard/views.py
Outdated
@@ -1557,3 +1557,25 @@ def change_bounty(request, bounty_id): | |||
'result': result | |||
} | |||
return TemplateResponse(request, 'bounty/change.html', params) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
Codecov Report
@@ Coverage Diff @@
## master #2108 +/- ##
==========================================
- Coverage 27.91% 27.87% -0.04%
==========================================
Files 136 136
Lines 11130 11149 +19
Branches 1499 1502 +3
==========================================
+ Hits 3107 3108 +1
- Misses 7913 7931 +18
Partials 110 110
Continue to review full report at Codecov.
|
|
||
function formatUserSelection(user) { | ||
|
||
let selected; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected blank line after variable declarations. (newline-after-var)
app/dashboard/views.py
Outdated
@@ -1,4 +1,4 @@ | |||
# -*- coding: utf-8 -*- | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E114 indentation is not a multiple of four (comment)
E116 unexpected indentation (comment)
@octavioamu I fixed the errors 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
app/dashboard/views.py
Outdated
results.append(profile_json) | ||
data = json.dumps(results) | ||
else: | ||
data = 'fail' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when this block of code gets executed? Won't the formatUser
fail? Secondly, if you are sending it with application/json
, I think it is better to send something like {message: 'fail'}
{% trans "To Github Username" %}: | ||
<input type="text" placeholder="@username" id="username" value="" style="max-width: 400px; margin-left: auto; margin-right: auto;"> | ||
<label for="">{% trans "To Github Username" %}:</label> <br> | ||
<!-- <input type="text" placeholder="@username" id="username" value="" style="max-width: 400px; margin-left: auto; margin-right: auto;"> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@octavioamu could we remove this if it's not being used ?
…ioamu/web into feature/autocomplete-users
Now looks like worked, not sure what bug is getting github but my branch was diff than this one and the changes wasn't being shown here, now all the changes appears. I was getting crazy.... |
@octavioamu Seems there is some latency picking up changes on GH today. |
Description
Add autocomplete typeahead features for usernames
Fix select2 sizes
Checklist
Affected core subsystem(s)
UI
Testing
Refers/Fixes
Fixes: #2001