]> source.dussan.org Git - sonarqube.git/commitdiff
fix SONAR-6041 improve search
authorStas Vilchik <vilchiks@gmail.com>
Mon, 19 Jan 2015 08:36:37 +0000 (09:36 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 19 Jan 2015 08:55:31 +0000 (09:55 +0100)
server/sonar-web/src/main/hbs/nav/nav-search-item.hbs
server/sonar-web/src/main/js/nav/search-view.js
server/sonar-web/src/main/less/navbar.less

index b9e1c60b016ab490dfec3e498c11ca37e1fe6c56..1de73f23eab93f86d0a60f9a978f0f24998f1e7d 100644 (file)
@@ -2,5 +2,15 @@
   {{#if extra}}
     <span class="navbar-search-extra subtitle">{{extra}}</span>
   {{/if}}
-  {{#if q}}{{qualifierIcon q}}&nbsp;{{/if}}{{name}}
+  {{#if q}}{{qualifierIcon q}}{{/if}}
+  {{#if subtitle}}
+    {{title}}
+    <br>
+    {{#if extra}}
+      <span class="navbar-search-extra subtitle">&nbsp;</span>
+    {{/if}}
+    <span class="subtitle">{{subtitle}}</span>
+  {{else}}
+    {{name}}
+  {{/if}}
 </a>
index b4a5d5a7a4ca487b0b360c65eb31f5f6d0bd4ca8..6efd0ca8f92aa1d69af48724821c3c2c84cfda48 100644 (file)
@@ -115,31 +115,29 @@ define([
       this.results.reset(history.concat(qualifiers));
     },
 
-    open: function () {
-      this.$el.addClass('open');
-    },
-
-    disableOpen: function () {
-      this.$el.removeClass('open');
-    },
-
     search: function (q) {
       if (q.length < 2) {
         this.resetResultsToDefault();
-        this.disableOpen();
         return;
       }
       var that = this,
           url = baseUrl + '/api/components/suggestions',
           options = { s: q },
           p = window.process.addBackgroundProcess();
-      this.open();
       return $.get(url, options).done(function (r) {
         var collection = [];
         r.results.forEach(function (domain) {
           domain.items.forEach(function (item, index) {
+            var title = item.name,
+                subtitle = null;
+            if (domain.q === 'FIL' || domain.q === 'UTS') {
+              subtitle = title.substr(0, title.lastIndexOf('/') - 1);
+              title = title.substr(title.lastIndexOf('/') + 1);
+            }
             collection.push(_.extend(item, {
               q: domain.q,
+              title: title,
+              subtitle: subtitle,
               extra: index === 0 ? domain.name : ' ',
               url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + dashboardParameters(true)
             }));
index 89b83f14115e9806526fae680b0563e053a2ef41..17c3b7eba0da9f5ce46102a377e485447c291062 100644 (file)
 
 .navbar-search {
   position: relative;
-  width: 240px;
+  width: 400px;
   .box-sizing(border-box);
   .trans(width);
-
-  &.open {
-    width: 40vw;
-  }
 }
 
 .navbar-search-input {