<commit_before><?php
    /**
     * Tag control helper
     * @package M2 Micro Framework
     * @subpackage Library Tags
     * @author <NAME>
     * @since 0.3RC2
     */
    class Tag extends Control {

        /**
         * Return HTML markup for control
         * @return string $html
         */
        public function render() {
            // Check parent errors
            $html = parent::render();
            if (!empty($html)) {
                $this->_data = Model::getModel('tag')->getTagsByIds($this->getValue('id'));
                ob_start();
                ?>
                    <div class="tag-control">
                        <script type="text/javascript">
                            $(document).ready(function() {
                                var tag_id      = '<?php echo $this->_options['id']; ?>';
                                var tag_class   = '<?php echo $this->_options['class']; ?>';
                                var tag_name    = '<?php echo $this->_options['name']; ?>';

                                // Delete action for tag
                                $('.' + tag_class + '-del').live('click', function() {
                                    // Get params
                                    var rel = $(this).attr('rel');
                                    var val = $('li#' + rel).attr('rel');
                                    var tags = $('#' + tag_id).val().split(',');

                                    // Remove value from hidden input and control
                                    for (var i = 0; i < tags.length; i++) {
                                        if (tags[i] == val) {
                                            tags.splice(i, 1);
                                            $('#' + tag_id).val(tags.join(','));
                                            $('li#' + rel).remove();
                                            return true;
                                        }
                                    }
                                    return false;
                                });

                                // Add new tag
                                $('#' + tag_id + '-add').click(function() {
                                    // Check tag length
                                    var val = $('#' + tag_id + '-input').val();
                                    if (val.length < 3) {
                                        alert('<?php echo T('Minimum tag length 3 symbols'); ?>');
                                        return false;
                                    }

                                    // Check existing
                                    var tags = $('#' + tag_id).val().split(',');
                                    if (tags.indexOf(val) >= 0) {
                                        alert('<?php echo T('This tag already exists'); ?>');
                                        return false;
                                    }<commit_msg>[#43634517] Clear input field after add new tag<commit_after><?php
    /**
     * Tag control helper
     * @package M2 Micro Framework
     * @subpackage Library Tags
     * @author <NAME>
     * @since 0.3RC2
     */
    class Tag extends Control {

        /**
         * Return HTML markup for control
         * @return string $html
         */
        public function render() {
            // Check parent errors
            $html = parent::render();
            if (!empty($html)) {
                $this->_data = Model::getModel('tag')->getTagsByIds($this->getValue('id'));
                ob_start();
                ?>
                    <div class="tag-control">
                        <script type="text/javascript">
                            $(document).ready(function() {
                                var tag_id      = '<?php echo $this->_options['id']; ?>';
                                var tag_class   = '<?php echo $this->_options['class']; ?>';
                                var tag_name    = '<?php echo $this->_options['name']; ?>';

                                // Delete action for tag
                                $('.' + tag_class + '-del').live('click', function() {
                                    // Get params
                                    var rel = $(this).attr('rel');
                                    var val = $('li#' + rel).attr('rel');
                                    var tags = $('#' + tag_id).val().split(',');

                                    // Remove value from hidden input and control
                                    for (var i = 0; i < tags.length; i++) {
                                        if (tags[i] == val) {
                                            tags.splice(i, 1);
                                            $('#' + tag_id).val(tags.join(','));
                                            $('li#' + rel).remove();
                                            return true;
                                        }
                                    }
                                    return false;
                                });

                                // Add new tag
                                $('#' + tag_id + '-add').click(function() {
                                    // Check tag length
                                    var val = $('#' + tag_id + '-input').val();
                                    if (val.length < 3) {
                                        alert('<?php echo T('Minimum tag length 3 symbols'); ?>');
                                        return false;
                                    }

                                    // Check existing
                                    var tags = $('#' + tag_id).val().split(',');
                                    if (tags.indexOf(val) >= 0) {
                                        alert('<?php echo T('This tag already exists'); ?>');
                                        return false;
                                    }

                                    // #43634517 - Fix autocomplete add action
                                    $('#' + tag_id + '-input').val('');
{'fraction_non_alphanumeric': 0.12374798061389337, 'fraction_numerical': 0.005492730210016155, 'mean_word_length': 0.7083333333333334, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 80, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '499027', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1197, 'n_words': 304}