<commit_before>
/**
 * VIEW: Pager
 * 
 */

var 
    template = require('./templates/pager.tpl');

module.exports = Backbone.Marionette.ItemView.extend({

  //--------------------------------------
  //+ PUBLIC PROPERTIES / CONSTANTS
  //--------------------------------------

  template: template,
  tagName: 'ul',
  ui:{
    input: 'input'
  },
  events:{
    'keypress input[name=go-to-page]': 'changePage',
    'click .next a': 'nextPage',
    'click .prev a': 'prevPage'
  },
  modelEvents: {
    'change:currentPage': 'render'
  },
  templateHelpers: function(){
    return {
      firstPage: this.model.get('currentPage') === 1,
      lastPage: this.model.get('currentPage') === this.model.get('pages')
    };
  },

  //--------------------------------------
  //+ INHERITED / OVERRIDES
  //--------------------------------------

  //--------------------------------------
  //+ PUBLIC METHODS / GETTERS / SETTERS
  //--------------------------------------

  nextPage: function(){
    this.model.moveToPage(this.model.get('currentPage') + 1);
  },

  prevPage: function(){
    this.model.moveToPage(this.model.get('currentPage') - 1);
  },

  changePage: function(event){
    var num = this.ui.input.val();
    if(event.which === 13 || event.charCode === 13){
      if(!isNaN(num)){
        this.model.moveToPage(num);
      }
    }
  }
  //--------------------------------------
  //+ EVENT HANDLERS
  //--------------------------------------

  //--------------------------------------<commit_msg>[aeolus] Fix pager issue<commit_after>
/**
 * VIEW: Pager
 * 
 */

var 
    template = require('./templates/pager.tpl');

module.exports = Backbone.Marionette.ItemView.extend({

  //--------------------------------------
  //+ PUBLIC PROPERTIES / CONSTANTS
  //--------------------------------------

  template: template,
  tagName: 'ul',
  ui:{
    input: 'input'
  },
  events:{
    'keypress input[name=go-to-page]': 'changePage',
    'click .next a': 'nextPage',
    'click .prev a': 'prevPage'
  },
  modelEvents: {
    'change:currentPage': 'render'
  },
  templateHelpers: function(){
    return {
      firstPage: this.model.get('currentPage') === 1,
      lastPage: this.model.get('currentPage') === this.model.get('pages')
    };
  },

  //--------------------------------------
  //+ INHERITED / OVERRIDES
  //--------------------------------------

  //--------------------------------------
  //+ PUBLIC METHODS / GETTERS / SETTERS
  //--------------------------------------

  nextPage: function(event){
    this.model.moveToPage(this.model.get('currentPage') + 1);
    event.preventDefault();
  },

  prevPage: function(event){
    this.model.moveToPage(this.model.get('currentPage') - 1);
    event.preventDefault();
  },

  changePage: function(event){
    var num = this.ui.input.val();
    if(event.which === 13 || event.charCode === 13){
      if(!isNaN(num)){
        this.model.moveToPage(num);
      }
    }
  }
  //--------------------------------------
  //+ EVENT HANDLERS
  //--------------------------------------

  //--------------------------------------
{'fraction_non_alphanumeric': 0.3683360258481422, 'fraction_numerical': 0.004523424878836834, 'mean_word_length': 1.263157894736842, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '953259', 'n_tokens_mistral': 933, 'n_tokens_neox': 883, 'n_words': 143}