<commit_before>/**
* Manage pages in the dashboard tables list
*
* Calculate the pages of the dashboard tables list
* and show them
*
* Usage example:
*
var paginator = new cdb.admin.dashboard.DashboardPaginator({
  el: $("body"),
  items: model.items
});

* It needs a tables model to run correctly.
*/

cdb.admin.DashboardPaginator = cdb.core.View.extend({

  el: "ul",

  events: {
    'click .page':     'pageChange',
    'click .view_all': 'viewAll'
  },

  initialize: function() {
    _.bindAll(this, "_updatePaginator", "pageChange", "viewAll");

    this.model = new cdb.core.Model();
    this.items = this.options.items;

    this.add_related_model(this.items);

    // Bindings
    this.items.bind('reset add remove', this._updatePaginator, this);
    this.model.bind('change:visible', this._toggleVisibility, this);

  },

  render: function() {

    this.$el.html("");
    this.$el.append("<ul></ul");
    this.$ul = this.$el.find("ul");

    var attrs          = this.items.options.attributes;
    this.current_page  = parseInt(this.items.options.get("page"), 10)
    this.per_page      = this.items.options.get("per_page")
    this.total_entries = this.items.options.get("total_entries")
    this.total_pages   = this.items.getTotalPages();

    if (this.per_page < this.items._ITEMS_PER_PAGE) {

      this.$ul.append('<li><a href="" class="view_all">View all ' + this.options.what + '</a></li>')

    } else {

      if (this.current_page - 1 > 0) this.$ul.append('<li><a href="' + (this.current_page - 1)+ '" class="prev button grey page"><i></i></a></li>');
      else this.$ul.append('<li><a href="#" class="prev button grey page disabled"><i></i></a></li>')

      for (var i = 0, length = this.total_pages; i < length; i++) {
        var page = i + 1
        , $a = $("<a>").text(page)<commit_msg>Removes the border-bottom when the view_all link is active<commit_after>/**
* Manage pages in the dashboard tables list
*
* Calculate the pages of the dashboard tables list
* and show them
*
* Usage example:
*
var paginator = new cdb.admin.dashboard.DashboardPaginator({
  el: $("body"),
  items: model.items
});

* It needs a tables model to run correctly.
*/

cdb.admin.DashboardPaginator = cdb.core.View.extend({

  el: "ul",

  events: {
    'click .page':     'pageChange',
    'click .view_all': 'viewAll'
  },

  initialize: function() {
    _.bindAll(this, "_updatePaginator", "pageChange", "viewAll");

    this.model = new cdb.core.Model();
    this.items = this.options.items;

    this.add_related_model(this.items);

    // Bindings
    this.items.bind('reset add remove', this._updatePaginator, this);
    this.model.bind('change:visible', this._toggleVisibility, this);

  },

  render: function() {

    this.$el.html("");
    this.$el.append("<ul></ul");
    this.$ul = this.$el.find("ul");

    var attrs          = this.items.options.attributes;
    this.current_page  = parseInt(this.items.options.get("page"), 10)
    this.per_page      = this.items.options.get("per_page")
    this.total_entries = this.items.options.get("total_entries")
    this.total_pages   = this.items.getTotalPages();

    if (this.per_page < this.items._ITEMS_PER_PAGE) {

      this.$el.addClass("view_all");
      this.$ul.append('<li><a href="" class="view_all">View all ' + this.options.what + '</a></li>')

    } else {

      this.$el.removeClass("view_all");

      if (this.current_page - 1 > 0) this.$ul.append('<li><a href="' + (this.current_page - 1)+ '" class="prev button grey page"><i></i></a></li>');
      else this.$ul.append('<li><a href="#" class="prev button grey page disabled"><i></i></a></li>')

      for (var i = 0, length = this.total_pages; i < length; i++) {
        var page = i + 1
        , $a = $("<a>").text(page)
{'fraction_non_alphanumeric': 0.1837277319861739, 'fraction_numerical': 0.003722414251528849, 'mean_word_length': 3.241262683201804, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1919910', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1257, 'n_words': 273}