Skip to content

Commit

Permalink
frontpage: rewrite communities carousel to python and jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
jennur authored and zzacharo committed Jul 4, 2023
1 parent 51eb834 commit c6cbde9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 33 deletions.
50 changes: 34 additions & 16 deletions invenio_app_rdm/records_ui/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
PermissionDeniedError,
)

from invenio_app_rdm.theme.views import create_url_rule

from ..searchapp import search_app_context
from .deposits import deposit_create, deposit_edit
from .filters import (
Expand Down Expand Up @@ -64,47 +66,63 @@ def create_blueprint(app):

# Record URL rules
blueprint.add_url_rule(
routes["record_detail"],
view_func=record_detail,
**create_url_rule(
routes["record_detail"],
default_view_func=record_detail,
)
)

blueprint.add_url_rule(
routes["record_latest"],
view_func=record_latest,
**create_url_rule(
routes["record_latest"],
default_view_func=record_latest,
)
)

rdm_records_ext = app.extensions["invenio-rdm-records"]
schemes = rdm_records_ext.records_service.config.pids_providers.keys()
schemes = ",".join(schemes)
if schemes:
blueprint.add_url_rule(
routes["record_from_pid"].format(schemes=schemes),
view_func=record_from_pid,
**create_url_rule(
routes["record_from_pid"].format(schemes=schemes),
default_view_func=record_from_pid,
)
)

blueprint.add_url_rule(
routes["record_export"],
view_func=record_export,
**create_url_rule(
routes["record_export"],
default_view_func=record_export,
)
)

blueprint.add_url_rule(
routes["record_file_preview"],
view_func=record_file_preview,
**create_url_rule(
routes["record_file_preview"],
default_view_func=record_file_preview,
)
)

blueprint.add_url_rule(
routes["record_file_download"],
view_func=record_file_download,
**create_url_rule(
routes["record_file_download"],
default_view_func=record_file_download,
)
)

blueprint.add_url_rule(
routes["deposit_create"],
view_func=deposit_create,
**create_url_rule(
routes["deposit_create"],
default_view_func=deposit_create,
)
)

blueprint.add_url_rule(
routes["deposit_edit"],
view_func=deposit_edit,
**create_url_rule(
routes["deposit_edit"],
default_view_func=deposit_edit,
)
)

# Register error handlers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
text-shadow: 0 1px 2px rgba(0,0,0,.4);
cursor: pointer;
width: auto;
position: relative;
z-index: 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,41 @@
@keyframes carouselSlideInLeft {
0% {
opacity: 0;
transform: translate3d(100%, 0, 0);
transform: translateX(100vw);
}
100% {
transform: none;
transform: translateX(0);
}
}

@keyframes carouselSlideOutLeft {
0% {
opacity: 1;
transform: translate3d(-100%, 0, 0);
transform: translateX(0);
}
100% {
opacity: 0;
transform: translate3d(-200%, 0, 0);
transform: translateX(-100vw);
}
}

@keyframes carouselSlideInRight {
0% {
opacity: 0;
transform: translate3d(-100%, 0, 0);
transform: translateX(-100vw);
}
100% {
transform: none;
transform: translateX(0);
}
}

@keyframes carouselSlideOutRight {
0% {
opacity: 1;
transform: translate3d(-100%, 0, 0);
transform: translateX(0);
}
100% {
opacity: 0;
transform: translate3d(0%, 0, 0);
transform: translateX(100vw);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,19 @@
.item {
&.community-item {
.ui.grid {
margin-left: 0.5em !important;
width: 100% !important;
}
.content{
margin-left: 0.5em !important;
width: 100% !important;
}

.content {
width: 100% !important;

&.flex.right-column{
flex-direction: column;
align-items: end;
};
}
.extra{
.extra {
@media all and (min-width: @tabletBreakpoint) {
position: absolute;
bottom: 0.7em !important;
Expand Down
24 changes: 20 additions & 4 deletions invenio_app_rdm/theme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
from invenio_users_resources.forms import NotificationsForm


def create_url_rule(rule, default_view_func):
"""Generate rule from string or tuple."""
if isinstance(rule, tuple):
path, view_func = rule

return {"rule": path, "view_func": view_func}
else:
return {"rule": rule, "view_func": default_view_func}


#
# Registration
#
Expand All @@ -33,10 +43,16 @@ def create_blueprint(app):
static_folder="static",
)

blueprint.add_url_rule(routes["index"], view_func=index)
blueprint.add_url_rule(routes["robots"], view_func=robots)
blueprint.add_url_rule(routes["help_search"], view_func=help_search)
blueprint.add_url_rule(routes["help_statistics"], view_func=help_statistics)
blueprint.add_url_rule(**create_url_rule(routes["index"], default_view_func=index))
blueprint.add_url_rule(
**create_url_rule(routes["robots"], default_view_func=robots)
)
blueprint.add_url_rule(
**create_url_rule(routes["help_search"], default_view_func=help_search)
)
blueprint.add_url_rule(
**create_url_rule(routes["help_statistics"], default_view_func=help_statistics)
)

@blueprint.before_app_first_request
def init_menu():
Expand Down

0 comments on commit c6cbde9

Please sign in to comment.