From e0a6e6dd1a6cc534ee37fe149e2d11ac827b65d9 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 26 May 2014 21:21:30 +0800 Subject: [PATCH] issue ui update --- public/css/gogs.css | 24 +++++++++++++++++++++++- public/js/app.js | 29 ++++++++++++++++++++++++++++- templates/issue/list.tmpl | 24 ++++++++++++++++++++---- 3 files changed, 71 insertions(+), 6 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 96cf90b4d8..79fd4bf908 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1244,7 +1244,7 @@ html, body { margin-bottom: 0; } -#issue-create-form .nav-tabs, #issue .issue-reply .nav-tabs,#issue .issue-edit-content .nav-tabs { +#issue-create-form .nav-tabs, #issue .issue-reply .nav-tabs, #issue .issue-edit-content .nav-tabs { margin-bottom: 10px; } @@ -1355,6 +1355,10 @@ html, body { color: #444; } +#issue .issue-item h5 .labels .label { + margin-left: 12px; +} + #issue .issue-item .info span { margin-right: 12px; color: #888; @@ -1589,6 +1593,14 @@ html, body { text-shadow: 0 0 2px #444; } +#issue .label-selected .count, #issue .label-selected a { + color: #FAFAFA; +} + +#issue .label-selected a { + text-shadow: 0 0 2px #444; +} + #issue .issue-bar .labels .label-white { color: #FFF; } @@ -1625,6 +1637,16 @@ html, body { margin-left: 26px; } +#label-color-ipt2, #label-color-change-ipt2 { + width: 120px; + display: inline-block; + vertical-align: top; +} + +#label-color-change-ipt2{ + margin-top: 1px; +} + /* wrapper and footer */ #wrapper { 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'); diff --git a/templates/issue/list.tmpl b/templates/issue/list.tmpl index ba8055309d..aac27943f3 100644 --- a/templates/issue/list.tmpl +++ b/templates/issue/list.tmpl @@ -17,11 +17,11 @@

Label