This commit is contained in:
sanj 2011-01-13 15:38:10 +05:30
parent 90e51dbe3a
commit 554e4ef02e
4 changed files with 74 additions and 7 deletions

View File

@ -91,7 +91,11 @@ class ItfModel(models.Model):
sort = options['sort']
if sort != []:
for s in sort:
sort = s['operator'] + s['key']
if s['operator'] == '-':
operator = '-'
else:
operator = ''
sort = operator + s['key']
qset = qset.order_by(sort)
r0 = options['range'][0]
r1 = options['range'][1]

View File

@ -6,3 +6,7 @@
font-weight: bold;
font-size: 1.2em;
}
.itfPreviewTitle {
font-weight: bold;
}

View File

@ -709,7 +709,8 @@ Ox.ItfBox = function(options, self) {
var self = self || {};
var that = new Ox.Element(options, self)
.defaults({
'title': ''
'title': '',
'extraButtons': []
})
.options(options);
var title = self.options.title;
@ -742,9 +743,19 @@ Ox.ItfBox = function(options, self) {
});
that.search = function(word) {
$search.options("value", word);
$search.triggerEvent("submit");
}
var $buttons = new Ox.Element().appendTo($title).css({'position': 'absolute', 'top': '1px', 'right': '16px'});
that.$loading = new Ox.LoadingIcon().appendTo($buttons);
var $additionalButtons = self.options.extraButtons;
if ($additionalButtons.length > 0) {
$additionalButtons.appendTo($buttons);
}
var $infoBtn = new Ox.Button({
id: options.id + "InfoBtn",
style: 'symbold',
@ -799,11 +810,62 @@ Ox.ItfBox = function(options, self) {
id: options.id + 'Menu',
element: $menuBtn,
items: [
{id: 'Test', title: 'Menu Item 1'},
{
id: 'SortBy',
title: 'Sort By',
items: [
{
'group': 'sortGroup',
'min': 1,
'max': 1,
items: [
{'id': 'sort_added_descending', title: 'Added (Descending)', checked: true},
{'id': 'sort_added_ascending', title: 'Added (Ascending)'},
{'id': 'sort_title_ascending', title: 'Title (Ascending)'},
{'id': 'sort_title_descending', title: 'Title (Descending)'},
]
}
]
},
{id: 'Test2', title: 'Menu Item 2'}
]
})
.bindEvent("change", function(e, data) {
if (data.id === 'sortGroup') {
var checked = data.checked[0];
var checkedId = checked.id;
var checkedField = checkedId.split("_")[1];
var operator = checkedId.split("_")[2] == "ascending" ? "+" : "-";
$list.sortList(checkedField, operator);
}
});
// var $menu = new Ox.Menu({
// id: options.id + 'Menu',
// element: $menuBtn,
// items: [
// {
// 'group': 'sortGroup',
// 'min': 1,
// 'max': 1,
// items: [
// {'id': 'sortTitleAscending', title: 'Title (Ascending)', checked: true},
// {'id': 'sortTitleDescending', title: 'Title (Descending)'},
// {'id': 'sortTitleAscendingFoo', title: 'Title (Ascending)'},
// {'id': 'sortTitleDescendingFoo', title: 'Title (Descending)'},
// ]
// }
// ]
// },
// {id: 'Test2', title: 'Menu Item 2'}
// ]
// })
// .bindEvent("change", function() {
// alert("foo");
// });
//
$menuBtn.bindEvent("click", function() {
$menu.showMenu();
});
@ -860,10 +922,6 @@ Ox.ItfBox = function(options, self) {
{
key: 'added',
operator: '-'
},
{
key: 'id',
operator: '-'
}
]
});

View File

@ -1,4 +1,5 @@
<div class="itfPreview">
<span class="itfPreviewTitle">${title}</span><br /><br />
<span class="itfPreviewSub">Category: </span><span class="itfPreviewText">${category}</span> <br /><br />
<span class="itfPreviewSub">Quick Howto: </span><span class="itfPreviewText">${quick_howto}</span>
</div>