resizing, and some bugs

This commit is contained in:
sanj 2011-01-12 15:58:18 +05:30
parent 1de168f904
commit 90e51dbe3a
4 changed files with 58 additions and 21 deletions

View File

@ -101,15 +101,34 @@ def api_find(request):
model = getModel(data)
response = json_response({})
l = model.get_list(data)
if data.has_key('ids'):
ids = data['ids']
else:
ids = []
if data.has_key('range'):
response['data']['items'] = l
else:
response['data']['items'] = len(l)
response['data']['positions'] = _get_positions(ids, l)
response['status'] = {'code': 200}
return render_to_json_response(response)
def _get_positions(ids, l):
ret = {}
i = 0
for id in ids:
for obj in l:
if obj['id'] == id:
ret[id] = i
break
i += 1
return ret
def api_preview(request):
data = json.loads(request.POST['data'])
if not data.has_key('id'):
return render_to_json_response({'status': {'code': 404}})
id = int(data['id'])
model = getModel(data)
response = json_response({})

View File

@ -24,6 +24,7 @@ class BestPractice(ItfModel):
def info_dict(self):
return {
'id': self.id,
'title': self.title,
'story': self.story,
'guideline': self.guideline,

View File

@ -310,8 +310,8 @@ BEGIN mainPanel
{
element: app.construct.leftPanel(),
size: 256,
// resizable: true,
// resize: [0, 128, 256, 384]
resizable: true,
resize: [0, 128, 256, 384]
},
{
element: app.construct.middlePanel()
@ -320,8 +320,8 @@ BEGIN mainPanel
{
element: app.construct.rightPanel(),
size: 256,
// resizable: true,
// resize: [0, 128, 256, 384]
resizable: true,
resize: [0, 128, 256, 384]
}
]
});
@ -404,8 +404,8 @@ BEGIN mainPanel
{
element: app.construct.middleTopPanel(),
size: 128,
// resizable: true,
// resize: [0, 64, 128, 196, 256],
resizable: true,
resize: [0, 64, 128, 196, 256],
// collapsible: true
},
{
@ -415,8 +415,8 @@ BEGIN mainPanel
{
element: app.construct.middleBottomPanel(),
size: 128,
// resizable: true,
// resize: [0, 64, 128, 196, 256],
resizable: true,
resize: [0, 64, 128, 196, 256],
// collapsible: true
}
]
@ -435,14 +435,18 @@ BEGIN mainPanel
elements: [
{
element: app.construct.newsfeedBox(),
size: 256
size: 256,
resizable: true,
resize: [0,128,196,256,384,512]
},
{
element: app.construct.aboutBox()
},
{
element: app.construct.itfBox(),
size: 256
size: 256,
resizable: true,
resize: [0,128,196,256,384,512]
}
]
});
@ -496,14 +500,18 @@ BEGIN mainPanel
elements: [
{
element: app.construct.erangBox(),
size: 256
size: 256,
resizable: true,
resize: [0,128,196,256,384,512]
},
{
element: app.construct.scriptArchiveBox()
},
{
element: app.construct.bestPracticesBox(),
size: 256
size: 256,
resizable: true,
resize: [0,128,196,256,384,512]
}
]
});
@ -574,14 +582,18 @@ BEGIN mainPanel
elements: [
{
element: app.construct.biblioBox(),
size: 256
size: 256,
resizable: true,
resize: [0,128,196,256,384,512]
},
{
element: app.construct.offersNeedsBox()
},
{
element: app.construct.surveysBox(),
size: 256
size: 256,
resizable: true,
resize: [0,128,196,256,384,512]
}
]
});
@ -763,13 +775,14 @@ Ox.ItfBox = function(options, self) {
title: 'find',
type: 'image',
tooltip: 'Search'
})
})
.bindEvent("click", function() {
// alert("foo");
// $search.slideDown();
$search.is(":visible") ? $search.slideUp() : $search.slideDown();
$search.focus();
if ($search.is(":visible")) {
$search.slideUp();
} else {
$search.slideDown();
$search.focus();
}
})
.appendTo($buttons);
@ -865,6 +878,10 @@ Ox.ItfList = function(options, self) {
var self = self || {};
var that = new Ox.TextList(options, self);
that.bindEvent("select", function(e, data) {
if (data.ids.length === 0) {
app.$ui.previewBox.$content.html('');
return;
}
app.$ui[options.boxId].$loading.start();
// debugger;
app.api.preview({

View File

@ -1 +1 @@
jquery-1.4.3.min.js
jquery-1.4.4.js