<commit_before>/**
 * (c) 2016 <NAME>
 * Licensed under the MIT license.
 */
'use strict';

/**
 * @ngdoc directive
 * @name dashboard.selectionList:selectionListDirective
 * @description
 * # selectionListDirective
 */
angular.module('dashboard')
    .directive('dbSelectionList', [function () {

        var controller = ['$log', '$scope', 'AttachmentData', 'CONST', '$rootScope', function ($log, $scope, AttachmentData, CONST, $rootScope) {
            $log.log("dbSelectionList: CONTROLLER");
            var self = this;
            self.data = null;
            self.isMobile = $rootScope.isMobile;

            self.selected = function (item) {
                $log.log("dbSelectionList: selected: " + JSON.stringify(item));
                $scope.onSelect({ data: item });
            };

            self.newTab = function (link) {
                if (angular.isString(link) && link.length) {
                    window.open(link, '_blank');
                }
                else {
                    $log.error("dbSelectionList: newTab: invalid link");
                }
            };

            self.isLinkDisabled = function (att) {
                var res = false;
                if (att instanceof AttachmentData) {
                    res = !angular.isString(att.link) || !att.link.length;
                } else {
                    $log.error("dbSelectionList: isLinkDisabled: unsupported arg type: " + JSON.stringify(att));
                }
                return res;
            };<commit_msg>selectionList to use a utils function for opening a file in new winddow<commit_after>/**
 * (c) 2016 <NAME>
 * Licensed under the MIT license.
 */
'use strict';

/**
 * @ngdoc directive
 * @name dashboard.selectionList:selectionListDirective
 * @description
 * # selectionListDirective
 */
angular.module('dashboard')
    .directive('dbSelectionList', [function () {

        var controller = ['$log', '$scope', 'AttachmentData', 'CONST', '$rootScope', 'Utils', function ($log, $scope, AttachmentData, CONST, $rootScope, Utils) {
            $log.log("dbSelectionList: CONTROLLER");
            var self = this;
            self.data = null;
            self.isMobile = $rootScope.isMobile;

            self.selected = function (item) {
                $log.log("dbSelectionList: selected: " + JSON.stringify(item));
                $scope.onSelect({ data: item });
            };

            self.newTab = function (link) {
                Utils.openNewWin(link);
            };

            self.isLinkDisabled = function (att) {
                var res = false;
                if (att instanceof AttachmentData) {
                    res = !angular.isString(att.link) || !att.link.length;
                } else {
                    $log.error("dbSelectionList: isLinkDisabled: unsupported arg type: " + JSON.stringify(att));
                }
                return res;
            };
{'fraction_non_alphanumeric': 0.13040494166094715, 'fraction_numerical': 0.002745367192862045, 'mean_word_length': 1.8466796875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7146720', 'n_tokens_mistral': 805, 'n_tokens_neox': 759, 'n_words': 177}