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) model = getModel(data)
response = json_response({}) response = json_response({})
l = model.get_list(data) l = model.get_list(data)
if data.has_key('ids'):
ids = data['ids']
else:
ids = []
if data.has_key('range'): if data.has_key('range'):
response['data']['items'] = l response['data']['items'] = l
else: else:
response['data']['items'] = len(l) response['data']['items'] = len(l)
response['data']['positions'] = _get_positions(ids, l)
response['status'] = {'code': 200} response['status'] = {'code': 200}
return render_to_json_response(response) 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): def api_preview(request):
data = json.loads(request.POST['data']) data = json.loads(request.POST['data'])
if not data.has_key('id'):
return render_to_json_response({'status': {'code': 404}})
id = int(data['id']) id = int(data['id'])
model = getModel(data) model = getModel(data)
response = json_response({}) response = json_response({})

View File

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

View File

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

View File

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