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
71d8f061
Commit
71d8f061
authored
Oct 13, 2015
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
60167ef8
5c510c34
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
+28
-3
docs/changes.rst
docs/changes.rst
+1
-0
weblate/trans/forms.py
weblate/trans/forms.py
+21
-0
weblate/trans/models/unit.py
weblate/trans/models/unit.py
+3
-0
weblate/trans/views/basic.py
weblate/trans/views/basic.py
+3
-3
No files found.
docs/changes.rst
View file @
71d8f061
...
...
@@ -14,6 +14,7 @@ Released on ? 2015.
* Documentation improvements.
* Added support for generating translator credits.
* Added support for generating contributor stats.
* Site wide search can search only in one language.
weblate 2.4
-----------
...
...
weblate/trans/forms.py
View file @
71d8f061
...
...
@@ -555,6 +555,27 @@ class SearchForm(forms.Form):
return
filter_name
class
SiteSearchForm
(
SearchForm
):
"""Site wide search form"""
lang
=
forms
.
ChoiceField
(
label
=
_
(
'Language'
),
required
=
False
,
choices
=
[(
''
,
_
(
'All languages'
))],
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
'''
Dynamically generate choices for used languages
in project
'''
super
(
SiteSearchForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'lang'
].
choices
+=
[
(
l
.
code
,
l
.
__unicode__
())
for
l
in
Language
.
objects
.
have_translation
()
]
class
MergeForm
(
ChecksumForm
):
'''
Simple form for merging translation of two units.
...
...
weblate/trans/models/unit.py
View file @
71d8f061
...
...
@@ -207,6 +207,9 @@ class UnitManager(models.Manager):
params
[
'ignored'
]
)
if
'lang'
in
params
and
params
[
'lang'
]:
base
=
base
.
filter
(
translation__language__code
=
params
[
'lang'
])
if
not
params
[
'q'
]:
return
base
...
...
weblate/trans/views/basic.py
View file @
71d8f061
...
...
@@ -34,7 +34,7 @@ from weblate.trans.models import (
from
weblate.requirements
import
get_versions
,
get_optional_versions
from
weblate.lang.models
import
Language
from
weblate.trans.forms
import
(
get_upload_form
,
SearchForm
,
get_upload_form
,
SearchForm
,
SiteSearchForm
,
AutoForm
,
ReviewForm
,
NewLanguageForm
,
UserManageForm
,
ReportsForm
,
)
...
...
@@ -96,7 +96,7 @@ def home(request):
'top_suggestions'
:
top_suggestions
.
select_related
(
'user'
),
'last_changes'
:
last_changes
,
'last_changes_url'
:
''
,
'search_form'
:
SearchForm
(),
'search_form'
:
S
iteS
earchForm
(),
'whiteboard_messages'
:
wb_messages
,
}
)
...
...
@@ -106,7 +106,7 @@ def search(request):
"""
Performs site-wide search on units.
"""
search_form
=
SearchForm
(
request
.
GET
)
search_form
=
S
iteS
earchForm
(
request
.
GET
)
context
=
{
'search_form'
:
search_form
,
}
...
...
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