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
global: researcher profiles #1249
global: researcher profiles #1249
Conversation
6727684
to
15f6ddb
Compare
d95d634
to
6fcf26f
Compare
@slint @jainaman224 Can we take a review of the status in the coming days? @jainaman224 Would you mind preparing some screenshots with the current status of the pages. Also, we need to have inveniosoftware/invenio-userprofiles#85 finished up, otherwise the deployment is going to be held up by not having it merged. Currently the PR is missing:
Invenio-UserProfiles is already in beta now prior to Invenio v3 release, so unfortunately the bar for having the PR merged is higher than usual. |
6fcf26f
to
ac8a8c9
Compare
zenodo/modules/profiles/views.py
Outdated
orcid_id = account.extra_data.get('orcid') | ||
|
||
email = user.email | ||
default = "https://ideaclicks.in/userimages/default_user.jpg" |
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.
It's better to have a default image locally and served under /static/default_avatar.jpg
, or even better use the one Gravatar provides by default
zenodo/modules/profiles/api.py
Outdated
def __init__(self, user_id=None, orcid_id=None, **kwargs): | ||
"""Constructor function.""" | ||
if user_id is not None: | ||
query_string = 'owners:' + str(user_id) |
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.
This still works but it might be better to use something more programmatic like Q('term', **{'owners': user_id})
to avoid this string concatenation/building.
zenodo/modules/profiles/api.py
Outdated
else: | ||
query_string = '' | ||
self.Meta.default_filter = Q('query_string', query=query_string) | ||
super(ResearcherRecordsSearch, self).__init__(**kwargs) |
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.
Generally for the search class you should also take into account the versioning "filters" that are applied even for regular results. We can discuss more over chat what record versions mean and how they affect search results.
zenodo/modules/profiles/ext.py
Outdated
def init_config(self, app): | ||
"""Flask application initialization.""" | ||
for k in dir(config): | ||
if k.startswith("PROFILES_"): |
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.
It's better to use ZENODO_PROFILES_
as a prefix in order to avoid collision with invenio-userprofiles
and be more explicit about the extension
headers: {'Accept': 'application/json'}, | ||
contentType: 'application/json', | ||
dataType: 'json', | ||
success: function(result){ |
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.
It's better to extract this logic into some separate function, since now it looks pretty complex. There are also some utility functions available I believe that might simplify many parts of the code (eg. Lodash's _.map
for extracting deeply nested values from response objects).
) | ||
|
||
|
||
@blueprint.route( |
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.
You can move this view handler below the base /profile/<int:owner_id>
definition, since it's basically a "sub-resource".
zenodo/modules/profiles/views.py
Outdated
default = "https://ideaclicks.in/userimages/default_user.jpg" | ||
size = 400 | ||
|
||
gravatar_url = 'https://www.gravatar.com/avatar/' + hashlib.md5( |
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.
It might be more readable to extract this as a uitlity function in utils.py
.
zenodo/modules/profiles/views.py
Outdated
db.session.add(researcher_profile) | ||
|
||
# Update email | ||
if current_app.config['USERPROFILES_EMAIL_ENABLED'] and \ |
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 think this clause is not required since Zenodo profiles have email enabled in config
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 think we can optimise here as well?
} | ||
|
||
#researcher-profile, #orcid-profile{ | ||
@media screen and (max-width: 768px) { |
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.
If possible, extending some existing Bootstrap SASS class might be more clear, since manually handling CSS media queries might become tricky (and is already handled pretty well on Bootstrap's side)
zenodo/modules/utils/files.py
Outdated
@@ -0,0 +1,42 @@ | |||
# -*- 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.
Some thing went wrong with rebasing here (this file shouldn't be part of this PR)
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.
Actually, It is the part of your commit as zenodo/researcher_profile
branch is behind master.
ac8a8c9
to
9dd9974
Compare
* Basic Layout. * Support with angular module. Signed-off-by: Aman Jain <jainaman224@gmail.com>
Signed-off-by: Aman Jain <jainaman224@gmail.com>
014dd56
to
73b3bc3
Compare
9c05470
to
881fec1
Compare
Signed-off-by: Aman Jain <jainaman224@gmail.com>
881fec1
to
6a00e96
Compare
Rebased and merged manually |
Thank you |
Hello, I see that this PR mas merged long time ago, but haven't been able to figure out how to create a researcher profile. Can anyone update on the status of this long-awaited feature? |
No description provided.