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
d4406bd1
Commit
d4406bd1
authored
Mar 10, 2015
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
d3edc531
9a8e583d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
weblate/html/translate.html
weblate/html/translate.html
+2
-2
weblate/trans/tests/test_suggestions.py
weblate/trans/tests/test_suggestions.py
+17
-1
weblate/trans/views/edit.py
weblate/trans/views/edit.py
+3
-3
No files found.
weblate/html/translate.html
View file @
d4406bd1
...
...
@@ -185,7 +185,7 @@
{% if not unit.only_vote_suggestions or perms.trans.override_suggestion %}
{% if perms.trans.accept_suggestion %}
<button
type=
"submit"
class=
"btn btn-success btn-xs"
name=
"accept"
value=
"{{ suggestion.id }}"
><i
class=
"fa fa-check"
></i>
{% trans "Accept" %}
</button>
<button
type=
"submit"
class=
"btn btn-warning btn-xs"
name=
"accept
-
edit"
value=
"{{ suggestion.id }}"
><i
class=
"fa fa-pencil"
></i>
{% trans "Accept and edit" %}
</button>
<button
type=
"submit"
class=
"btn btn-warning btn-xs"
name=
"accept
_
edit"
value=
"{{ suggestion.id }}"
><i
class=
"fa fa-pencil"
></i>
{% trans "Accept and edit" %}
</button>
{% endif %}
{% if perms.trans.delete_suggestion %}
<button
type=
"submit"
class=
"btn btn-danger btn-xs"
name=
"delete"
value=
"{{ suggestion.id }}"
><i
class=
"fa fa-trash"
></i>
{% trans "Delete" %}
</button>
...
...
@@ -292,7 +292,7 @@
{% if perms.trans.add_comment %}
<form
method=
"post"
action=
"{% url 'comment' pk=unit.id %}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"next"
value=
"{{ this_unit_url }}"
/>
<input
type=
"hidden"
name=
"next"
value=
"{{ this_unit_url }}
#comments
"
/>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
><h4
class=
"panel-title"
>
{% trans "New comment" %}
</h4></div>
<div
class=
"panel-body"
>
...
...
weblate/trans/tests/test_suggestions.py
View file @
d4406bd1
...
...
@@ -110,6 +110,22 @@ class SuggestionsTest(ViewTestCase):
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertEqual
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
def
test_accept_edit
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
# Create suggestion
self
.
add_suggestion_1
()
# Get ids of created suggestions
suggestion
=
self
.
get_unit
().
suggestions
()[
0
].
pk
# Accept one of suggestions
response
=
self
.
edit_unit
(
'Hello, world!
\
n
'
,
''
,
accept_edit
=
suggestion
,
)
self
.
assertRedirectsOffset
(
response
,
translate_url
,
0
)
def
test_accept
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
# Create two suggestions
...
...
@@ -164,7 +180,7 @@ class SuggestionsTest(ViewTestCase):
''
,
accept
=
suggestions
[
0
].
pk
,
)
self
.
assertRedirectsOffset
(
response
,
translate_url
,
0
)
self
.
assertRedirectsOffset
(
response
,
translate_url
,
1
)
# Reload from database
unit
=
self
.
get_unit
()
...
...
weblate/trans/views/edit.py
View file @
d4406bd1
...
...
@@ -407,7 +407,7 @@ def handle_suggestions(translation, request, this_unit_url, next_unit_url):
Handles suggestion deleting/accepting.
'''
sugid
=
''
params
=
(
'accept'
,
'accept
-
edit'
,
'delete'
,
'upvote'
,
'downvote'
)
params
=
(
'accept'
,
'accept
_
edit'
,
'delete'
,
'upvote'
,
'downvote'
)
redirect_url
=
this_unit_url
# Parse suggestion ID
...
...
@@ -420,7 +420,7 @@ def handle_suggestions(translation, request, this_unit_url, next_unit_url):
sugid
=
int
(
sugid
)
suggestion
=
Suggestion
.
objects
.
get
(
pk
=
sugid
)
if
'accept'
in
request
.
POST
or
'accept
-
edit'
in
request
.
POST
:
if
'accept'
in
request
.
POST
or
'accept
_
edit'
in
request
.
POST
:
# Accept suggesion
if
not
request
.
user
.
has_perm
(
'trans.accept_suggestion'
):
messages
.
error
(
...
...
@@ -514,7 +514,7 @@ def translate(request, project, subproject, lang):
# Handle accepting/deleting suggestions
if
(
'accept'
not
in
request
.
POST
and
'accept
-
edit'
not
in
request
.
POST
and
'accept
_
edit'
not
in
request
.
POST
and
'delete'
not
in
request
.
POST
and
'upvote'
not
in
request
.
POST
and
'downvote'
not
in
request
.
POST
):
...
...
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