2011-08-25 09:39:15 +00:00
|
|
|
$('#listLeft ul li a').live("click", function() {
|
|
|
|
// alert("foo");
|
|
|
|
// e.preventDefault();
|
2011-08-26 17:33:31 +00:00
|
|
|
if ($(this).hasClass("listLeftSelected")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$('.listLeftSelected').removeClass("listLeftSelected");
|
|
|
|
$(this).addClass('listLeftSelected');
|
2011-08-25 09:39:15 +00:00
|
|
|
var objId = $(this).attr("data-id");
|
|
|
|
var tabId = $('.innerSelected').attr("data-id");
|
|
|
|
$.getJSON("/m/get_details", {
|
|
|
|
'tab_id': tabId,
|
|
|
|
'object_id': objId
|
|
|
|
}, function(data) {
|
|
|
|
$('#textRight').text(data.title);
|
|
|
|
$('#bottomRight').html(data.html);
|
|
|
|
// console.log(data);
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
function getLi(item) {
|
2011-08-26 17:33:31 +00:00
|
|
|
var titleLength = 30;
|
2011-08-25 09:39:15 +00:00
|
|
|
var $li = $('<li />').addClass("tabListItem");
|
|
|
|
var $a = $('<a />').attr("href", '#').attr("data-id", item.id).appendTo($li);
|
2011-08-26 17:33:31 +00:00
|
|
|
// console.log(item.title.length);
|
2011-08-27 10:54:45 +00:00
|
|
|
var $span = $('<span />').text(item.title).appendTo($a);
|
2011-08-25 09:39:15 +00:00
|
|
|
return $li;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
$('#listLeft ul li a').eq(0).click();
|
|
|
|
// alert("hi");
|
|
|
|
$('.tabCategory').click(function() {
|
|
|
|
var $this = $(this);
|
|
|
|
if ($this.hasClass('.innerSelected')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('.innerSelected').removeClass("innerSelected");
|
|
|
|
$this.addClass("innerSelected");
|
|
|
|
$('.displayedTab').removeClass("displayedTab");
|
|
|
|
var tabId = $this.attr("data-id");
|
|
|
|
$('#tabText_' + tabId).addClass("displayedTab");
|
|
|
|
$('#loadingList').show();
|
|
|
|
$('.tabListItem').remove();
|
|
|
|
$.getJSON("/m/get_list", {
|
|
|
|
'tab_id': tabId,
|
|
|
|
'page_no': 1
|
|
|
|
}, function(data) {
|
|
|
|
$('#loadingList').hide();
|
|
|
|
for (var i=0; i<data.length; i++) {
|
|
|
|
var $li = getLi(data[i]);
|
|
|
|
$('#listLeft ul').append($li);
|
|
|
|
}
|
|
|
|
$('#listLeft ul li a').eq(0).click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|