binimages added and bin search changed to search for category and type

This commit is contained in:
sanj 2010-07-28 15:03:30 +05:30
parent fda8c46b23
commit 2a44082b5a
8 changed files with 20 additions and 9 deletions

View File

@ -373,7 +373,8 @@ def imagebox_delete(request):
def category_json(request):
if request.GET:
catid = request.GET['id']
resources = File.objects.filter(categories__id=catid)
typ = request.GET.get('type', 'image')
resources = File.objects.filter(categories__id=catid, type=typ)
rList = []
for r in resources:
# these should not be here
@ -398,7 +399,7 @@ def category_json(request):
resizedPath = filePath
else:
filePath = r.file.url
iconPath = "/static/images/binimages/%s.jpg" % (r.ext)
iconPath = "/static/images/binimages/%s.jpg" % (r.type)
resizedPath = filePath
if r.type == 'video':
try:
@ -415,13 +416,16 @@ def category_json(request):
else:
media_id = 0
if r.description == '':
description = r.full_path
else:
description = r.description
d = {
'id': r.id,
'type': r.type,
'title': r.title,
'file': filePath,
'description': r.description,
'description': description,
'tags': r.tags,
'icon': iconPath,
'width': width,

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -802,7 +802,7 @@ Bin.prototype.loadCategory = function(catid, type) {
var that = this;
this.jq.find('.resource').remove();
this.resources = [];
$.getJSON("/edit/category/json/", {'id': catid}, function(json) {
$.getJSON("/edit/category/json/", {'id': catid, 'type': type}, function(json) {
var resources = json.resources;
for (r in resources) {
if (resources.hasOwnProperty(r)) {

View File

@ -51,10 +51,17 @@
isAjaxActive = false;
$(document).ready(function() {
edgeBin = new Bin();
$('#searchSelect').change(function() {
$('.binSelect').change(function() {
// var PAGE_ID = 1;
var val = $(this).val();
edgeBin.loadCategory(val);
var cat = $('#searchSelect').val();
if (cat == 0) {
return;
}
var type = $('#typeSelect').val();
if (type == 0) {
type = 'image';
}
edgeBin.loadCategory(cat, type);
});
});
</script>
@ -213,7 +220,7 @@
</select>
<select id="typeSelect" class="binSelect" name="typeSelect">
<option value="0">Type</option>
<option value="images">Images</option>
<option value="image">Images</option>
<option value="audio">Audio</option>
<option value="video">Video</option>
<option value="text">Text</option>