[extensions-web] review: Fix the view of raw assets
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] review: Fix the view of raw assets
- Date: Tue, 7 Feb 2012 19:47:36 +0000 (UTC)
commit b6b074b0e60a9a821c9ce3e84a12cca5c55ab1ac
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Feb 7 13:21:57 2012 -0500
review: Fix the view of raw assets
sweettooth/review/views.py | 11 +++++------
sweettooth/static/js/review.js | 6 +++---
2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index ee5a194..cd25d01 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -89,15 +89,14 @@ def html_for_file(filename, version, raw):
if extension in IMAGE_TYPES:
mime = IMAGE_TYPES[extension]
raw_base64 = base64.standard_b64encode(raw)
-
- return dict(html='<img src="data:%s;base64,%s">' % (mime, raw_base64,),
- num_lines=0)
-
+ return dict(raw=True, binary=False,
+ html='<img src="data:%s;base64,%s">' % (mime, raw_base64,))
elif extension in BINARY_TYPES:
download_url = reverse('review-download', kwargs=dict(pk=version.pk))
- return dict(binary=True, url=download_url)
+ return dict(raw=False, binary=True, url=download_url)
else:
- return dict(binary=False, lines=split_lines(highlight_file(filename, raw, code_formatter)))
+ return dict(raw=False, binary=False,
+ lines=split_lines(highlight_file(filename, raw, code_formatter)))
def get_zipfiles(version, old_version_number=None):
extension = version.extension
diff --git a/sweettooth/static/js/review.js b/sweettooth/static/js/review.js
index 6a709b2..ea47f97 100644
--- a/sweettooth/static/js/review.js
+++ b/sweettooth/static/js/review.js
@@ -5,14 +5,14 @@ define(['jquery', 'diff'], function($, diff) {
var REVIEW_URL_BASE = '/review/ajax';
function buildFileView(data) {
- var $fileView, $table, $tr;
+ if (data.raw)
+ return $(data.html);
- if (data.binary) {
+ if (data.binary)
return $("<p>").
append("This file is binary. Please ").
append($("<a>", {'href': data.url}).text("download the zipfile")).
append("to see it.");
- }
var $table = $('<table>', {'class': 'code'});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]