This commit is contained in:
Unknwon 2015-11-17 02:18:05 -05:00
parent ab9411be2a
commit ff5f14431e
12 changed files with 194 additions and 53 deletions

View File

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.7.15 Beta ##### Current version: 0.7.16 Beta
<table> <table>
<tr> <tr>

View File

@ -563,6 +563,7 @@ settings.confirm_delete = Confirm Deletion
settings.add_collaborator = Add New Collaborator settings.add_collaborator = Add New Collaborator
settings.add_collaborator_success = New collaborator has been added. settings.add_collaborator_success = New collaborator has been added.
settings.remove_collaborator_success = Collaborator has been removed. settings.remove_collaborator_success = Collaborator has been removed.
settings.search_user_placeholder = Search user...
settings.user_is_org_member = User is organization member who cannot be added as a collaborator. settings.user_is_org_member = User is organization member who cannot be added as a collaborator.
settings.add_webhook = Add Webhook settings.add_webhook = Add Webhook
settings.hooks_desc = Webhooks are much like basic HTTP POST event triggers. Whenever something occurs in Gogs, we will handle the notification to the target host you specify. Learn more in this <a target="_blank" href="%s">Webhooks Guide</a>. settings.hooks_desc = Webhooks are much like basic HTTP POST event triggers. Whenever something occurs in Gogs, we will handle the notification to the target host you specify. Learn more in this <a target="_blank" href="%s">Webhooks Guide</a>.

View File

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.15.1116 Beta" const APP_VER = "0.7.16.1117 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

File diff suppressed because one or more lines are too long

View File

@ -2510,6 +2510,35 @@ footer .container .links > *:first-child {
.repository.forks .list .item .link { .repository.forks .list .item .link {
padding-top: 5px; padding-top: 5px;
} }
.repository.settings.collaboration .collaborator.list {
padding: 0;
}
.repository.settings.collaboration .collaborator.list .item {
padding: 10px 20px;
}
.repository.settings.collaboration .collaborator.list .item:not(:last-child) {
border-bottom: 1px solid #DDD;
}
.repository.settings.collaboration #repo-collab-form #search-user-box .results {
left: 7px;
}
.repository.settings.collaboration #repo-collab-form .ui.button {
margin-left: 5px;
margin-top: -3px;
}
#search-user-box .results {
padding: 0;
position: absolute;
}
#search-user-box .results .item {
padding: 10px 15px;
border-bottom: 1px solid #DDD;
cursor: pointer;
}
#search-user-box .results .item:hover {
background: rgba(0, 0, 0, 0.05) !important;
color: rgba(0, 0, 0, 0.95) !important;
}
.issue.list { .issue.list {
list-style: none; list-style: none;
padding-top: 15px; padding-top: 15px;
@ -2562,7 +2591,7 @@ footer .container .links > *:first-child {
.settings .content { .settings .content {
margin-top: 2px; margin-top: 2px;
} }
.settings .content .header, .settings .content > .header,
.settings .content .segment { .settings .content .segment {
box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15); box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15);
} }
@ -2748,6 +2777,9 @@ footer .container .links > *:first-child {
.user.profile .ui.card .extra.content ul li:not(:last-child) { .user.profile .ui.card .extra.content ul li:not(:last-child) {
border-bottom: 1px solid #eaeaea; border-bottom: 1px solid #eaeaea;
} }
.user.profile .ui.repository.list {
margin-top: 25px;
}
.dashboard { .dashboard {
padding-top: 15px; padding-top: 15px;
padding-bottom: 80px; padding-bottom: 80px;

View File

@ -564,6 +564,64 @@ function buttonsClickOnEnter() {
}); });
} }
function searchUsers() {
if (!$('#search-user-box .results').length) {
return;
}
var $search_user_box = $('#search-user-box');
var $result_list = $search_user_box.find('.results');
$search_user_box.keyup(function () {
var $this = $(this);
var keyword = $this.find('input').val();
if (keyword.length < 2) {
$result_list.hide();
return;
}
$.ajax({
url: suburl + '/api/v1/users/search?q=' + keyword,
dataType: "json",
success: function (response) {
var notEmpty = function (str) {
return str && str.length > 0;
};
$result_list.html('');
if (response.ok && response.data.length) {
var html = '';
$.each(response.data, function (i, item) {
html += '<div class="item"><img class="ui avatar image" src="' + item.avatar_url + '"><span class="username">' + item.username + '</span>';
if (notEmpty(item.full_name)) {
html += ' (' + item.full_name + ')';
}
html += '</div>';
});
$result_list.html(html);
$this.find('.results .item').click(function () {
$this.find('input').val($(this).find('.username').text());
$result_list.hide();
});
$result_list.show();
} else {
$result_list.hide();
}
}
});
});
$search_user_box.find('input').focus(function () {
$search_user_box.keyup();
});
$(document).click(function (e) {
var target = e.target;
if (!$(target).is('#search-user-box .results') && !$(target).parents().is('#search-user-box')) {
$('#search-user-box .results').hide();
}
});
}
$(document).ready(function () { $(document).ready(function () {
csrf = $('meta[name=_csrf]').attr("content"); csrf = $('meta[name=_csrf]').attr("content");
suburl = $('meta[name=_suburl]').attr("content"); suburl = $('meta[name=_suburl]').attr("content");
@ -717,6 +775,8 @@ $(document).ready(function () {
}); });
buttonsClickOnEnter(); buttonsClickOnEnter();
searchUsers();
initCommentForm(); initCommentForm();
initInstall(); initInstall();

View File

@ -934,9 +934,55 @@
} }
} }
} }
&.settings {
&.collaboration {
.collaborator.list {
padding: 0;
.item {
padding: 10px 20px;
&:not(:last-child) {
border-bottom: 1px solid #DDD;
}
}
}
#repo-collab-form {
#search-user-box {
.results {
left: 7px;
}
}
.ui.button {
margin-left: 5px;
margin-top: -3px;
}
}
}
}
} }
// End of .repository // End of .repository
#search-user-box {
.results {
padding: 0;
position: absolute;
.item {
padding: 10px 15px;
border-bottom: 1px solid #DDD;
cursor: pointer;
&:hover {
background: rgba(0,0,0,.05)!important;
color: rgba(0,0,0,.95)!important;
}
}
}
}
.issue.list { .issue.list {
list-style: none; list-style: none;
padding-top: 15px; padding-top: 15px;
@ -994,7 +1040,7 @@
.settings { .settings {
.content { .content {
margin-top: 2px; margin-top: 2px;
.header, >.header,
.segment { .segment {
box-shadow: 0 1px 2px 0 rgba(34,36,38,.15); box-shadow: 0 1px 2px 0 rgba(34,36,38,.15);
} }

View File

@ -42,5 +42,9 @@
} }
} }
} }
.ui.repository.list {
margin-top: 25px;
}
} }
} }

