resolved conflicts

This commit is contained in:
Karen 2011-07-01 00:27:02 +05:30
commit 503d7cf171
3 changed files with 19 additions and 6 deletions

View File

@ -133,13 +133,15 @@ class File(models.Model):
except:
url = ''
thumbnail = ''
studies = [{'id': s.id, 'name': s.name} for s in self.categories.all()]
return {
'id': self.id,
'url': url,
'thumbnail': thumbnail,
'title': self.title,
'description': self.description,
'type': self.type
'type': self.type,
'studies': studies
}
def save_chunk(self, chunk, name='data.bin'):

View File

@ -1,4 +1,5 @@
$(function() {
// alert("hi");
$('#filterForm').submit(function(e) {
e.preventDefault();
var formData = $(this).serializeArray();
@ -40,7 +41,8 @@ $(function() {
});
function getJQ(f) {
var jq = $("<div />").data("data", f).addClass("fileItem").text(f.type + ": " + f.title);
var jq = getListElement(f);
// var jq = $("<div />").data("data", f).addClass("fileItem").text(f.type + ": " + f.title);
jq.click(function() {
var $this = $(this);
$('.selectedItem').removeClass("selectedItem");
@ -54,10 +56,10 @@ function getJQ(f) {
html += "<img width='400' src='" + d.thumbnail + "' />";
break;
case "video":
html += "<video width='400' src='" + d.url + "' />";
html += "<video controls='controls' width='400' src='" + d.url + "' />";
break;
case "audio":
html += "<audio width='400' src='" + d.url + "' />";
html += "<audio controls='controls' width='400' src='" + d.url + "' />";
break;
default:
html += "";
@ -81,3 +83,13 @@ function getItemForm(f) {
var $submit = $('<input />').addClass("submitItem").attr("type", "submit").val("Submit").appendTo($form);
return $form;
}
function getListElement(f) {
// console.log(f);
var $item = $('<div />').addClass("fileItem").data("data", f);
var $icon = $('<img />').addClass("fileIcon").attr("src", "/static/images/icons2/" + f.type.toLowerCase() + ".jpg").appendTo($item);
var $title = $('<span />').addClass("fileTitle").text(f.title).appendTo($item);
var $study = $('<span />').addClass("fileStudy").text(" " + f.studies[0].name).appendTo($item);
var $checkbox = $('<input />').attr("type", "checkbox").addClass("fileCheckbox").appendTo($item);
return $item;
}

View File

@ -20,8 +20,7 @@
</div>
<div id="prevBtn">&lt;&lt;</div>
<div id="nextBtn">&gt;&gt;</div>
<div id="nextBtn">&gt;&gt;</div>
</div>
<div id="previewPane">