Skip to content

Commit

Permalink
corrected code smells (print, naming)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducica committed Sep 9, 2024
1 parent 21607fb commit 7a5bb65
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of Invenio.
* Copyright (C) 2017-2018 CERN.
*
* Invenio is free software; you can redistribute it and/or modify it
* under the terms of the MIT License; see LICENSE file for more details.
*/

module.exports = {
root: true,
parser: "@babel/eslint-parser",
parserOptions: {
sourceType: "module",
requireConfigFile: false,
},
env: {
browser: true,
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: ["react-app", "plugin:jsx-a11y/recommended"],
plugins: ["jsx-a11y", "i18next"],
// add your custom rules here
rules: {
// allow paren-less arrow functions
"arrow-parens": 0,
// allow async-await
"generator-star-spacing": 0,
// allow debugger during development
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0,
"no-console": "warn",
"i18next/no-literal-string": 2,
},
};
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,7 @@ dist/
.venv-builder/
.venv-tests/

forked_install.sh
forked_install.sh
# node modules
**/*/node_modules
node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
<div
class="sixteen wide mobile sixteen wide tablet three wide computer right aligned middle aligned column">
{%- if not community_use_jinja_header %}
{# TODO: Need to figure out what to do about the url as we dont have access
to our input as templates are rendered on their end.
#}
<a href="/docs/_new?community={{ community.slug }}"
<a href="{{ config.RECORD_ROUTES['new'].format(community_slug=community.slug) }}"
class="ui positive button labeled icon rel-mt-1 theme-secondary">
<i class="upload icon" aria-hidden="true"></i>
{{ _("New upload") }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
{% if permissions.can_create %}
<div class="three wide mobile five wide tablet three wide computer stretched column">
<a href="{{ config.COMMUNITIES_ROUTES['new'] }}" class="ui icon left labeled positive button" role="button">
<a href="{{ config.COMMUNITIES_ROUTES['new'] }}" class="ui icon left labeled positive button">
<i class="icon plus"></i>
{{_('New community')}}
</a>
Expand Down
10 changes: 6 additions & 4 deletions oarepo_communities/ui/oarepo_communities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
from flask_resources import resource_requestctx
from invenio_communities.views.communities import (
communities_settings as invenio_communities_settings,
communities_settings_curation_policy as invenio_communities_settings_curation_policy,
communities_settings_privileges as invenio_communities_settings_privileges,
communities_settings_pages as invenio_communities_settings_pages,
members as invenio_communities_members,
communities_curation_policy as invenio_communities_curation_policy,
communities_about as invenio_communities_about,
communities_frontpage as invenio_communities_frontpage,
communities_search as invenio_communities_search,
communities_new as invenio_communities_new,
)


Expand Down Expand Up @@ -65,7 +64,7 @@ class CommunityRecordsUIResourceConfig(GlobalSearchUIResourceConfig):
template_folder = "templates"
application_id = "community_records"
templates = {
"search": "CommunityRecordPage",
"search": "CommunityRecordsPage",
}
request_community_view_args = CommunityValidationSchema

Expand All @@ -79,6 +78,7 @@ class CommunityRecordsUIResourceConfig(GlobalSearchUIResourceConfig):
"communities_about": "/<pid_value>/about",
"communities_frontpage": "/",
"communities_search": "/search",
"communities_new": "/new",
}
api_service = "records"

Expand Down Expand Up @@ -128,7 +128,6 @@ def communities_settings_pages(
def members(
self,
):
print(g.identity, "identityflask", flush=True)
return invenio_communities_members(
pid_value=resource_requestctx.view_args["pid_value"]
)
Expand All @@ -155,6 +154,9 @@ def communities_frontpage(self):
def communities_search(self):
return invenio_communities_search()

def communities_new(self):
return invenio_communities_new()


def create_blueprint(app):
"""Register blueprint for this resource."""
Expand Down

0 comments on commit 7a5bb65

Please sign in to comment.