Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
43f3d7a5
Commit
43f3d7a5
authored
Feb 02, 2016
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1fde0871
e1a4bc36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
16 deletions
+42
-16
weblate/trans/forms.py
weblate/trans/forms.py
+26
-16
weblate/trans/tests/test_search.py
weblate/trans/tests/test_search.py
+16
-0
No files found.
weblate/trans/forms.py
View file @
43f3d7a5
...
...
@@ -422,6 +422,31 @@ def get_upload_form(user, project):
return
SimpleUploadForm
class
FilterField
(
forms
.
ChoiceField
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'label'
]
=
_
(
'Search filter'
)
kwargs
[
'required'
]
=
False
kwargs
[
'choices'
]
=
[
(
'all'
,
_
(
'All strings'
)),
(
'nottranslated'
,
_
(
'Not translated strings'
)),
(
'todo'
,
_
(
'Strings needing attention'
)),
(
'translated'
,
_
(
'Translated strings'
)),
(
'fuzzy'
,
_
(
'Strings needing review'
)),
(
'suggestions'
,
_
(
'Strings with suggestions'
)),
(
'comments'
,
_
(
'Strings with comments'
)),
(
'allchecks'
,
_
(
'Strings with any failing checks'
)),
]
+
[
(
check
,
CHECKS
[
check
].
description
)
for
check
in
CHECKS
if
CHECKS
[
check
].
target
]
super
(
FilterField
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
to_python
(
self
,
value
):
if
value
==
'untranslated'
:
return
'todo'
return
super
(
FilterField
,
self
).
to_python
(
value
)
class
SearchForm
(
forms
.
Form
):
'''
Text searching form.
...
...
@@ -467,22 +492,7 @@ class SearchForm(forms.Form):
required
=
False
,
initial
=
False
)
type
=
forms
.
ChoiceField
(
label
=
_
(
'Search filter'
),
required
=
False
,
choices
=
[
(
'all'
,
_
(
'All strings'
)),
(
'untranslated'
,
_
(
'Untranslated strings'
)),
(
'translated'
,
_
(
'Translated strings'
)),
(
'fuzzy'
,
_
(
'Strings needing review'
)),
(
'suggestions'
,
_
(
'Strings with suggestions'
)),
(
'comments'
,
_
(
'Strings with comments'
)),
(
'allchecks'
,
_
(
'Strings with any failing checks'
)),
]
+
[
(
check
,
CHECKS
[
check
].
description
)
for
check
in
CHECKS
if
CHECKS
[
check
].
target
],
)
type
=
FilterField
()
ignored
=
forms
.
BooleanField
(
widget
=
forms
.
HiddenInput
,
label
=
_
(
'Show ignored checks as well'
),
...
...
weblate/trans/tests/test_search.py
View file @
43f3d7a5
...
...
@@ -83,6 +83,22 @@ class SearchViewTest(ViewTestCase):
response
,
'<span class="hlmatch">Hello</span>, world'
)
response
=
self
.
client
.
get
(
reverse
(
'search'
),
{
'q'
:
'hello'
,
'type'
:
'todo'
}
)
self
.
assertContains
(
response
,
'<span class="hlmatch">Hello</span>, world'
)
response
=
self
.
client
.
get
(
reverse
(
'search'
),
{
'q'
:
'hello'
,
'type'
:
'nottranslated'
}
)
self
.
assertContains
(
response
,
'<span class="hlmatch">Hello</span>, world'
)
response
=
self
.
client
.
get
(
reverse
(
'search'
),
{
'type'
:
'php_format'
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment