From 045c21de4fc318abcaa80e5aea1f7d6a8ab8ac00 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Fri, 9 May 2014 20:44:08 +0800 Subject: [PATCH] assignee ui in issue view --- public/css/gogs.css | 14 ++++++++++++++ public/js/app.js | 19 +++++++++++++++++++ templates/issue/view.tmpl | 19 +++++++++++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index f245a56b8..12fd8138e 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1447,6 +1447,15 @@ html, body { min-width: 300px; } +#issue .issue-bar .assignee, #issue .issue-bar .assignee ul { + min-width: 160px; +} + +#issue .issue-bar .assignee .dropdown-menu{ + padding: 0; + margin: 0; +} + #issue .assignee li { padding: 4px 12px; line-height: 30px; @@ -1473,6 +1482,11 @@ html, body { line-height: 30px; } +#issue .issue-bar .assignee .action{ + position: relative; + margin-top: -8px; +} + /* wrapper and footer */ #wrapper { diff --git a/public/js/app.js b/public/js/app.js index d6c13a293..162139986 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -535,8 +535,27 @@ function initIssue() { }()); // assignee + var is_issue_bar = $('.issue-bar').length > 0; + var $a = $('.assignee'); + if($a.data("assigned") > 0){ + $('.clear-assignee').toggleShow(); + } $('.assignee', '#issue').on('click', 'li', function () { var uid = $(this).data("uid"); + if(is_issue_bar){ + var assignee = $a.data("assigned"); + if(uid != assignee){ + $.post($a.data("ajax"), { + issue: $('#issue').data("id"), + assign: assignee + }, function (json) { + if (json.ok) { + window.location.reload(); + } + }) + } + return; + } $('#assignee').val(uid); if (uid > 0) { $('.clear-assignee').toggleShow(); diff --git a/templates/issue/view.tmpl b/templates/issue/view.tmpl index 780b19899..9134a9802 100644 --- a/templates/issue/view.tmpl +++ b/templates/issue/view.tmpl @@ -3,7 +3,7 @@ {{template "repo/nav" .}} {{template "repo/toolbar" .}}
-
+
@@ -100,7 +100,22 @@
-
+
{{if .IsRepositoryOwner}} +
+ + +
{{end}}

Assignee

{{if .Issue.Assignee}}{{.Issue.Assignee.Name}}{{else}}No one assigned{{end}}