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
181559a4
Commit
181559a4
authored
Nov 24, 2014
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
f8412acc
b5c03b31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
26 deletions
+50
-26
weblate/trans/tests/test_views.py
weblate/trans/tests/test_views.py
+38
-12
weblate/trans/views/source.py
weblate/trans/views/source.py
+12
-14
No files found.
weblate/trans/tests/test_views.py
View file @
181559a4
...
...
@@ -309,18 +309,6 @@ class BasicViewTest(ViewTestCase):
)
self
.
assertContains
(
response
,
'Test/Test'
)
def
test_review_source
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'review_source'
,
kwargs
=
self
.
kw_subproject
)
)
self
.
assertContains
(
response
,
'Test/Test'
)
def
test_view_source
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'show_source'
,
kwargs
=
self
.
kw_subproject
)
)
self
.
assertContains
(
response
,
'Test/Test'
)
def
test_view_unit
(
self
):
unit
=
self
.
get_unit
()
response
=
self
.
client
.
get
(
...
...
@@ -880,3 +868,41 @@ class HomeViewTest(ViewTestCase):
appsettings
.
ENABLE_WHITEBOARD
=
False
response
=
self
.
client
.
get
(
reverse
(
'home'
))
self
.
assertNotContains
(
response
,
'whiteboard'
)
class
SourceStringsTest
(
ViewTestCase
):
def
test_edit_priority
(
self
):
# Need extra power
self
.
user
.
is_superuser
=
True
self
.
user
.
save
()
source
=
self
.
get_unit
().
source_info
response
=
self
.
client
.
post
(
reverse
(
'edit_priority'
,
kwargs
=
{
'pk'
:
source
.
pk
}),
{
'priority'
:
60
}
)
self
.
assertRedirects
(
response
,
source
.
get_absolute_url
())
unit
=
self
.
get_unit
()
self
.
assertEquals
(
unit
.
priority
,
60
)
self
.
assertEquals
(
unit
.
source_info
.
priority
,
60
)
def
test_review_source
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'review_source'
,
kwargs
=
self
.
kw_subproject
)
)
self
.
assertContains
(
response
,
'Test/Test'
)
def
test_review_source_expand
(
self
):
unit
=
self
.
get_unit
()
response
=
self
.
client
.
get
(
reverse
(
'review_source'
,
kwargs
=
self
.
kw_subproject
),
{
'checksum'
:
unit
.
checksum
}
)
self
.
assertContains
(
response
,
unit
.
checksum
)
def
test_view_source
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'show_source'
,
kwargs
=
self
.
kw_subproject
)
)
self
.
assertContains
(
response
,
'Test/Test'
)
weblate/trans/views/source.py
View file @
181559a4
...
...
@@ -31,19 +31,24 @@ from weblate.trans.models import Translation, Source
from
weblate.trans.forms
import
PriorityForm
def
review
_source
(
request
,
project
,
subproject
):
def
get
_source
(
request
,
project
,
subproject
):
"""
Listing of source strings to review.
Returns first translation in subproject
(this assumes all have same source strings).
"""
obj
=
get_subproject
(
request
,
project
,
subproject
)
# Grab first translation in subproject
# (this assumes all have same source strings)
try
:
source
=
obj
.
translation_set
.
all
()[
0
]
return
obj
,
obj
.
translation_set
.
all
()[
0
]
except
Translation
.
DoesNotExist
:
raise
Http404
(
'No translation exists in this component.'
)
def
review_source
(
request
,
project
,
subproject
):
"""
Listing of source strings to review.
"""
obj
,
source
=
get_source
(
request
,
project
,
subproject
)
# Grab search type and page number
rqtype
=
request
.
GET
.
get
(
'type'
,
'all'
)
limit
=
request
.
GET
.
get
(
'limit'
,
50
)
...
...
@@ -89,14 +94,7 @@ def show_source(request, project, subproject):
"""
Show source strings summary and checks.
"""
obj
=
get_subproject
(
request
,
project
,
subproject
)
# Grab first translation in subproject
# (this assumes all have same source strings)
try
:
source
=
obj
.
translation_set
.
all
()[
0
]
except
Translation
.
DoesNotExist
:
raise
Http404
(
'No translation exists in this component.'
)
obj
,
source
=
get_source
(
request
,
project
,
subproject
)
return
render
(
request
,
...
...
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