insert tag on table load

This commit is contained in:
Ezequiel Bergamaschi 2014-01-29 02:55:00 -03:00 committed by Ezequiel Bergamaschi
parent eff063ca37
commit ed55fd824f
2 changed files with 9 additions and 4 deletions

View File

@ -1,7 +1,4 @@
function createLabelItem(data) { function createLabelItem(data) {
if (data.color == "") {
data.color = "#000000";
}
$("#foldersContainer").find("ul").append( $("#foldersContainer").find("ul").append(
$("<li data-filter=\"" + data.title + "\">").append( $("<li data-filter=\"" + data.title + "\">").append(
"<a href=\"#\"> <i class=\"icon-tag\"></i>" + "<a href=\"#\"> <i class=\"icon-tag\"></i>" +
@ -10,7 +7,15 @@ function createLabelItem(data) {
"</a>" "</a>"
) )
) )
}
function labelTagsAsHtml(labels) {
var result = "";
for (var i = 0; i<labels.length; i++) {
var label = labels[i];
result+= "<div class='labelTag' style='background-color:" + label.color + "'>"+ label.title + "</div>"
}
return result;
} }
function fetchLabels(options) { function fetchLabels(options) {

View File

@ -62,7 +62,7 @@
bUseRendered:false, bUseRendered:false,
mDataProp:"title", mDataProp:"title",
fnRender:function (obj) { fnRender:function (obj) {
return '<span class="icon-file icon-blue"></span>' + '<a href="c/maps/' + obj.aData.id + '/edit">' + $('<span></span>').text(obj.aData.title).html() + '</a>'; return '<span class="icon-file icon-blue"></span>' + '<a href="c/maps/' + obj.aData.id + '/edit">' + $('<span></span>').text(obj.aData.title).html() + labelTagsAsHtml(obj.aData.labels) + '</a>';
} }
}, },
{ {