mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 10:44:12 +01:00 
			
		
		
		
	fix issue label ajax
This commit is contained in:
		
							parent
							
								
									5e9a45f74a
								
							
						
					
					
						commit
						50ba08e2c6
					
				@ -620,6 +620,7 @@ function initIssue() {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // labels
 | 
					    // labels
 | 
				
			||||||
 | 
					    var removeLabels = [];
 | 
				
			||||||
    $('#label-manage-btn').on("click", function () {
 | 
					    $('#label-manage-btn').on("click", function () {
 | 
				
			||||||
        var $list = $('#label-list');
 | 
					        var $list = $('#label-list');
 | 
				
			||||||
        if ($list.hasClass("managing")) {
 | 
					        if ($list.hasClass("managing")) {
 | 
				
			||||||
@ -630,7 +631,7 @@ function initIssue() {
 | 
				
			|||||||
                    ids.push(id);
 | 
					                    ids.push(id);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            $.post($list.data("ajax"), {"ids": ids.join(",")}, function (json) {
 | 
					            $.post($list.data("ajax"), {"ids": ids.join(","), "remove": removeLabels.join(",")}, function (json) {
 | 
				
			||||||
                if (json.ok) {
 | 
					                if (json.ok) {
 | 
				
			||||||
                    window.location.reload();
 | 
					                    window.location.reload();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -653,14 +654,16 @@ function initIssue() {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    $("#label-list").on('click', '.del', function () {
 | 
					    $("#label-list").on('click', '.del', function () {
 | 
				
			||||||
        $(this).parent().remove();
 | 
					        var $p = $(this).parent();
 | 
				
			||||||
 | 
					        removeLabels.push($p.data('id'));
 | 
				
			||||||
 | 
					        $p.remove();
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    $('.issue-bar .labels .dropdown-menu').on('click', 'li', function (e) {
 | 
					    $('.issue-bar .labels .dropdown-menu').on('click', 'li', function (e) {
 | 
				
			||||||
        var url = $('.issue-bar .labels').data("ajax");
 | 
					        var url = $('.issue-bar .labels').data("ajax");
 | 
				
			||||||
        var id = $(this).data('id');
 | 
					        var id = $(this).data('id');
 | 
				
			||||||
        var check = $(this).hasClass("checked");
 | 
					        var check = $(this).hasClass("checked");
 | 
				
			||||||
        $.post(url, {id: id, action: check ? 'detach' : "attach"}, function (json) {
 | 
					        $.post(url, {id: id, action: check ? 'detach' : "attach", issue: $('#issue').data('id')}, function (json) {
 | 
				
			||||||
            if (json.ok) {
 | 
					            if (json.ok) {
 | 
				
			||||||
                window.location.reload();
 | 
					                window.location.reload();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user