From fafb1f05739f94bb846d3f7cd8f5663147b281d8 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 5 May 2015 09:57:21 +0200 Subject: [PATCH] SONAR-6138 apply feedback --- server/sonar-web/src/main/js/nav/search-view.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/sonar-web/src/main/js/nav/search-view.js b/server/sonar-web/src/main/js/nav/search-view.js index 007a2ebf537..e7e4bc9e370 100644 --- a/server/sonar-web/src/main/js/nav/search-view.js +++ b/server/sonar-web/src/main/js/nav/search-view.js @@ -136,15 +136,15 @@ define([ fetchFavorite: function () { var that = this; return $.get(baseUrl + '/api/favourites').done(function (r) { - that.favorite = r.map(function (f, index) { + that.favorite = r.map(function (f) { var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1; return { url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + dashboardParameters(true), name: isFile ? window.collapsedDirFromPath(f.lname) + window.fileFromPath(f.lname) : f.name, - icon: 'favorite', - extra: index === 0 ? t('favorite') : null + icon: 'favorite' }; }); + that.favorite = _.sortBy(that.favorite, 'name'); }); }, @@ -158,6 +158,9 @@ define([ extra: index === 0 ? t('browsed_recently') : null }; }), + favorite = _.first(this.favorite, 6).map(function (f, index) { + return _.extend(f, { extra: index === 0 ? t('favorite') : null }); + }), qualifiers = this.model.get('qualifiers').map(function (q, index) { return { url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q), @@ -165,7 +168,7 @@ define([ extra: index === 0 ? '' : null }; }); - this.results.reset([].concat(history, _.first(this.favorite, 6), qualifiers)); + this.results.reset([].concat(history, favorite, qualifiers)); }, search: function (q) { -- 2.39.5