Skip to content
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

feat(tools): add search preview to bulk edit tool #12957

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

michael-smt
Copy link
Contributor

@michael-smt michael-smt commented Nov 7, 2024

Proposed changes

Adds the same search preview from Search and replace to the Bulk edit tool.

Checklist

  • Lint and unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added documentation to describe my feature.
  • I have squashed my commits into logic units.
  • I have described the changes in the commit messages.

Other information

Related to #4106, #4108 and #7563.

Does not affect the Bulk edit add-on.

@nijel nijel added this to the 5.9 milestone Nov 7, 2024
@nijel nijel assigned nijel and unassigned nijel Nov 7, 2024
@nijel nijel requested a review from meel-hd November 7, 2024 12:06
Copy link
Collaborator

@meel-hd meel-hd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nijel nijel self-assigned this Nov 7, 2024
@@ -2623,6 +2624,7 @@ class BulkEditForm(forms.Form):
def __init__(self, user: User | None, obj, *args, **kwargs) -> None:
project = kwargs.pop("project", None)
kwargs["auto_id"] = "id_bulk_%s"
kwargs["initial"] = {"path": obj.full_slug}
Copy link
Member

@nijel nijel Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obj can be None here (when invoked from add-on configuration) and it then fails: AttributeError: 'NoneType' object has no attribute 'full_slug'

Copy link
Contributor Author

@michael-smt michael-smt Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, was not aware of there also being a bulk edit in the add-ons 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing blank path and not using it in lookup should do the trick in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a fix for this, please review.

The search preview is not activated on the add-on pages for bulk edit.

nijel added a commit to nijel/weblate that referenced this pull request Nov 7, 2024
Correctly use project scoping when available, see WeblateOrg#12957
nijel added a commit to nijel/weblate that referenced this pull request Nov 7, 2024
Correctly use project scoping when available, see WeblateOrg#12957
nijel added a commit to nijel/weblate that referenced this pull request Nov 7, 2024
Correctly use project scoping when available, see WeblateOrg#12957
nijel added a commit that referenced this pull request Nov 7, 2024
Correctly use project scoping when available, see #12957
@michael-smt michael-smt changed the title feat(tools): add search preview to bulk edit feat(tools): add search preview to bulk edit tool Nov 8, 2024
weblate/trans/forms.py Outdated Show resolved Hide resolved
@nijel nijel enabled auto-merge (squash) November 8, 2024 10:29
@nijel nijel disabled auto-merge November 8, 2024 11:25
@nijel nijel merged commit 3063590 into WeblateOrg:main Nov 8, 2024
28 of 29 checks passed
@nijel
Copy link
Member

nijel commented Nov 8, 2024

Merged, thanks for your contribution!

@michael-smt michael-smt deleted the ui-bulk-edit-search-preview branch November 8, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants