From 78add502d71dca43bb59ab9ad91745c64d0bf74d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 15 Aug 2014 23:37:33 +0800 Subject: [PATCH] Finish new organization members and invitation page --- .gopmfile | 2 +- public/ng/css/gogs.css | 8 ++++++-- public/ng/js/gogs.js | 25 +++++++++++++++++++++++++ public/ng/less/gogs/organization.less | 8 ++++++-- templates/org/invite.tmpl | 9 ++++++--- 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/.gopmfile b/.gopmfile index 25006beb7b..80f97bf12c 100644 --- a/.gopmfile +++ b/.gopmfile @@ -20,7 +20,7 @@ github.com/macaron-contrib/cache = github.com/macaron-contrib/captcha = github.com/macaron-contrib/csrf = github.com/macaron-contrib/i18n = -github.com/macaron-contrib/session = +github.com/macaron-contrib/session = github.com/macaron-contrib/toolbox = github.com/nfnt/resize = diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css index e7a3a66f26..6b400df28c 100644 --- a/public/ng/css/gogs.css +++ b/public/ng/css/gogs.css @@ -1823,8 +1823,12 @@ textarea#issue-add-content { .invite-box { padding: 50px 0; min-height: 130px; - text-align: center; + margin: 0 auto; + width: 50%; } .invite-box input { - width: 250px; + width: 300px; +} +#org-member-list-block { + padding-top: 2px; } diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index ad8df99716..5e6a6a6b91 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -329,6 +329,28 @@ function initOrgSetting() { }); } +function initInvite() { + // Invitation. + var $ul = $('#org-member-invite-list'); + $('#org-member-invite').on('keyup', function () { + var $this = $(this); + if (!$this.val()) { + $ul.toggleHide(); + return; + } + Gogs.searchUsers($this.val(), $ul); + }).on('focus', function () { + if (!$(this).val()) { + $ul.toggleHide(); + } else { + $ul.toggleShow(); + } + }).next().next().find('ul').on("click", 'li', function () { + $('#org-member-invite').val($(this).text()); + $ul.toggleHide(); + }); +} + $(document).ready(function () { initCore(); if ($('#user-profile-setting').length) { @@ -343,6 +365,9 @@ $(document).ready(function () { if ($('#org-setting').length) { initOrgSetting(); } + if ($('#invite-box').length) { + initInvite(); + } Tabs('#dashboard-sidebar-menu'); diff --git a/public/ng/less/gogs/organization.less b/public/ng/less/gogs/organization.less index cbdec3132e..3805829532 100644 --- a/public/ng/less/gogs/organization.less +++ b/public/ng/less/gogs/organization.less @@ -150,8 +150,12 @@ .invite-box { padding: 50px 0; min-height: 130px; - text-align: center; + margin: 0 auto; + width: 50%; input { - width: 250px; + width: 300px; } +} +#org-member-list-block { + padding-top: 2px; } \ No newline at end of file diff --git a/templates/org/invite.tmpl b/templates/org/invite.tmpl index 400622fdd8..b9901aeb48 100644 --- a/templates/org/invite.tmpl +++ b/templates/org/invite.tmpl @@ -2,13 +2,16 @@ {{template "ng/base/header" .}} {{template "org/header" .}}
-
+
{{template "ng/base/alert" .}}

{{.i18n.Tr "org.members.invite_desc" .Org.FullName}}

-
+ {{.CsrfTokenHtml}} - + +
+ +