View File

@ -55,7 +55,7 @@ func SearchUsers(ctx *middleware.Context) {
} }
} }
ctx.Render.JSON(200, map[string]interface{}{ ctx.JSON(200, map[string]interface{}{
"ok": true, "ok": true,
"data": results, "data": results,
}) })

View File

@ -1 +1 @@
0.7.15.1116 Beta 0.7.16.1117 Beta

View File

@ -1,47 +1,44 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="repository settings collaboration">
<div id="repo-wrapper"> {{template "repo/header" .}}
{{template "repo/header_old" .}} <div class="ui container">
<div id="setting-wrapper" class="main-wrapper"> {{template "repo/sidebar" .}}
<div id="repo-setting" class="container clear"> <div class="ui grid">
{{template "repo/settings/nav" .}} {{template "repo/settings/navbar" .}}
<div class="grid-4-5 left"> <div class="twelve wide column content">
<div class="setting-content"> {{template "base/alert" .}}
{{template "ng/base/alert" .}} <h4 class="ui top attached header">
<div id="setting-content"> {{.i18n.Tr "repo.settings.collaboration"}}
<div id="user-profile-setting-content" class="panel panel-radius"> </h4>
<div class="panel-header"> <div class="ui attached segment collaborator list">
<strong>{{.i18n.Tr "repo.settings.collaboration"}}</strong> {{range .Collaborators}}
</div> <div class="item">
<div class="panel-body"> {{if not (eq .Id $.Owner.Id)}}
<ul id="repo-collab-list"> <a href="{{$.RepoLink}}/settings/collaboration?remove={{.Name}}" class="ui right text red"><i class="fa fa-times"></i></a>
{{range .Collaborators}} {{end}}
<li class="collab"> <a href="{{AppSubUrl}}/{{.Name}}">
{{if not (eq .Id $.Owner.Id)}}<a href="{{$.RepoLink}}/settings/collaboration?remove={{.Name}}" class="remove-collab right"><i class="fa fa-times"></i></a>{{end}} <img class="ui avatar image" src="{{.AvatarLink}}">
<a class="member" href="{{AppSubUrl}}/{{.Name}}"> {{.DisplayName}}
<img alt="{{.Name}}" class="pull-left avatar" src="{{.AvatarLink}}"> </a>
<strong>{{.FullName}}</strong> ({{.Name}}) </div>
</a> {{end}}
</li> </div>
<hr> <div class="ui bottom attached segment">
{{end}} <form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post">
</ul> {{.CsrfTokenHtml}}
</div> <div class="inline field ui left">
<div class="panel-footer"> <div id="search-user-box">
<form class="form form-align" action="{{.RepoLink}}/settings/collaboration" method="post" id="repo-collab-form"> <div class="ui input">
{{.CsrfTokenHtml}} <input class="prompt" name="collaborator" placeholder="{{.i18n.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off">
<input class="ipt ipt-large ipt-radius" id="repo-collaborator" name="collaborator" autocomplete="off" required /> </div>
<button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "repo.settings.add_collaborator"}}</button> <div class="ui segment results hide"></div>
<div class="repo-user-list-block"> </div>
<ul class="menu-down-show menu-vertical menu-radius switching-list user-list" id="repo-collaborator-list"></ul> </div>
</div> <button class="ui green button">{{.i18n.Tr "repo.settings.add_collaborator"}}</button>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div>
</div> </div>
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}

View File

@ -82,6 +82,7 @@
{{template "user/dashboard/feeds" .}} {{template "user/dashboard/feeds" .}}
</div> </div>
{{end}} {{end}}
</div>
</div> </div>
</div> </div>
</div> </div>