Skip to content

Commit

Permalink
Merge branch 'maintainance/4-remove-projects-app' into maintainance/5…
Browse files Browse the repository at this point in the history
…-remove-public-forms-app

* maintainance/4-remove-projects-app:
  Remove public "search promotions" app (#3724)
  docs: update fetch-depth=0 and update copyright year (#3723)
  Restyle the status bar (#3672)
  Replace black with ruff formatter (#3688)
  • Loading branch information
theskumar committed Jan 17, 2024
2 parents 7b95e6d + 9720309 commit eac6d24
Show file tree
Hide file tree
Showing 17 changed files with 143 additions and 176 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/hypha-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ jobs:
with:
python-version-file: ".python-version"
- name: Install python dependencies
run: pip install `grep -E "ruff|djhtml|black" requirements-dev.txt`
- name: Run ruff
run: pip install `grep -E "ruff|djhtml" requirements-dev.txt`
- name: Run linting
run: ruff check --output-format=github .
- name: Run black
run: black . --check
- name: Run formating check
run: ruff format --check .
- name: Run djhtml
run: djhtml hypha/ --check

Expand Down
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
# Run the linter.
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11
# Run the formatter.
- id: ruff-format

- repo: https://github.com/rtts/djhtml
rev: "3.0.6"
hooks:
- id: djhtml
files: .*/templates/.*\.html$

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
# Ignore all files in the static & media directory.
static_compiled/**
media/**
/static/**

# Ignore all files in the virtualenv directory.
.venv/**
venv/**
.ruff_cache/**

# Ignore node files
node_modules/**
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build:
fmt:
@echo "run code formatters on all code."
python -m ruff --fix .
python -m black .
python -m ruff format .
npx prettier . --write
djhtml hypha/

Expand All @@ -52,7 +52,7 @@ endif
lint:
@echo "Checking python code style with ruff"
ruff check .
black . --check
ruff format --check .
@echo "Checking html file indendation."
djhtml hypha/ --check
@echo "Checking js and css code style."
Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/activity/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def send(
user=user,
source=source,
related=related,
**kwargs
**kwargs,
)

elif sources:
Expand All @@ -51,7 +51,7 @@ def send(
user=user,
sources=sources,
related=related,
**kwargs
**kwargs,
)


Expand Down
20 changes: 12 additions & 8 deletions hypha/apply/activity/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ class MESSAGES(TextChoices):
TRANSITION = "TRANSITION", _("transitioned")
BATCH_TRANSITION = "BATCH_TRANSITION", _("batch transitioned")
DETERMINATION_OUTCOME = "DETERMINATION_OUTCOME", _("sent determination outcome")
BATCH_DETERMINATION_OUTCOME = "BATCH_DETERMINATION_OUTCOME", _(
"sent batch determination outcome"
BATCH_DETERMINATION_OUTCOME = (
"BATCH_DETERMINATION_OUTCOME",
_("sent batch determination outcome"),
)
INVITED_TO_PROPOSAL = "INVITED_TO_PROPOSAL", _("invited to proposal")
REVIEWERS_UPDATED = "REVIEWERS_UPDATED", _("updated reviewers")
BATCH_REVIEWERS_UPDATED = "BATCH_REVIEWERS_UPDATED", _("batch updated reviewers")
PARTNERS_UPDATED = "PARTNERS_UPDATED", _("updated partners")
PARTNERS_UPDATED_PARTNER = "PARTNERS_UPDATED_PARTNER", _("partners updated partner")
READY_FOR_REVIEW = "READY_FOR_REVIEW", _("marked ready for review")
BATCH_READY_FOR_REVIEW = "BATCH_READY_FOR_REVIEW", _(
"marked batch ready for review"
BATCH_READY_FOR_REVIEW = (
"BATCH_READY_FOR_REVIEW",
_("marked batch ready for review"),
)
NEW_REVIEW = "NEW_REVIEW", _("added new review")
COMMENT = "COMMENT", _("added comment")
Expand All @@ -44,8 +46,9 @@ class MESSAGES(TextChoices):
APPROVE_PAF = "APPROVE_PAF", _("approved paf")
PROJECT_TRANSITION = "PROJECT_TRANSITION", _("transitioned project")
REQUEST_PROJECT_CHANGE = "REQUEST_PROJECT_CHANGE", _("requested project change")
SUBMIT_CONTRACT_DOCUMENTS = "SUBMIT_CONTRACT_DOCUMENTS", _(
"submitted contract documents"
SUBMIT_CONTRACT_DOCUMENTS = (
"SUBMIT_CONTRACT_DOCUMENTS",
_("submitted contract documents"),
)
UPLOAD_DOCUMENT = "UPLOAD_DOCUMENT", _("uploaded document to project")
REMOVE_DOCUMENT = "REMOVE_DOCUMENT", _("removed document from project")
Expand All @@ -66,8 +69,9 @@ class MESSAGES(TextChoices):
DELETE_REMINDER = "DELETE_REMINDER", _("deleted reminder")
REVIEW_REMINDER = "REVIEW_REMINDER", _("reminder to review")
BATCH_DELETE_SUBMISSION = "BATCH_DELETE_SUBMISSION", _("batch deleted submissions")
BATCH_ARCHIVE_SUBMISSION = "BATCH_ARCHIVE_SUBMISSION", _(
"batch archive submissions"
BATCH_ARCHIVE_SUBMISSION = (
"BATCH_ARCHIVE_SUBMISSION",
_("batch archive submissions"),
)
STAFF_ACCOUNT_CREATED = "STAFF_ACCOUNT_CREATED", _("created new account")
STAFF_ACCOUNT_EDITED = "STAFF_ACCOUNT_EDITED", _("edited account")
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/categories/admin_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_buttons_for_obj(self, obj, exclude=None, *args, **kwargs):
add_child_button = self.add_child_button(
pk=getattr(obj, self.opts.pk.attname),
child_verbose_name=obj.node_child_verbose_name,
**kwargs
**kwargs,
)
buttons.append(add_child_button)

Expand Down
14 changes: 13 additions & 1 deletion hypha/apply/funds/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,19 @@ class BaseAdminSubmissionsTable(SubmissionsTable):
organization_name = tables.Column()

class Meta(SubmissionsTable.Meta):
fields = ("title", "phase", "stage", "fund", "round", "lead", "submit_time", "last_update", "screening_status", "reviews_stats", "organization_name") # type: ignore
fields = (
"title",
"phase",
"stage",
"fund",
"round",
"lead",
"submit_time",
"last_update",
"screening_status",
"reviews_stats",
"organization_name",
)
sequence = fields + ("comments",)

def render_lead(self, value):
Expand Down
8 changes: 4 additions & 4 deletions hypha/apply/funds/templates/funds/includes/status_bar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load statusbar_tags %}
<div class="status-bar {{ class }}">
<div class="status-bar my-6 {{ class }}">
{% for phase in phases %}
{% ifchanged phase.step %}
{% status_display current_phase phase public as display_text %}
Expand All @@ -14,12 +14,12 @@
{% endifchanged %}
{% endfor %}
</div>
<div class="status-bar--mobile">
<h6 class="status-bar__subheading">
<div class="status-bar--mobile my-2">
<div class="status-bar__subheading status-bar__text">
{% if public %}
{{ current_phase.public_name }}
{% else %}
{{ current_phase }}
{% endif %}
</h6>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
{% elif is_complete %}
status-bar__item--is-complete
{% endif %}">
<span class="status-bar__tooltip"
data-title="{{ label }}" aria-label="{{ label }}"></span>
<svg class="status-bar__icon">
<use xlink:href="#tick-alt"></use>
</svg>
<div class="status-bar__tooltip status-bar__text" style="--tooltip-chars:{{ label|length }}ch;">{{ label }}</div>
</div>
7 changes: 4 additions & 3 deletions hypha/apply/funds/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ def test_associated_if_another_user_exists(self):
# Lead + 2 x applicant
self.assertEqual(self.User.objects.count(), 3)

first_user, second_user = self.User.objects.get(
email=self.email
), self.User.objects.get(email=email)
first_user, second_user = (
self.User.objects.get(email=self.email),
self.User.objects.get(email=email),
)
self.assertEqual(ApplicationSubmission.objects.count(), 2)
self.assertEqual(ApplicationSubmission.objects.first().user, first_user)
self.assertEqual(ApplicationSubmission.objects.last().user, second_user)
Expand Down
4 changes: 3 additions & 1 deletion hypha/apply/funds/views_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ def bulk_update_submissions_status(request: HttpRequest) -> HttpResponse:

submissions = ApplicationSubmission.objects.filter(id__in=submission_ids)

redirect: HttpResponse = BatchDeterminationCreateView.should_redirect(request, submissions, transitions) # type: ignore
redirect: HttpResponse = BatchDeterminationCreateView.should_redirect(
request, submissions, transitions
)
if redirect:
return HttpResponseClientRedirect(redirect.url)

Expand Down
1 change: 0 additions & 1 deletion hypha/settings/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"django_web_components",
"wagtail.contrib.modeladmin",
"wagtail.contrib.settings",
"wagtail.contrib.search_promotions",
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.embeds",
Expand Down
Loading

0 comments on commit eac6d24

Please sign in to comment.