add icons for file items
This commit is contained in:
parent
8765b34683
commit
c00a619ab4
|
@ -133,13 +133,15 @@ class File(models.Model):
|
||||||
except:
|
except:
|
||||||
url = ''
|
url = ''
|
||||||
thumbnail = ''
|
thumbnail = ''
|
||||||
|
studies = [{'id': s.id, 'name': s.name} for s in self.categories.all()]
|
||||||
return {
|
return {
|
||||||
'id': self.id,
|
'id': self.id,
|
||||||
'url': url,
|
'url': url,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'title': self.title,
|
'title': self.title,
|
||||||
'description': self.description,
|
'description': self.description,
|
||||||
'type': self.type
|
'type': self.type,
|
||||||
|
'studies': studies
|
||||||
}
|
}
|
||||||
|
|
||||||
def save_chunk(self, chunk, name='data.bin'):
|
def save_chunk(self, chunk, name='data.bin'):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
|
// alert("hi");
|
||||||
$('#filterForm').submit(function(e) {
|
$('#filterForm').submit(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var formData = $(this).serializeArray();
|
var formData = $(this).serializeArray();
|
||||||
|
@ -40,7 +41,8 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function getJQ(f) {
|
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() {
|
jq.click(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$('.selectedItem').removeClass("selectedItem");
|
$('.selectedItem').removeClass("selectedItem");
|
||||||
|
@ -81,3 +83,13 @@ function getItemForm(f) {
|
||||||
var $submit = $('<input />').addClass("submitItem").attr("type", "submit").val("Submit").appendTo($form);
|
var $submit = $('<input />').addClass("submitItem").attr("type", "submit").val("Submit").appendTo($form);
|
||||||
return $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;
|
||||||
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
<div id="fileList">
|
<div id="fileList">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="prevBtn"><<</div>
|
<div id="prevBtn">prev</div>
|
||||||
<div id="nextBtn">>></div>
|
<div id="nextBtn">next</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="previewPane">
|
<div id="previewPane">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user