diff --git a/public/css/gogs.css b/public/css/gogs.css index a8311188d6..bfca9d83ee 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1297,7 +1297,7 @@ html, body { display: block; } -#issue .label-filter a:hover { +#issue .label-filter li.label-item:hover { background-color: #FFF; } @@ -1316,6 +1316,12 @@ html, body { margin-top: 6px; } +#issue .label-filter .del { + margin-top: -24px; + color: #888; + display: none; +} + #issue .label-filter .label-button { margin-top: 16px; } diff --git a/public/js/app.js b/public/js/app.js index d7514f795d..53948578b9 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -612,6 +612,44 @@ function initIssue() { $('#milestone').text($('#milestone').data("no-milestone")); } }); + + // labels + $('#label-manage-btn').on("click", function () { + var $list = $('#label-list'); + if ($list.hasClass("managing")) { + var ids = []; + $list.find('li').each(function (i, item) { + var id = $(item).data("id"); + if (id > 0) { + ids.push(id); + } + }); + $.post($list.data("ajax"), {"ids": ids.join(",")}, function (json) { + if (json.ok) { + window.location.reload(); + } + }) + } else { + $list.addClass("managing"); + $list.find(".count").hide(); + $list.find(".del").show(); + $(this).text("Save Labels"); + $list.on('click', 'li.label-item', function () { + var $this = $(this); + $this.after($('.label-change-li').detach().show()); + $('#label-name-change-ipt').val($this.find('.name').text()); + var color = $this.find('.color').data("color"); + $('.label-change-color-picker').colorpicker("setValue", color); + $('#label-color-change-ipt').val(color); + $('#label-change-id-ipt').val($this.data("id")); + return false; + }); + } + }); + $("#label-list").on('click', '.del', function () { + $(this).parent().remove(); + return false; + }); } function initRelease() { diff --git a/templates/issue/list.tmpl b/templates/issue/list.tmpl index 480e047b85..edf855932d 100644 --- a/templates/issue/list.tmpl +++ b/templates/issue/list.tmpl @@ -15,19 +15,39 @@

Label

-