From 77d376a9977075525c4572950374f7358b66466d Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 26 Aug 2011 23:03:31 +0530 Subject: [PATCH] truncate titles to 30... chars --- itf/static/js/insidepage.js | 14 +++++++++++++- itf/static/js/jquery.js | 1 - itf/templates/noel/insidepage.html | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) delete mode 120000 itf/static/js/jquery.js diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index 29d0102..db2b0c2 100644 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -1,6 +1,11 @@ $('#listLeft ul li a').live("click", function() { // alert("foo"); // e.preventDefault(); + if ($(this).hasClass("listLeftSelected")) { + return false; + } + $('.listLeftSelected').removeClass("listLeftSelected"); + $(this).addClass('listLeftSelected'); var objId = $(this).attr("data-id"); var tabId = $('.innerSelected').attr("data-id"); $.getJSON("/m/get_details", { @@ -15,9 +20,16 @@ $('#listLeft ul li a').live("click", function() { }); function getLi(item) { + var titleLength = 30; var $li = $('
  • ').addClass("tabListItem"); var $a = $('').attr("href", '#').attr("data-id", item.id).appendTo($li); - var $span = $('').text(item.title).appendTo($a); +// console.log(item.title.length); + if (item.title.length > titleLength) { + var title = item.title.substring(0,titleLength) + "..."; + } else { + var title = item.title; + } + var $span = $('').text(title).appendTo($a); return $li; } diff --git a/itf/static/js/jquery.js b/itf/static/js/jquery.js deleted file mode 120000 index 169c7e9..0000000 --- a/itf/static/js/jquery.js +++ /dev/null @@ -1 +0,0 @@ -jquery-1.6.2.min.js \ No newline at end of file diff --git a/itf/templates/noel/insidepage.html b/itf/templates/noel/insidepage.html index 8b2b1ac..7e446be 100644 --- a/itf/templates/noel/insidepage.html +++ b/itf/templates/noel/insidepage.html @@ -67,7 +67,7 @@