-
Notifications
You must be signed in to change notification settings - Fork 146
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: implement support for tuples in the routes config (part of front page components refactor) #2243
global: implement support for tuples in the routes config (part of front page components refactor) #2243
Conversation
3695456
to
074590e
Compare
074590e
to
ceefa23
Compare
e742abe
to
516e9d2
Compare
invenio_app_rdm/theme/views.py
Outdated
def index(): | ||
"""Frontpage.""" | ||
featured_communities = current_communities.service.featured_search( |
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 if an instance will not have feature communities in the home page? This extra search should be avoided in this case.
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.
Plus one on this!
6332ea1
to
ce6ede4
Compare
invenio_app_rdm/theme/views.py
Outdated
else: | ||
return rule, name, default_view_func | ||
|
||
blueprint.add_url_rule(*create_url_rule(rule=routes["index"], name="index", default_view_func=index)) |
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 it makes sense to use the same way of constructing this for the rest of the routes i.e robots, help_search, help_statistics to be consistent...
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 added the name
there because I couldn't specify which of the arguments were the view_func
in add_url_rule
through the other function (or is there a way?), so it was failing. But I can remove it from the function parameters and just add None
in the return value?
invenio_app_rdm/theme/views.py
Outdated
@@ -62,6 +74,8 @@ def init_menu(): | |||
# | |||
# Views | |||
# | |||
|
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.
leftover
@@ -2,6 +2,26 @@ | |||
Invenio App RDM Transition Overrides | |||
***********************************************/ | |||
|
|||
#carousel-slides { |
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.
there is no carousel anymore in invenio-app-rdm so maybe is better to move these in zenodo-rdm? Or are these changes needed for the existing macros?
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.
All the styling is for the macros and/or react component in invenio-communities
. zenodo-rdm
is just importing the macro from invenio-communities
061a97b
to
e4699d9
Compare
invenio_app_rdm/theme/views.py
Outdated
if isinstance(rule, tuple): | ||
path, view_func = rule | ||
|
||
if view_func == None: |
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 can be removed as a tuple should always be used with a view_func
@@ -18,6 +18,18 @@ | |||
from invenio_i18n import lazy_gettext as _ | |||
from invenio_users_resources.forms import NotificationsForm | |||
|
|||
# Generate rule from string or tuple | |||
def create_url_rule(rule, default_view_func): | |||
if isinstance(rule, tuple): |
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 a docsting here :)
e4699d9
to
86eb277
Compare
86eb277
to
f709372
Compare
addresses inveniosoftware/invenio-communities#874