Skip to content

Commit

Permalink
Merge pull request kobotoolbox#3288 from kobotoolbox/beta
Browse files Browse the repository at this point in the history
Incorporate previously reviewed changes (for 2.021.24)
  • Loading branch information
jnm authored Jun 15, 2021
2 parents 9222efc + 9d95d3d commit 43fa445
Show file tree
Hide file tree
Showing 472 changed files with 13,075 additions and 5,814 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"extends": "eslint:recommended",
"rules": {
"arrow-body-style": [1, "always"],
"arrow-body-style": [1, "as-needed", {"requireReturnForObjectLiteral": true}],
"arrow-parens": [1, "always"],
"arrow-spacing": 1,
"block-spacing": [1, "never"],
Expand Down Expand Up @@ -54,6 +54,7 @@
"no-useless-escape": 1,
"no-useless-rename": 1,
"no-whitespace-before-property": 1,
"one-var": ["warn", "never"],
"quotes": ["warn", "single", {"avoidEscape": true}],
"react/jsx-boolean-value": 2,
"react/jsx-no-undef": 2,
Expand All @@ -72,7 +73,11 @@
"semi-spacing": [1, {"before": false, "after": true}],
"semi-style": [1, "last"],
"semi": 1,
"space-before-function-paren": [1, "never"],
"space-before-function-paren": [1, {
"anonymous": "always",
"named": "never",
"asyncArrow": "never"
}],
"space-in-parens": [1, "never"],
"space-infix-ops": 1,
"strict": 1
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/update-translations-strings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

name: Update Translations

on:
pull_request:
# Github actions does not support an `on merge` type action
# So I substituted with pull_quests.closed
types: [ closed ]
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Change Directories
run: cd kpi/

- name: Install KPI requirements
run: sudo pip install -r dependencies/pip/requirements.txt

- name: Install NPM packages
run: npm install

- name: Install webpack
run: npm install webpack

- name: Run NPM build
run: npm run copy-fonts && npm run build

- name: Compile Frontend Strings
run: node ./scripts/generate_icons.js

- name: Install translate-toolkit
run: sudo apt install translate-toolkit

- name: Install Transifex
run: sudo pip3 install transifex-client

- name: Run make translation po file
run: sudo ./manage.py makemessages --locale en

- name: Run json2po
run: sudo json2po jsapp/compiled/extracted-strings.json locale/en/LC_MESSAGES/djangojs.po

- name: Run Transifex
run: tx push -s
env:
TX_TOKEN: ${{ secrets.TRANSIFEX_API }}
13 changes: 13 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"tabs": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": true,
"bracketSpacing": false,
"jsxBracketSameLine": false,
"arrowParens": "always",
"endOfLine": "lf"
}
4 changes: 2 additions & 2 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[main]
host = https://www.transifex.com

[koboform.django]
[kobotoolbox.django]
file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO

[koboform.djangojs]
[kobotoolbox.djangojs]
file_filter = locale/<lang>/LC_MESSAGES/djangojs.po
source_file = locale/en/LC_MESSAGES/djangojs.po
source_lang = en
Expand Down
135 changes: 135 additions & 0 deletions coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"arrow_spacing": {
"level": "warn"
},
"braces_spacing": {
"level": "warn",
"spaces": 0,
"empty_object_spaces": 0
},
"camel_case_classes": {
"level": "warn"
},
"coffeescript_error": {
"level": "error"
},
"colon_assignment_spacing": {
"level": "warn",
"spacing": {
"left": 0,
"right": 1
}
},
"cyclomatic_complexity": {
"level": "warn",
"value": 10
},
"duplicate_key": {
"level": "error"
},
"empty_constructor_needs_parens": {
"level": "warn"
},
"ensure_comprehensions": {
"level": "warn"
},
"eol_last": {
"level": "warn"
},
"indentation": {
"value": 2,
"level": "warn"
},
"line_endings": {
"level": "warn",
"value": "unix"
},
"max_line_length": {
"value": 80,
"level": "warn",
"limitComments": false
},
"missing_fat_arrows": {
"level": "warn",
"is_strict": false
},
"newlines_after_classes": {
"value": 1,
"level": "warn"
},
"no_backticks": {
"level": "warn"
},
"no_debugger": {
"level": "warn",
"console": false
},
"no_empty_functions": {
"level": "warn"
},
"no_empty_param_list": {
"level": "ignore"
},
"no_implicit_braces": {
"level": "warn",
"strict": true
},
"no_implicit_parens": {
"level": "warn",
"strict": true
},
"no_interpolation_in_single_quotes": {
"level": "warn"
},
"no_nested_string_interpolation": {
"level": "warn"
},
"no_plusplus": {
"level": "ignore"
},
"no_private_function_fat_arrows": {
"level": "warn"
},
"no_stand_alone_at": {
"level": "ignore"
},
"no_tabs": {
"level": "warn"
},
"no_this": {
"level": "warn"
},
"no_throwing_strings": {
"level": "warn"
},
"no_trailing_semicolons": {
"level": "warn"
},
"no_trailing_whitespace": {
"level": "warn",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"level": "warn"
},
"non_empty_constructor_needs_parens": {
"level": "warn"
},
"prefer_english_operator": {
"level": "warn",
"doubleNotLevel": "warn"
},
"space_operators": {
"level": "warn"
},
"spacing_after_comma": {
"level": "warn"
},
"transform_messes_up_line_numbers": {
"level": "warn"
}
}
2 changes: 1 addition & 1 deletion dependencies/pip/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# via -r dependencies/pip/requirements.in
-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages
# via -r dependencies/pip/requirements.in
-e git+https://github.com/kobotoolbox/formpack.git@972fde2e386ae3f2a48f4ceaa41cf0fca6ba07de#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@f7ba6360949fb3075a52b2b7210224ebb60734ed#egg=formpack
# via -r dependencies/pip/requirements.in
-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest
# via -r dependencies/pip/requirements.in
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/external_services.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# via -r dependencies/pip/requirements.in
-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages
# via -r dependencies/pip/requirements.in
-e git+https://github.com/kobotoolbox/formpack.git@972fde2e386ae3f2a48f4ceaa41cf0fca6ba07de#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@f7ba6360949fb3075a52b2b7210224ebb60734ed#egg=formpack
# via -r dependencies/pip/requirements.in
-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest
# via -r dependencies/pip/requirements.in
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/bndr/pipreqs is a handy utility, too.

