diff options
author | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-05-26 21:21:30 +0800 |
---|---|---|
committer | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-05-26 21:21:30 +0800 |
commit | e0a6e6dd1a6cc534ee37fe149e2d11ac827b65d9 (patch) | |
tree | 797a5b7a46581035d4094cf388a50d1d6d0ca0db /public/js | |
parent | bf5fcfb49c777b649ccbb4c9e385cd247e194552 (diff) | |
download | gitea-e0a6e6dd1a6cc534ee37fe149e2d11ac827b65d9.tar.gz gitea-e0a6e6dd1a6cc534ee37fe149e2d11ac827b65d9.zip |
issue ui update
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/app.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/public/js/app.js b/public/js/app.js index 419b8d82e8..f56718067e 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -647,18 +647,45 @@ function initIssue() { $('#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-color-change-ipt,#label-color-change-ipt2').val(color); $('#label-change-id-ipt').val($this.data("id")); return false; }); } }); + var colorRegex = new RegExp("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"); + $('#label-color-ipt2').on('keyup', function () { + var val = $(this).val(); + if (val.length > 7) { + $(this).val(val.substr(0, 7)); + } + if (colorRegex.test(val)) { + $('.label-color-picker').colorpicker("setValue", val); + } + return true; + }); + $('#label-color-change-ipt2').on('keyup', function () { + var val = $(this).val(); + console.log(val); + if (val.length > 7) { + $(this).val(val.substr(0, 7)); + } + if (colorRegex.test(val)) { + $('.label-change-color-picker').colorpicker("setValue", val); + } + return true; + }); $("#label-list").on('click', '.del', function () { var $p = $(this).parent(); removeLabels.push($p.data('id')); $p.remove(); return false; }); + $('.label-selected').each(function (i, item) { + var $item = $(item); + var color = $item.find('.color').data('color'); + $item.css('background-color', color); + }); $('.issue-bar .labels .dropdown-menu').on('click', 'li', function (e) { var url = $('.issue-bar .labels').data("ajax"); var id = $(this).data('id'); |