binimages added and bin search changed to search for category and type
This commit is contained in:
parent
fda8c46b23
commit
2a44082b5a
|
@ -373,7 +373,8 @@ def imagebox_delete(request):
|
||||||
def category_json(request):
|
def category_json(request):
|
||||||
if request.GET:
|
if request.GET:
|
||||||
catid = request.GET['id']
|
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 = []
|
rList = []
|
||||||
for r in resources:
|
for r in resources:
|
||||||
# these should not be here
|
# these should not be here
|
||||||
|
@ -398,7 +399,7 @@ def category_json(request):
|
||||||
resizedPath = filePath
|
resizedPath = filePath
|
||||||
else:
|
else:
|
||||||
filePath = r.file.url
|
filePath = r.file.url
|
||||||
iconPath = "/static/images/binimages/%s.jpg" % (r.ext)
|
iconPath = "/static/images/binimages/%s.jpg" % (r.type)
|
||||||
resizedPath = filePath
|
resizedPath = filePath
|
||||||
if r.type == 'video':
|
if r.type == 'video':
|
||||||
try:
|
try:
|
||||||
|
@ -415,13 +416,16 @@ def category_json(request):
|
||||||
else:
|
else:
|
||||||
media_id = 0
|
media_id = 0
|
||||||
|
|
||||||
|
if r.description == '':
|
||||||
|
description = r.full_path
|
||||||
|
else:
|
||||||
|
description = r.description
|
||||||
d = {
|
d = {
|
||||||
'id': r.id,
|
'id': r.id,
|
||||||
'type': r.type,
|
'type': r.type,
|
||||||
'title': r.title,
|
'title': r.title,
|
||||||
'file': filePath,
|
'file': filePath,
|
||||||
'description': r.description,
|
'description': description,
|
||||||
'tags': r.tags,
|
'tags': r.tags,
|
||||||
'icon': iconPath,
|
'icon': iconPath,
|
||||||
'width': width,
|
'width': width,
|
||||||
|
|
BIN
edgware/static/images/binimages/audio.jpg
Normal file
BIN
edgware/static/images/binimages/audio.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
edgware/static/images/binimages/image.jpg
Normal file
BIN
edgware/static/images/binimages/image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
edgware/static/images/binimages/other.jpg
Normal file
BIN
edgware/static/images/binimages/other.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
edgware/static/images/binimages/text.jpg
Normal file
BIN
edgware/static/images/binimages/text.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
edgware/static/images/binimages/video.jpg
Normal file
BIN
edgware/static/images/binimages/video.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -802,7 +802,7 @@ Bin.prototype.loadCategory = function(catid, type) {
|
||||||
var that = this;
|
var that = this;
|
||||||
this.jq.find('.resource').remove();
|
this.jq.find('.resource').remove();
|
||||||
this.resources = [];
|
this.resources = [];
|
||||||
$.getJSON("/edit/category/json/", {'id': catid}, function(json) {
|
$.getJSON("/edit/category/json/", {'id': catid, 'type': type}, function(json) {
|
||||||
var resources = json.resources;
|
var resources = json.resources;
|
||||||
for (r in resources) {
|
for (r in resources) {
|
||||||
if (resources.hasOwnProperty(r)) {
|
if (resources.hasOwnProperty(r)) {
|
||||||
|
|
|
@ -51,10 +51,17 @@
|
||||||
isAjaxActive = false;
|
isAjaxActive = false;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
edgeBin = new Bin();
|
edgeBin = new Bin();
|
||||||
$('#searchSelect').change(function() {
|
$('.binSelect').change(function() {
|
||||||
// var PAGE_ID = 1;
|
// var PAGE_ID = 1;
|
||||||
var val = $(this).val();
|
var cat = $('#searchSelect').val();
|
||||||
edgeBin.loadCategory(val);
|
if (cat == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var type = $('#typeSelect').val();
|
||||||
|
if (type == 0) {
|
||||||
|
type = 'image';
|
||||||
|
}
|
||||||
|
edgeBin.loadCategory(cat, type);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -213,7 +220,7 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="typeSelect" class="binSelect" name="typeSelect">
|
<select id="typeSelect" class="binSelect" name="typeSelect">
|
||||||
<option value="0">Type</option>
|
<option value="0">Type</option>
|
||||||
<option value="images">Images</option>
|
<option value="image">Images</option>
|
||||||
<option value="audio">Audio</option>
|
<option value="audio">Audio</option>
|
||||||
<option value="video">Video</option>
|
<option value="video">Video</option>
|
||||||
<option value="text">Text</option>
|
<option value="text">Text</option>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user