# formpack
-e git+https://github.com/kobotoolbox/formpack.git@972fde2e386ae3f2a48f4ceaa41cf0fca6ba07de#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@f7ba6360949fb3075a52b2b7210224ebb60734ed#egg=formpack

# More up-to-date version of django-digest than PyPI seems to have.
# Also, python-digest is an unlisted dependency thereof.
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# via -r dependencies/pip/requirements.in
-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages
# via -r dependencies/pip/requirements.in
-e git+https://github.com/kobotoolbox/formpack.git@972fde2e386ae3f2a48f4ceaa41cf0fca6ba07de#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@f7ba6360949fb3075a52b2b7210224ebb60734ed#egg=formpack
# via -r dependencies/pip/requirements.in
-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest
# via -r dependencies/pip/requirements.in
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pip/travis_ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# via -r dependencies/pip/requirements.in
-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages
# via -r dependencies/pip/requirements.in
-e git+https://github.com/kobotoolbox/formpack.git@972fde2e386ae3f2a48f4ceaa41cf0fca6ba07de#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@f7ba6360949fb3075a52b2b7210224ebb60734ed#egg=formpack
# via -r dependencies/pip/requirements.in
-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest
# via -r dependencies/pip/requirements.in
Expand Down
14 changes: 6 additions & 8 deletions hub/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from django.db import router, transaction
from django.template.response import TemplateResponse
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy, ugettext as _

from kpi.deployment_backends.kc_access.shadow_models import ShadowModel

Expand Down Expand Up @@ -71,7 +70,7 @@ def delete_related_objects(modeladmin, request, queryset):
n += 1
modeladmin.message_user(
request,
_("Successfully deleted %(count)d related objects.") % {
"Successfully deleted %(count)d related objects." % {
"count": n, "items": model_ngettext(modeladmin.opts, n)},
messages.SUCCESS
)
Expand All @@ -84,9 +83,9 @@ def delete_related_objects(modeladmin, request, queryset):
objects_name = force_text(opts.verbose_name_plural)

if perms_needed or protected:
title = _("Cannot delete %(name)s") % {"name": objects_name}
title = "Cannot delete %(name)s" % {"name": objects_name}
else:
title = _("Are you sure?")
title = "Are you sure?"

context = dict(
modeladmin.admin_site.each_context(request),
Expand All @@ -109,9 +108,9 @@ def delete_related_objects(modeladmin, request, queryset):
context)


delete_related_objects.short_description = ugettext_lazy(
delete_related_objects.short_description =
"Remove related objects for these %(verbose_name_plural)s "
"(deletion step 1)")
"(deletion step 1)"


def remove_from_kobocat(modeladmin, kpi_request, queryset):
Expand All @@ -135,7 +134,6 @@ def remove_from_kobocat(modeladmin, kpi_request, queryset):
return response


remove_from_kobocat.short_description = ugettext_lazy(
remove_from_kobocat.short_description =
"View these %(verbose_name_plural)s in the KoBoCAT admin interface "
"(deletion step 2)"
)
13 changes: 6 additions & 7 deletions hub/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.contrib import admin, messages
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.translation import gettext as _

from kpi.deployment_backends.kc_access.utils import delete_kc_users
from .models import SitewideMessage, ConfigurationFile, PerUserSetting
Expand Down Expand Up @@ -41,9 +40,9 @@ def delete_queryset(self, request, queryset):
# Maybe it still makes sense because KPI users are deleted.
self.message_user(
request,
_('Could not delete users in KoBoCAT database. They may own '
'projects and/or submissions. Log into KoBoCAT admin '
'interface and delete them from there.'),
'Could not delete users in KoBoCAT database. They may own '
'projects and/or submissions. Log into KoBoCAT admin '
'interface and delete them from there.',
messages.ERROR
)

Expand All @@ -67,9 +66,9 @@ def delete_model(self, request, obj):
# Maybe it still makes sense because KPI user is deleted.
self.message_user(
request,
_('Could not delete user in KoBoCAT database. They may own '
'projects and/or submissions. Log into KoBoCAT admin '
'interface and delete them from there.'),
'Could not delete user in KoBoCAT database. They may own '
'projects and/or submissions. Log into KoBoCAT admin '
'interface and delete them from there.',
messages.ERROR
)

Expand Down
Loading

0 comments on commit 43fa445

Please sign in to comment.