Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Commit

Permalink
minor: Small improvements for resource actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkal committed Apr 27, 2012
1 parent 0a3c332 commit 8650f2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion transifex/resources/views.py
Expand Up @@ -244,7 +244,8 @@ def resource_actions(request, project_slug=None, resource_slug=None,
Q(members=request.user)).distinct()

try:
stats = RLStats.objects.get(resource=resource, language=target_language)
stats = RLStats.objects.select_related('lock').get(
resource=resource, language=target_language)
except RLStats.DoesNotExist:
stats = RLStats(
untranslated=resource.total_entities,
Expand Down
13 changes: 6 additions & 7 deletions transifex/templates/resources/resource_actions.html
Expand Up @@ -20,7 +20,7 @@
$("div.language_chooser a").click( function(){
var target_lang_code = $("div.language_chooser select").val();
if (target_lang_code != "") {
request_url = '{% url clone_translate resource.project.slug resource.slug stats.language.code 111111111 %}';
request_url = '{% url clone_translate resource.project.slug resource.slug target_language.code 111111111 %}';
request_url = request_url.replace('111111111', target_lang_code);
window.location = request_url;
} else {
Expand All @@ -31,7 +31,7 @@
if(!$("#download_for_translation a").hasClass('disabled')){
$("#download_for_translation").click(function(){
$.ajax({
url : '{% url lock_and_download_for_translation resource.project.slug resource.slug stats.language.code %}',
url : '{% url lock_and_download_for_translation resource.project.slug resource.slug target_language.code %}',
contentType : 'application/json',
type : 'POST',
beforeSend: function(){
Expand Down Expand Up @@ -70,15 +70,15 @@
<h4>
{% trans "Resource" %}:
<a href="{% url project_detail project.slug %}" style="color:#444;">
{{ stats.resource.project.name|truncate_chars:"30" }}
{{ project.name|truncate_chars:"30" }}
</a>
&raquo;
<a href="{% url resource_detail project.slug resource.slug %}" style="color:#444;">
{{ stats.resource.name|truncate_chars:"30" }}
{{ resource.name|truncate_chars:"30" }}
</a>
&raquo;
<a href="{% url team_detail project.slug target_language.code %}" style="color:#444;">
{{ stats.language.name|truncate_chars:"20" }}
{{ target_language.name|truncate_chars:"20" }}
</a>
</h4>
<div class="first_level title_wrapper" style="padding-top:0;border-top:none;">
Expand All @@ -97,7 +97,6 @@ <h4>
{% comment %} This permission is provided if team is not available and then only the maintainers can access lotte via "Translate now" {% endcomment %}
{% get_permission "project_perm.submit_translations" for request.user and project as "can_submit_translation" %}
{% endif %}
{% get_permission "project_perm.maintain" for request.user and project as "is_maintainer" %}

{% ifequal resource.source_language target_language %}
{% blocktrans %}<span title="The source language cannot be translated">Source language</span>{% endblocktrans %}
Expand Down Expand Up @@ -308,4 +307,4 @@ <h4>
</li>
</ul>
</div>
</div>
</div>

0 comments on commit 8650f2b

Please sign in to comment.