text: var PaginatorView = require('./paginator-view');
  var searchTemplate = require('./search-paginator-template.tpl');
  var paginationTemplate = require('./pagination-template.tpl');
  
  module.exports = PaginatorView.extend({
    className: 'CDB-Widget-nav is-hidden CDB-Widget-contentSpaced',
  
    render: function () {
      this.clearSubViews();
      this.$el.empty();
  
      var pages = this._totalPages();
  
      this.$el.html(searchTemplate());
  
      if (pages > 1) {
        this.$el.append(paginationTemplate({
          currentPage: this.model.get('page'),
          pages: pages
        }));
      }
  
      this._scrollToPage();
  
      return this;
    },
  
    _totalPages: function () {
      return Math.ceil(this.dataviewModel.getSearchCount() / this.options.itemsPerPage);
    },
  
    toggle: function () {
      this[ !this.widgetModel.isSearchEnabled() ? 'hide' : 'show' ]();
    },
  
    _onSearchClicked: function () {
      this.widgetModel.cleanSearch();
      this.widgetModel.toggleSearch();
    }
  });
  