<commit_before>'use strict';

/**
 * @ngdoc directive
 * @name generic-result-display
 * @restrict E
 * @scope
 * @description
 *  A UI control for displaying a search result.
 *
 * @param {expression} data - The result data.
 */
angular.module('searchApp')
  .directive('genericResultDisplay', [ '$rootScope', '$location', 'SolrService', 'ImageService', 
    function ($rootScope, $location, SolrService, ImageService) {
    return {
      templateUrl: 'views/generic-result-display.html',
      restrict: 'E',
      scope: {
          'data': '=ngModel',
          'displayProvenance': '@'
      },
      link: function postLink(scope, element, attrs) {
          scope.hideDetails = SolrService.hideDetails;

          $rootScope.$on('hide-search-results-details', function() {
              scope.hideDetails = true;
          });
          $rootScope.$on('show-search-results-details', function() {
              scope.hideDetails = false;
          });

          // determine the source url to use for the record
          if (scope.data.display_url !== undefined) {
              scope.data.resource = scope.data.display_url;
          } else {
              scope.data.reference = scope.data.id;
          }

          // is this a finding aid item with an image set attached?
          if (scope.data.type === 'Finding Aid Item' && scope.data.large_images !== undefined) {
            scope.imageSet = true;
            scope.imageCount = scope.data.small_images.length;
          }

          scope.view = function() {
              // pop the image data into the service
              ImageService.push(scope.data);
          }
      }
    };
  }]);<commit_msg>bugfix<commit_after>'use strict';

/**
 * @ngdoc directive
 * @name generic-result-display
 * @restrict E
 * @scope
 * @description
 *  A UI control for displaying a search result.
 *
 * @param {expression} data - The result data.
 */
angular.module('searchApp')
  .directive('genericResultDisplay', [ '$rootScope', '$location', 'SolrService', 'ImageService', 
    function ($rootScope, $location, SolrService, ImageService) {
    return {
      templateUrl: 'views/generic-result-display.html',
      restrict: 'E',
      scope: {
          'data': '=ngModel',
          'displayProvenance': '@'
      },
      link: function postLink(scope, element, attrs) {
          scope.hideDetails = SolrService.hideDetails;

          $rootScope.$on('hide-search-results-details', function() {
              scope.hideDetails = true;
          });
          $rootScope.$on('show-search-results-details', function() {
              scope.hideDetails = false;
          });

          // determine the source url to use for the record
          if (scope.data.display_url !== undefined) {
              scope.data.reference = scope.data.display_url;
          } else {
              scope.data.reference = scope.data.id;
          }

          // is this a finding aid item with an image set attached?
          if (scope.data.type === 'Finding Aid Item' && scope.data.large_images !== undefined) {
            scope.imageSet = true;
            scope.imageCount = scope.data.small_images.length;
          }

          scope.view = function() {
              // pop the image data into the service
              ImageService.push(scope.data);
          }
      }
    };
  }]);
{'fraction_non_alphanumeric': 0.13053892215568863, 'fraction_numerical': 0.0, 'mean_word_length': 2.0679522497704315, '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': '4256700', 'n_tokens_mistral': 922, 'n_tokens_neox': 907, 'n_words': 216}