Commit c1efcf06 by kalyanikk Committed by Suma Shivaprasad

Show Tag / Taxonomy Listing in sorted order

parent bf2e6091
......@@ -403,7 +403,10 @@ define(['require',
}
function createTerm() {
_.each(that.childCollection.fullCollection.models, function(model, key) {
that.childCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
}
that.childCollection.fullCollection.sort().each(function(model, key) {
var name = Utils.checkTagOrTerm(model.get('name'), true);
var hrefUrl = "/api" + model.get('href').split("/api")[1];
if (name.name) {
......
......@@ -118,7 +118,7 @@ define(['require',
this.ui.typeLov.empty();
var str = '<option></option>';
this.typecollection.fullCollection.comparator = function(model) {
return model.get('tags');
return model.get('tags').toLowerCase();
}
this.typecollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get("tags") + '</option>';
......
......@@ -51,11 +51,7 @@ define(['require',
events: function() {
var events = {};
events["click " + this.ui.createTag] = 'onClickCreateTag';
/* events["dblclick " + this.ui.tags] = function(e) {
this.onTagList(e, true);
}*/
events["click " + this.ui.tags] = 'onTagList';
// events["click " + this.ui.referesh] = 'refereshClick';
events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag';
events["click " + this.ui.deleteTerm] = 'onDeleteTerm';
events['click ' + this.ui.refreshTag] = 'fetchCollections';
......@@ -69,7 +65,6 @@ define(['require',
_.extend(this, _.pick(options, 'globalVent', 'tag'));
this.tagCollection = new VTagList();
this.collection = new Backbone.Collection();
this.json = {
"enumTypes": [],
"traitTypes": [],
......@@ -157,16 +152,18 @@ define(['require',
tagsAndTypeGenerator: function(collection, searchString) {
var that = this,
str = '';
_.each(this[collection].fullCollection.models, function(model) {
var tagName = model.get("tags");
that.tagCollection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase();
}
that.tagCollection.fullCollection.sort().each(function(model) {
if (searchString) {
if (tagName.search(new RegExp(searchString, "i")) != -1) {
str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '" data-name="`' + tagName + '`" >' + tagName + '</a></li>' + str;
if (model.get('tags').search(new RegExp(searchString, "i")) != -1) {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('tags') + '" data-name="`' + model.get('tags') + '`" >' + model.get('tags') + '</a></li>';
} else {
return;
}
} else {
str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '" data-name="`' + tagName + '`">' + tagName + '</a></li>' + str;
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('tags') + '" data-name="`' + model.get('tags') + '`">' + model.get('tags') + '</a></li>';
}
});
this.ui.tagsParent.empty().html(str);
......
......@@ -95,8 +95,12 @@ define(['require',
}, this);
},
tagsCollection: function() {
this.collection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase();
}
var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>';
_.each(this.collection.fullCollection.models, function(obj, key) {
this.collection.fullCollection.sort().each(function(obj, key) {
str += '<option>' + obj.get('tags') + '</option>';
});
this.ui.addTagOptions.html(str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment