diff options
author | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-05-19 21:55:25 +0800 |
---|---|---|
committer | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-05-19 21:55:25 +0800 |
commit | 342baf1ddaa9beb6d856c8f9725093cbbe5d80ac (patch) | |
tree | edb13923946c181d9f7aede6daee2965b8e9fe47 /public/js | |
parent | fdc6b64f15cd4467ddf7d4d54db0f1867d9d6a46 (diff) | |
download | gitea-342baf1ddaa9beb6d856c8f9725093cbbe5d80ac.tar.gz gitea-342baf1ddaa9beb6d856c8f9725093cbbe5d80ac.zip |
add label edit and manage ui
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/app.js | 38 |
1 files changed, 38 insertions, 0 deletions
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() { |