<commit_before>/*
 * AngularAgility Select2
 *
 * NOTE! In addition to Angular.js this plugin
 * requires jQuery and Select2 http://ivaynberg.github.io/select2/
 *
 * http://www.johnculviner.com
 *
 * Copyright (c) 2014 - <NAME>
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

angular
    .module('aa.select2', [])
    .directive('aaSelect2', ['$q', function ($q) {

        return {
            require: 'ngModel',
            template: '<input type="text" />',
            replace: true,
            link: function (scope, element, attrs, ngModel) {

                //native select2 options directly from the user. always takes prescedence
                //copy the object before we muck with it incase multiple select2s are sharing settings
                var settings = scope.$eval(attrs.aaSelect2);

                if(!angular.isObject(settings) || isEmptyObject(settings)) {
                    throw 'aa-select2 options must be specified. Ex: <div aa-select2="*options here*"...\r\n';
                }

                //possible select2 options derived from user selections on settings
                var derivedOpts = {},

                //directive settings (aka nice wrapper for select2)
                    inAjaxMode = settings ? angular.isFunction(settings.options) : false,
                    inLocalArrayMode = settings ? angular.isArray(settings.options) : false,
                    inIdMode = settings && settings.mode ? settings.mode.indexOf('id') !== -1 : false,
                    inObjectMode = settings && settings.mode ? settings.mode.indexOf('object') !== -1 : false,
                    inTagsMode = settings && settings.mode ? settings.mode.indexOf('tags') !== -1 : false,
                    inThisMode = settings && settings.id === "@this" && settings.text === "@this";

                //need a placeholder for allow clear to work
                //fix bug?/weird api odditiy
                if(settings.select2 && settings.select2.allowClear) {
                    derivedOpts.placeholder = "Select...";
                }

                if(attrs.placeholder) {
                    derivedOpts.placeholder = attrs.placeholder;
                }
<commit_msg>updated select2 to copy settings for config re-use<commit_after>/*
 * AngularAgility Select2
 *
 * NOTE! In addition to Angular.js this plugin
 * requires jQuery and Select2 http://ivaynberg.github.io/select2/
 *
 * http://www.johnculviner.com
 *
 * Copyright (c) 2014 - <NAME>
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

angular
    .module('aa.select2', [])
    .directive('aaSelect2', ['$q', function ($q) {

        return {
            require: 'ngModel',
            template: '<input type="text" />',
            replace: true,
            link: function (scope, element, attrs, ngModel) {

                //native select2 options directly from the user. always takes prescedence
                //copy the object before we muck with it incase multiple select2s are sharing settings
                var settings = angular.copy(scope.$eval(attrs.aaSelect2));

                if(!angular.isObject(settings) || isEmptyObject(settings)) {
                    throw 'aa-select2 options must be specified. Ex: <div aa-select2="*options here*"...\r\n';
                }

                //possible select2 options derived from user selections on settings
                var derivedOpts = {},

                //directive settings (aka nice wrapper for select2)
                    inAjaxMode = settings ? angular.isFunction(settings.options) : false,
                    inLocalArrayMode = settings ? angular.isArray(settings.options) : false,
                    inIdMode = settings && settings.mode ? settings.mode.indexOf('id') !== -1 : false,
                    inObjectMode = settings && settings.mode ? settings.mode.indexOf('object') !== -1 : false,
                    inTagsMode = settings && settings.mode ? settings.mode.indexOf('tags') !== -1 : false,
                    inThisMode = settings && settings.id === "@this" && settings.text === "@this";

                //need a placeholder for allow clear to work
                //fix bug?/weird api odditiy
                if(settings.select2 && settings.select2.allowClear) {
                    derivedOpts.placeholder = "Select...";
                }

                if(attrs.placeholder) {
                    derivedOpts.placeholder = attrs.placeholder;
                }

{'fraction_non_alphanumeric': 0.11733684904416612, 'fraction_numerical': 0.009448472863107009, 'mean_word_length': 1.8993630573248408, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2801556', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1128, 'n_words': 315}