Skip to content

Commit

Permalink
feat(tools): add search preview to bulk edit tool
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-smt committed Nov 8, 2024
1 parent a888c74 commit 7f91ae3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Not yet released.

* A shortcut to duplicate a component is now available directly in the menu (:guilabel:`Manage` → :guilabel:`Duplicate Component`)
* Included username when generating :ref:`credits`.
* :ref:`bulk-edit` shows a preview of matched strings.

**Bug fixes**

Expand Down Expand Up @@ -111,7 +112,7 @@ Released on October 15th 2024.
* Stale, empty glossaries are now automatically removed.
* :kbd:`?` now displays available :ref:`keyboard`.
* Translation and language view in the project now include basic information about the language and plurals.
* :ref:`bulk-edit` shows a preview of matched strings.
* :ref:`search-replace` shows a preview of matched strings.
* :ref:`aresource` now supports translatable attribute in its strings.
* Creating component via file upload (Translate document) now supports bilingual files.

Expand Down
1 change: 1 addition & 0 deletions weblate/static/editor/tools/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

$(document).ready(() => {
searchPreview("#replace", "#id_replace_q");
searchPreview("#bulk-edit", "#id_bulk_q");

/**
* Add preview to the search input search results.
Expand Down
3 changes: 3 additions & 0 deletions weblate/trans/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2601,6 +2601,7 @@ class BulkEditForm(forms.Form):
label=gettext_lazy("State to set"),
choices=[(-1, gettext_lazy("Do not change"))],
)
path = forms.CharField(widget=forms.HiddenInput, required=False)
add_flags = FlagField(
label=gettext_lazy("Translation flags to add"), required=False
)
Expand All @@ -2625,6 +2626,7 @@ def __init__(
) -> None:
project = kwargs.pop("project", None)
kwargs["auto_id"] = "id_bulk_%s"
kwargs["initial"] = {"path": getattr(obj, "full_slug", None)}
super().__init__(*args, **kwargs)
labels = Label.objects.all() if project is None else project.label_set.all()
if labels:
Expand All @@ -2651,6 +2653,7 @@ def __init__(
self.helper.layout = Layout(
Div(template="snippets/bulk-help.html"),
SearchField("q"),
Field("path"),
Field("state"),
Field("add_flags"),
Field("remove_flags"),
Expand Down

0 comments on commit 7f91ae3

Please sign in to comment.