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
966be38e
Commit
966be38e
authored
May 07, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to change strings priority
Fixes #123 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
179880ac
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
5 deletions
+50
-5
docs/changes.rst
docs/changes.rst
+1
-0
weblate/html/source-review.html
weblate/html/source-review.html
+9
-1
weblate/media/loader.js
weblate/media/loader.js
+25
-0
weblate/trans/forms.py
weblate/trans/forms.py
+4
-1
weblate/trans/models/source.py
weblate/trans/models/source.py
+7
-0
weblate/trans/views/source.py
weblate/trans/views/source.py
+4
-3
No files found.
docs/changes.rst
View file @
966be38e
...
...
@@ -8,6 +8,7 @@ Released on ? 2014.
* Documentation improvements.
* Added whiteboard for site wide messages.
* Configurable strings priority.
weblate 1.9
-----------
...
...
weblate/html/source-review.html
View file @
966be38e
...
...
@@ -43,7 +43,7 @@
<span
class=
"ui-icon ui-icon-triangle-1-e expander-icon"
></span>
</td>
<td
class=
"translatetext expander"
>
{{ source.source|fmttranslation }}
</td>
<td>
{{ source.source_info.get_priority_display }}
</td>
<td>
{{ source.source_info.get_priority_display }}
{% if perms.edit_priority %}
<a
class=
"button smallbutton edit-priority"
href=
"{% url 'edit_priority' pk=source.source_info.pk %}"
data-priority=
"{{ source.source_info.priority }}"
></a>
{% endif %}
</td>
<td>
{% show_checks source.active_source_checks user %}
{% if comments %}
...
...
@@ -71,6 +71,14 @@
{% endfor %}
</tbody>
</table>
<div
class=
"hidden"
id=
"priority_form"
title=
"{% trans "
Change
string
priority
"
%}"
>
<form
method=
"POST"
action=
""
>
{% csrf_token %}
{{ priority_form }}
<input
type=
"hidden"
name=
"next"
value=
"{{ request.get_full_path }}"
/>
</form>
</div>
{% else %}
<p>
{% trans "No matching source strings found!" %}
</p>
{% endif %}
...
...
weblate/media/loader.js
View file @
966be38e
...
...
@@ -268,6 +268,31 @@ $(function () {
$
(
'
.sug-upvote
'
).
button
({
text
:
false
,
icons
:
{
primary
:
"
ui-icon-plusthick
"
}});
$
(
'
.sug-downvote
'
).
button
({
text
:
false
,
icons
:
{
primary
:
"
ui-icon-minusthick
"
}});
$
(
'
.historybutton
'
).
button
({
text
:
true
,
icons
:
{
primary
:
"
ui-icon-arrowreturn-1-w
"
}});
$
(
'
.edit-priority
'
).
button
({
text
:
false
,
icons
:
{
primary
:
"
ui-icon-pencil
"
}}).
click
(
function
(
e
)
{
var
form
=
$
(
'
#priority_form
'
);
form
.
find
(
'
form
'
).
attr
(
'
action
'
,
$
(
this
).
attr
(
'
href
'
));
form
.
find
(
'
#id_priority
'
).
val
(
$
(
this
).
data
(
'
priority
'
));
form
.
dialog
({
modal
:
true
,
autoOpen
:
true
,
buttons
:
[
{
text
:
gettext
(
"
Ok
"
),
click
:
function
()
{
$
(
this
).
find
(
'
form
'
).
submit
();
$
(
this
).
dialog
(
"
close
"
);
}
},
{
text
:
gettext
(
"
Cancel
"
),
click
:
function
()
{
$
(
this
).
dialog
(
"
close
"
);
}
}
]
});
e
.
preventDefault
();
});
$
(
'
#navi
'
).
buttonset
();
$
(
'
#button-first
'
).
button
({
text
:
false
,
icons
:
{
primary
:
"
ui-icon-seek-first
"
}});
$
(
'
#button-next
'
).
button
({
text
:
false
,
icons
:
{
primary
:
"
ui-icon-seek-next
"
}});
...
...
weblate/trans/forms.py
View file @
966be38e
...
...
@@ -502,5 +502,8 @@ class NewLanguageForm(forms.Form):
class
PriorityForm
(
forms
.
Form
):
priority
=
forms
.
ChoiceField
(
label
=
_
(
'Priority'
),
choices
=
PRIORITY_CHOICES
choices
=
PRIORITY_CHOICES
,
help_text
=
_
(
'Strings with higher priority are offered first to translators.'
),
)
weblate/trans/models/source.py
View file @
966be38e
...
...
@@ -66,3 +66,10 @@ class Source(models.Model):
old
=
Source
.
objects
.
get
(
pk
=
self
.
pk
)
self
.
priority_modified
=
(
old
.
priority
!=
self
.
priority
)
super
(
Source
,
self
).
save
(
force_insert
,
**
kwargs
)
@
models
.
permalink
def
get_absolute_url
(
self
):
return
(
'review_source'
,
(),
{
'project'
:
self
.
subproject
.
project
.
slug
,
'subproject'
:
self
.
subproject
.
slug
,
})
weblate/trans/views/source.py
View file @
966be38e
...
...
@@ -26,7 +26,7 @@ from django.utils.translation import ugettext as _
from
django.views.decorators.http
import
require_POST
from
weblate.trans.views.helper
import
get_subproject
from
weblate.trans.models
import
Translation
from
weblate.trans.models
import
Translation
,
Source
from
weblate.trans.forms
import
PriorityForm
...
...
@@ -71,6 +71,7 @@ def review_source(request, project, subproject):
'source'
:
source
,
'sources'
:
sources
,
'rqtype'
:
rqtype
,
'priority_form'
:
PriorityForm
(),
'title'
:
_
(
'Review source strings in %s'
)
%
obj
.
__unicode__
(),
}
)
...
...
@@ -106,11 +107,11 @@ def edit_priority(request, pk):
"""
Change source string priority.
"""
source
=
get_object_or_404
(
pk
=
pk
)
source
=
get_object_or_404
(
Source
,
pk
=
pk
)
form
=
PriorityForm
(
request
.
POST
)
if
form
.
is_valid
():
source
.
priority
=
form
.
cleaned_data
[
'priority'
]
source
.
save
()
else
:
messages
.
error
(
request
,
_
(
'Failed to change a priority!'
))
return
redirect
(
request
.
POST
.
get
(
'next'
,
translation
))
return
redirect
(
request
.
POST
.
get
(
'next'
,
source
.
get_absolute_url
()
))
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