-
-
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
save es keywords to profile and fix onboarding #5105
Changes from all commits
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 |
---|---|---|
|
@@ -105,7 +105,7 @@ onboard.watchMetamask = function() { | |
} | ||
}; | ||
|
||
onboard.getFilters = function(savedKeywords) { | ||
onboard.getFilters = function(savedKeywords, currentKeywords) { | ||
$('.suggested-tag input[type=checkbox]:checked + span i').removeClass('fa-plus').addClass('fa-check'); | ||
$('.suggested-tag input[type=checkbox]:not(:checked) + span i').removeClass('fa-check').addClass('fa-plus'); | ||
|
||
|
@@ -120,8 +120,8 @@ onboard.getFilters = function(savedKeywords) { | |
}); | ||
} | ||
|
||
if (savedKeywords) { | ||
$.each(savedKeywords, function(k, value) { | ||
if (currentKeywords) { | ||
$.each(currentKeywords, function(k, value) { | ||
if (keywords.includes(value.toLowerCase())) { | ||
$('input[type=checkbox][name=tech-stack][value="' + value.toLowerCase() + '"]').prop('checked', true); | ||
} else { | ||
|
@@ -149,24 +149,26 @@ onboard.getFilters = function(savedKeywords) { | |
$('#selected-skills').css('display', 'inherit'); | ||
|
||
$('.filter-tags').html(_filters); | ||
words = [...new Set(_words)]; | ||
// TODO: Save Preferences | ||
var settings = { | ||
url: '/settings/matching', | ||
method: 'POST', | ||
headers: {'X-CSRFToken': csrftoken}, | ||
data: JSON.stringify({ | ||
'keywords': 'JavaScript,CCoffeeScript,CSS,HTML', | ||
'submit': 'Go', | ||
'github': 'thelostone-mc' | ||
}) | ||
}; | ||
|
||
$.ajax(settings).done(function(response) { | ||
// TODO : Update keywords for user profile | ||
}).fail(function(error) { | ||
// TODO: Handle Error | ||
}); | ||
|
||
if (savedKeywords) { | ||
|
||
words = [...new Set(_words)]; | ||
var settings = { | ||
url: '/settings/matching', | ||
method: 'POST', | ||
headers: {'X-CSRFToken': csrftoken}, | ||
data: { | ||
'keywords': words.join(), | ||
'submit': 'Go' | ||
} | ||
}; | ||
|
||
$.ajax(settings).done(function(response) { | ||
onboard.getFilters(false, response.keywords); | ||
}).fail(function(error) { | ||
// TODO: Handle Error | ||
}); | ||
} | ||
}; | ||
|
||
var changeStep = function(n) { | ||
|
@@ -226,21 +228,21 @@ keywords.forEach(function(keyword) { | |
|
||
$('#skills #suggested-tags').html(suggested_tags); | ||
|
||
if ($('.navbar #navbarDropdown').html()) { | ||
var url = '/api/v0.1/profile/' + $('.navbar #navbarDropdown').html().trim() + '/keywords'; | ||
if (document.contxt.github_handle) { | ||
var url = `/api/v0.1/profile/${document.contxt.github_handle}/keywords`; | ||
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. changed this because menu changed and now $('.navbar #navbarDropdown') wasn't the user gh, was "Products" |
||
|
||
$.get(url, function(response) { | ||
onboard.getFilters(response.keywords); | ||
onboard.getFilters(false, response.keywords); | ||
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. this will just populate the keywords if you already have any |
||
}); | ||
} | ||
|
||
$('.suggested-tag input[type=checkbox]').change(function(e) { | ||
onboard.getFilters(); | ||
onboard.getFilters(true); | ||
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. this will save the changes |
||
}); | ||
|
||
$('.search-area input[type=text]').keypress(function(e) { | ||
if (e.which == 13) { | ||
onboard.getFilters(); | ||
onboard.getFilters(true); | ||
e.preventDefault(); | ||
} | ||
}); | ||
|
@@ -260,4 +262,4 @@ var redirectURL = function() { | |
document.location.href = url; | ||
}; | ||
|
||
localStorage['onboarded_funder'] = true; | ||
localStorage['onboarded_funder'] = true; |
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.
added parameters because was saving empty when going out of that page