mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 20:36:07 +01:00 
			
		
		
		
	finish create issue with labels
This commit is contained in:
		@@ -134,24 +134,65 @@ $(document).ready(function () {
 | 
			
		||||
    $('.poping.up').popup();
 | 
			
		||||
 | 
			
		||||
    // Comment form
 | 
			
		||||
    $('.comment.form .tabular.menu .item').tab();
 | 
			
		||||
    $('.comment.form .tabular.menu .item[data-tab="preview"]').click(function () {
 | 
			
		||||
        var $this = $(this);
 | 
			
		||||
        console.log($('.comment.form .tab.segment[data-tab="write"] textarea').val())
 | 
			
		||||
        console.log($('.comment.form .tab.segment[data-tab="preview"]').html())
 | 
			
		||||
        $.post($this.data('url'), {
 | 
			
		||||
                "_csrf": csrf,
 | 
			
		||||
                "mode": "gfm",
 | 
			
		||||
                "context": $this.data('context'),
 | 
			
		||||
                "text": $('.comment.form .tab.segment[data-tab="write"] textarea').val()
 | 
			
		||||
            },
 | 
			
		||||
            function (data) {
 | 
			
		||||
                console.log(data)
 | 
			
		||||
                $('.comment.form .tab.segment[data-tab="preview"]').html(data);
 | 
			
		||||
    if ($('.comment.form').length > 0) {
 | 
			
		||||
        var $form = $(this);
 | 
			
		||||
        $form.find('.tabular.menu .item').tab();
 | 
			
		||||
        $form.find('.tabular.menu .item[data-tab="preview"]').click(function () {
 | 
			
		||||
            var $this = $(this);
 | 
			
		||||
            $.post($this.data('url'), {
 | 
			
		||||
                    "_csrf": csrf,
 | 
			
		||||
                    "mode": "gfm",
 | 
			
		||||
                    "context": $this.data('context'),
 | 
			
		||||
                    "text": $form.find('.tab.segment[data-tab="write"] textarea').val()
 | 
			
		||||
                },
 | 
			
		||||
                function (data) {
 | 
			
		||||
                    $form.find('.tab.segment[data-tab="preview"]').html(data);
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Labels
 | 
			
		||||
        var $list = $('.ui.labels.list');
 | 
			
		||||
        var $no_select = $list.find('.no-select');
 | 
			
		||||
        $('.select-label .item:not(.no-select)').click(function () {
 | 
			
		||||
            if ($(this).hasClass('checked')) {
 | 
			
		||||
                $(this).removeClass('checked')
 | 
			
		||||
                $(this).find('.octicon').removeClass('octicon-check')
 | 
			
		||||
            } else {
 | 
			
		||||
                $(this).addClass('checked')
 | 
			
		||||
                $(this).find('.octicon').addClass('octicon-check')
 | 
			
		||||
            }
 | 
			
		||||
        )
 | 
			
		||||
        ;
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
            var label_ids = "";
 | 
			
		||||
            $(this).parent().find('.item').each(function () {
 | 
			
		||||
                if ($(this).hasClass('checked')) {
 | 
			
		||||
                    label_ids += $(this).data('id') + ",";
 | 
			
		||||
                    $($(this).data('id-selector')).removeClass('hide');
 | 
			
		||||
                } else {
 | 
			
		||||
                    $($(this).data('id-selector')).addClass('hide');
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            if (label_ids.length == 0) {
 | 
			
		||||
                $no_select.removeClass('hide');
 | 
			
		||||
            } else {
 | 
			
		||||
                $no_select.addClass('hide');
 | 
			
		||||
            }
 | 
			
		||||
            $($(this).parent().data('id')).val(label_ids);
 | 
			
		||||
            return false;
 | 
			
		||||
        });
 | 
			
		||||
        $('.select-label .no-select.item').click(function () {
 | 
			
		||||
            $(this).parent().find('.item').each(function () {
 | 
			
		||||
                $(this).removeClass('checked');
 | 
			
		||||
                $(this).find('.octicon').removeClass('octicon-check');
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $list.find('.item').each(function () {
 | 
			
		||||
                $(this).addClass('hide');
 | 
			
		||||
            });
 | 
			
		||||
            $no_select.removeClass('hide');
 | 
			
		||||
            $($(this).parent().data('id')).val('');
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Helpers.
 | 
			
		||||
    $('.delete-button').click(function () {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user