-
Notifications
You must be signed in to change notification settings - Fork 1
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
Form proper labels for Category/Project update link #1422
Form proper labels for Category/Project update link #1422
Conversation
dc9a33a
to
d37eb1f
Compare
projectroles/utils.py
Outdated
@@ -249,7 +249,7 @@ def get_project_app_links( | |||
'projectroles:update', | |||
kwargs={'project': project.sodar_uuid}, | |||
), | |||
'label': 'Update Project', | |||
'label': f'Update {get_display_name(project.type)}', |
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 need to supply title=True
as in the original implementation to ensure the name is returned capitalized. This was present in the original implementation. Please test these features to ensure they appear correct before submitting a 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.
I'm sorry, that I overlooked it! Now it should be fixed
It looks like some 'label' lines are now too long. Although Black and Flake8 do not raise any issues, this definitely doesn't follow conventions. There are multiple ways to solve this problem: reformatting the string using parentheses (), using the '+' syntax, adding a helper method, or introducing some temporary variables before appending the link. The question now is: how should I address this issue? |
7cc2fd3
to
4c81645
Compare
This is a good point. You have "wrapped" the code inside the format string and strings are exempt from line length formatting in black. It is possible to do the following:
That reduces line length and is accepted by black. Probably the best way unless you want to use the old style |
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 had one minor comment, plus I gave a hint on how to fix the line length issue in the pull request comments. Otherwise this looks fine and once these small things are fixed, I'll merge.
projectroles/utils.py
Outdated
@@ -191,7 +191,7 @@ def get_project_app_links( | |||
'projectroles:detail', | |||
kwargs={'project': project.sodar_uuid}, | |||
), | |||
'label': 'Project Overview', | |||
'label': f'{get_display_name(project.type, title=True)} Overview', |
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.
We could get the string for the current project's type into a variable and use it both here and in the "Update Project" link. That would save us from calling the same method twice with identical input.
Issue: #1421