Commits

Seraphim Mellos committed e4c6c83

Added url_info details in resource_detail page.

Comments (0)

Files changed (2)

transifex/resources/views.py

 from django.core.urlresolvers import reverse
 from django.contrib.auth.decorators import login_required
 from django.dispatch import Signal
+from django.core.exceptions import ObjectDoesNotExist
 from django.db.models import Count, Q, get_model
 from django.http import (HttpResponseRedirect, HttpResponse, Http404, 
                          HttpResponseForbidden, HttpResponseBadRequest)
             Q(coordinators=request.user)|
             Q(members=request.user)).distinct()
 
+    try:
+        autofetch_url = resource.url_info
+    except ObjectDoesNotExist:
+        autofetch_url = None
+
     statslist = RLStats.objects.select_related('language', 'last_committer',
         'lock').by_resource(resource)
 
     return render_to_response("resources/resource_detail.html",
         { 'project' : resource.project,
           'resource' : resource,
+          'autofetch_url': autofetch_url,
           'languages' : Language.objects.order_by('name'),
           'user_teams' : user_teams,
           'statslist': statslist },

transifex/templates/resources/resource_detail.html

       </td>
     </tr>
     <tr>
+      <th class="i16 merge">{% trans "Auto-update from URL?" %}</th>
+      <td>
+        {% if autofetch_url and autofetch_url.auto_update %} 
+		    <img class="noborder" src="{{ STATIC_URL }}images/icons/accept.png" /> &nbsp;
+			<span><a href="{{ autofetch_url.source_file_url }}">[link to file]</a></span>
+        {% else %}
+            <img class="noborder" src="{{ STATIC_URL }}images/icons/delete.png" />
+        {% endif %}
+      </td>
+    </tr>
+    <tr>
       <th class="i16 allow_file">{% trans "Accepting Translations?" %}</th>
       <td>
         {% if resource.accept_translations %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.