diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-26 18:11:15 +0800 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-26 18:11:15 +0800 |
commit | 74b31566cf5caaf6bf73584e621d56ca99c048d1 (patch) | |
tree | 078a8428e5241d13600482301444684720a77283 /public | |
parent | f2c263c54facdcbc9375a47535c0389fd7d05875 (diff) | |
download | gitea-74b31566cf5caaf6bf73584e621d56ca99c048d1.tar.gz gitea-74b31566cf5caaf6bf73584e621d56ca99c048d1.zip |
Finsih add/remove repo in organization
Diffstat (limited to 'public')
-rw-r--r-- | public/ng/css/gogs.css | 22 | ||||
-rw-r--r-- | public/ng/js/gogs.js | 46 | ||||
-rw-r--r-- | public/ng/less/gogs/organization.less | 27 | ||||
-rw-r--r-- | public/ng/less/gogs/repository.less | 1 |
4 files changed, 87 insertions, 9 deletions
diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css index 48468c7e80..5ea7cf8f2d 100644 --- a/public/ng/css/gogs.css +++ b/public/ng/css/gogs.css @@ -1298,32 +1298,38 @@ The register and sign-in page style .repo-setting-zone { padding: 30px; } +#team-repositories-list, #team-members-list, #repo-collab-list { list-style: none; padding: 10px 0 5px 0; } +#team-repositories-list li.collab, #team-members-list li.collab, #repo-collab-list li.collab { clear: both; height: 50px; padding: 0 15px 0 15px; } +#team-repositories-list a.member, #team-members-list a.member, #repo-collab-list a.member { color: #444; height: 50px; line-height: 50px; } +#team-repositories-list a.member:hover, #team-members-list a.member:hover, #repo-collab-list a.member:hover { color: #4183C4; } +#team-repositories-list .avatar, #team-members-list .avatar, #repo-collab-list .avatar { margin-right: 1em; width: 40px; } +#team-repositories-list .remove-collab, #team-members-list .remove-collab, #repo-collab-list .remove-collab { color: #DD4B39; @@ -1877,14 +1883,26 @@ textarea#issue-add-content { #org-team-card .panel-footer { padding: 10px 20px; } +#team-repositories-list .panel-body .search, #team-members-list .panel-body .search { padding: 4px 0 10px 10px; border-bottom: 1px solid #dddddd; } +#team-repositories-list li.collab, #team-members-list li.collab { padding-top: 10px !important; border-bottom: 1px solid #dddddd; } -#team-members-list li.collab:last-child { - border-bottom: 0; +#team-repositories-list li:last-child, +#team-members-list li:last-child { + border-bottom: 0 !important; +} +#team-repositories-list li a .octicon { + color: #888; +} +#team-repositories-list li .member { + color: #428bca; + font-size: 14px; + height: 40px; + line-height: 40px; } diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index 52000f3664..d4c3224eee 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -218,6 +218,26 @@ var Gogs = {}; } }); } + + // Search repositories by keyword. + Gogs.searchRepos = function (val, $target, $param) { + $.ajax({ + url: '/api/v1/repos/search?q=' + val + '&' + $param, + dataType: "json", + success: function (json) { + if (json.ok && json.data.length) { + var html = ''; + $.each(json.data, function (i, item) { + html += '<li><a><span class="octicon octicon-repo"></span> ' + item.repolink + '</a></li>'; + }); + $target.html(html); + $target.toggleShow(); + } else { + $target.toggleHide(); + } + } + }); + } })(jQuery); function initCore() { @@ -358,7 +378,7 @@ function initOrgTeamCreate() { e.preventDefault(); return true; } - var $form = $('#team-create-form') + var $form = $('#team-create-form'); $form.attr('action', $form.data('delete-url')); }); } @@ -383,7 +403,28 @@ function initTeamMembersList() { $('#org-team-members-add').val($(this).text()); $ul.toggleHide(); }); +} +function initTeamRepositoriesList() { + // Add team repository. + var $ul = $('#org-team-repositories-list'); + $('#org-team-repositories-add').on('keyup', function () { + var $this = $(this); + if (!$this.val()) { + $ul.toggleHide(); + return; + } + Gogs.searchRepos($this.val(), $ul, 'uid=' + $this.data('uid')); + }).on('focus', function () { + if (!$(this).val()) { + $ul.toggleHide(); + } else { + $ul.toggleShow(); + } + }).next().next().find('ul').on("click", 'li', function () { + $('#org-team-repositories-add').val($(this).text()); + $ul.toggleHide(); + }); } $(document).ready(function () { @@ -409,6 +450,9 @@ $(document).ready(function () { if ($('#team-members-list').length) { initTeamMembersList(); } + if ($('#team-repositories-list').length) { + initTeamRepositoriesList(); + } Tabs('#dashboard-sidebar-menu'); diff --git a/public/ng/less/gogs/organization.less b/public/ng/less/gogs/organization.less index a62dcbb3e0..b6e31940a5 100644 --- a/public/ng/less/gogs/organization.less +++ b/public/ng/less/gogs/organization.less @@ -1,3 +1,4 @@ +@import "../ui/var"; .org-header-alert .alert { margin-top: 10px; } @@ -197,18 +198,32 @@ padding: 10px 20px; } } +#team-repositories-list, #team-members-list { .panel-body .search { padding: 4px 0 10px 10px; border-bottom: 1px solid #dddddd; } -} -#team-members-list { - li.collab { - padding-top: 10px !important; - border-bottom: 1px solid #dddddd; + li { + &.collab { + padding-top: 10px !important; + border-bottom: 1px solid #dddddd; + } &:last-child { - border-bottom: 0; + border-bottom: 0 !important; + } + } +} +#team-repositories-list { + li { + a .octicon { + color: #888; + } + .member { + color: @linkColor; + font-size: 14px; + height: 40px; + line-height: 40px; } } }
\ No newline at end of file diff --git a/public/ng/less/gogs/repository.less b/public/ng/less/gogs/repository.less index 2f97289852..4a49ac4368 100644 --- a/public/ng/less/gogs/repository.less +++ b/public/ng/less/gogs/repository.less @@ -426,6 +426,7 @@ border-top-right-radius: .25em; .repo-setting-zone { padding: 30px; } +#team-repositories-list, #team-members-list, #repo-collab-list { list-style: none; |