<commit_before>Checklist.TaxonConceptCommonNameView = Ember.CollectionView.extend({
  content: null,
  tagName: 'ul',

  itemViewClass: Ember.View.extend({
    classNames: ['common-name'],
    contextBinding: 'content',

    template: Ember.Handlebars.compile("{{this}}")
  })
});

Checklist.TaxonConceptListView = Ember.CollectionView.extend({
  content: null,
  filtersController: null,

  itemViewClass: Ember.View.extend({
    tagName: 'div',
    contextBinding: 'content',
    templateName: 'taxon_concept_view',

    //TODO could the filters controller be passed here and used instead of router call
    filtersController: function(){
      return Checklist.get('router').get('filtersController');
    }.property(),

    classNames: ['listing-item'],
    classNameBindings: ['rank'],
    rank: function(){
      // Hide this item if we're using alphabetical view and this item
      // is a taxa bar
      if (this.get('isHigherTaxa') && !this.get('showHigherTaxaBar')) {
        return "hidden";
      }

      var classes = [];

      if (this.get('isHigherTaxa') && this.get('showHigherTaxaBar')) {
        classes.push("persist-area");
        classes.push("persist-header");
        classes.push("main-heading");
      } else {
        classes.push("block");
      }

      classes.push((this.content.get('rank_name') + '-taxon').toLowerCase());

      return classes.join(" ");
    }.property(),

    headingStyle: function() {
      var style = "";

      if (this.content.get('cites_accepted')) {
        style += "font-weight:normal;";
      }

      switch(this.content.get('rank_name')) {
        case "FAMILY":
        case "ORDER":
          style += "text-transform:uppercase;font-style:normal;";
          break;
      }

      return style;
    }.property(),

    full_name: function() {
      var full_name = this.content.get('full_name');

      switch (this.content.get('rank_name')) {
        case "FAMILY":
        case "GENUS":
          full_name += " <span style='text-transform: lowercase; font-style: normal'>spp.</span>";
          break;
      }

      return full_name;
    }.property('full_name'),

    english: function() {
      return this.content.get('english').split(',');
    }.property('english'),
    spanish: function() {
      return this.content.get('spanish').split(',');
    }.property('spanish'),
    french: function() {
      return this.content.get('french').split(',');
    }.property('french'),

    showEnglish: function(){
      return this.get('filtersController').showEnglish &&
        this.content.get('english').length > 0;
    }.property(),
    showSpanish: function(){
      return this.get('filtersController').showSpanish &&
        this.content.get('spanish').length > 0;
    }.property(),
    showFrench: function(){
      return this.get('filtersController').showFrench &&
        this.content.get('french').length > 0;
    }.property(),
    showSynonyms: function(){
      return this.get('filtersController').showSynonyms &&
        this.content.get('synonyms').length > 0;
    }.property(),
    showAuthor: function(){
      return this.get('filtersController').showAuthor &&
        this.content.get('author_year') !== null && this.content.get('author_year').length > 0;
    }.property(),
    showListing: function(){return this.content.get('rank_name') != 'KINGDOM' &&
      this.content.get('rank_name') != 'PHYLUM' &&
      this.content.get('rank_name') != 'CLASS';
    }.property(),

    isHigherTaxa: function(){
      return this.content.get('itemType') == 'HigherTaxa';
    }.property(),
    showHigherTaxaBar: function(){
      return this.get('filtersController').taxonomicLayout &&
        this.get('isHigherTaxa');

    }.property(),

    isTaxonomicLayout: function() {
      return this.get('filtersController').taxonomicLayout;
    }.property(),

    click: function(event) {
      // Ignore clicks on the history graph
      if ($(event.target).parents('.slide').length > 0) return;
      // Ignore clicks on circle icons
      if ($(event.target).hasClass('circle')) return;

      if (!this.get('context.isLoaded')) return;

      var $timeline = this.$().find('#timeline');<commit_msg>added check for null values where data is optional<commit_after>Checklist.TaxonConceptCommonNameView = Ember.CollectionView.extend({
  content: null,
  tagName: 'ul',

  itemViewClass: Ember.View.extend({
    classNames: ['common-name'],
    contextBinding: 'content',

    template: Ember.Handlebars.compile("{{this}}")
  })
});

Checklist.TaxonConceptListView = Ember.CollectionView.extend({
  content: null,
  filtersController: null,

  itemViewClass: Ember.View.extend({
    tagName: 'div',
    contextBinding: 'content',
    templateName: 'taxon_concept_view',

    //TODO could the filters controller be passed here and used instead of router call
    filtersController: function(){
      return Checklist.get('router').get('filtersController');
    }.property(),

    classNames: ['listing-item'],
    classNameBindings: ['rank'],
    rank: function(){
      // Hide this item if we're using alphabetical view and this item
      // is a taxa bar
      if (this.get('isHigherTaxa') && !this.get('showHigherTaxaBar')) {
        return "hidden";
      }

      var classes = [];

      if (this.get('isHigherTaxa') && this.get('showHigherTaxaBar')) {
        classes.push("persist-area");
        classes.push("persist-header");
        classes.push("main-heading");
      } else {
        classes.push("block");
      }

      classes.push((this.content.get('rank_name') + '-taxon').toLowerCase());

      return classes.join(" ");
    }.property(),

    headingStyle: function() {
      var style = "";

      if (this.content.get('cites_accepted')) {
        style += "font-weight:normal;";
      }

      switch(this.content.get('rank_name')) {
        case "FAMILY":
        case "ORDER":
          style += "text-transform:uppercase;font-style:normal;";
          break;
      }

      return style;
    }.property(),

    full_name: function() {
      var full_name = this.content.get('full_name');

      switch (this.content.get('rank_name')) {
        case "FAMILY":
        case "GENUS":
          full_name += " <span style='text-transform: lowercase; font-style: normal'>spp.</span>";
          break;
      }

      return full_name;
    }.property('full_name'),

    english: function() {
      return this.content.get('english').split(',');
    }.property('english'),
    spanish: function() {
      return this.content.get('spanish').split(',');
    }.property('spanish'),
    french: function() {
      return this.content.get('french').split(',');
    }.property('french'),

    showEnglish: function(){
      return this.get('filtersController').showEnglish &&
        this.content.get('english') !== null &&
        this.content.get('english').length > 0;
    }.property(),
    showSpanish: function(){
      return this.get('filtersController').showSpanish &&
        this.content.get('spanish') !== null &&
        this.content.get('spanish').length > 0;
    }.property(),
    showFrench: function(){
      return this.get('filtersController').showFrench &&
        this.content.get('french') !== null &&
        this.content.get('french').length > 0;
    }.property(),
    showSynonyms: function(){
      return this.get('filtersController').showSynonyms &&
        this.content.get('synonyms') !== null &&
        this.content.get('synonyms').length > 0;
    }.property(),
    showAuthor: function(){
      return this.get('filtersController').showAuthor &&
        this.content.get('author_year') !== null &&
        this.content.get('author_year').length > 0;
    }.property(),
    showListing: function(){return this.content.get('rank_name') != 'KINGDOM' &&
      this.content.get('rank_name') != 'PHYLUM' &&
      this.content.get('rank_name') != 'CLASS';
    }.property(),

    isHigherTaxa: function(){
      return this.content.get('itemType') == 'HigherTaxa';
    }.property(),
    showHigherTaxaBar: function(){
      return this.get('filtersController').taxonomicLayout &&
        this.get('isHigherTaxa');

    }.property(),

    isTaxonomicLayout: function() {
      return this.get('filtersController').taxonomicLayout;
    }.property(),

    click: function(event) {
      // Ignore clicks on the history graph
      if ($(event.target).parents('.slide').length > 0) return;
      // Ignore clicks on circle icons
      if ($(event.target).hasClass('circle')) return;

      if (!this.get('context.isLoaded')) return;

      var $timeline = this.$().find('#timeline');
{'fraction_non_alphanumeric': 0.16975200838281523, 'fraction_numerical': 0.0013971358714634998, 'mean_word_length': 2.989781699953553, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 19, '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': '407491', 'n_tokens_mistral': 2642, 'n_tokens_neox': 2489, 'n_words': 479}