Commit 4dd57d9a authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Show total nr of search results.

parent 5ddd4366
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -103,8 +103,10 @@ Ext.define('Docs.controller.Search', {

    search: function(term) {
        // perform search and load results to store
        var limit = 10;
        var results = this.filterMembers(term);
        Docs.App.getStore('Search').loadData(results, false);
        this.getDropdown().setTotal(results.length);
        this.getDropdown().getStore().loadData(results.slice(0, limit));
        // position dropdown below search box
        this.getDropdown().alignTo('search-field', 'bl', [-23, 2]);
        // hide dropdown when nothing found
@@ -117,7 +119,7 @@ Ext.define('Docs.controller.Search', {
        }
    },

    filterMembers: function(text, n) {
    filterMembers: function(text) {
        var results = [[], [], [], [], []];
        var xFull=0, nFull=1, xBeg=2, nBeg=3, nMid=4;
        var hasDot = /\./.test(text);
@@ -148,8 +150,7 @@ Ext.define('Docs.controller.Search', {
            }
        });

        // flatten results array and returns first n results
        return Ext.Array.flatten(results).slice(0, n || 10);
        return Ext.Array.flatten(results);
    }

});
+31 −8
Original line number Diff line number Diff line
@@ -19,12 +19,35 @@ Ext.define('Docs.view.search.Dropdown', {
    itemSelector:'div.item',
    singleSelect: true,

    tpl: new Ext.XTemplate(
    initComponent: function() {
        this.tpl = new Ext.XTemplate(
            '<tpl for=".">',
                '<div class="item {type}">',
                    '<div class="title">{member}</div>',
                    '<div class="class">{cls}</div>',
                '</div>',
        '</tpl>'
    )
            '</tpl>',
            '<div class="total">{[values.length]} of {[this.getTotal()]}</div>',
            {
                getTotal: Ext.bind(this.getTotal, this)
            }
        );
        this.callParent(arguments);
    },

    /**
     * Sets number of total search results
     * @param {Number} total
     */
    setTotal: function(total) {
        this.total = total;
    },

    /**
     * Returns number of total search results
     * @return {Number}
     */
    getTotal: function() {
        return this.total;
    }
});
+7 −4
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ a:hover {
  left: 20px;
  z-index: 5;

  .item {
  .item, .total {
    display: block;
    cursor: pointer;
    overflow: hidden;
@@ -163,13 +163,12 @@ a:hover {
    border-width: 0px 0px 1px 0px;
    border-style: solid;
    border-color: #bebdbf;
    .title {
    color: #605f5f;
    .title {
      font-weight: bold;
      overflow: hidden;
      text-overflow: ellipsis; }
    .class {
      color: #605f5f;
      font-size: 0.85em;
      overflow: hidden;
      text-overflow: ellipsis; } }
@@ -186,7 +185,11 @@ a:hover {
  .item.x-item-selected {
    background-color: #ffffaa; }
  .item.x-view-over {
    background-color: #ffffaa; } }
    background-color: #ffffaa; }
  .total {
    cursor: auto;
    text-align: right;
    font-size: 0.85em; } }


#center-container, #west-region-container {