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>
</div>
<div class="panel-body">
<ul id="repo-collab-list">
{{range .Collaborators}} {{range .Collaborators}}
<li class="collab"> <div class="item">
{{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}} {{if not (eq .Id $.Owner.Id)}}
<a class="member" href="{{AppSubUrl}}/{{.Name}}"> <a href="{{$.RepoLink}}/settings/collaboration?remove={{.Name}}" class="ui right text red"><i class="fa fa-times"></i></a>
<img alt="{{.Name}}" class="pull-left avatar" src="{{.AvatarLink}}">
<strong>{{.FullName}}</strong> ({{.Name}})
</a>
</li>
<hr>
{{end}} {{end}}
</ul> <a href="{{AppSubUrl}}/{{.Name}}">
<img class="ui avatar image" src="{{.AvatarLink}}">
{{.DisplayName}}
</a>
</div> </div>
<div class="panel-footer"> {{end}}
<form class="form form-align" action="{{.RepoLink}}/settings/collaboration" method="post" id="repo-collab-form"> </div>
<div class="ui bottom attached segment">
<form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input class="ipt ipt-large ipt-radius" id="repo-collaborator" name="collaborator" autocomplete="off" required /> <div class="inline field ui left">
<button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "repo.settings.add_collaborator"}}</button> <div id="search-user-box">
<div class="repo-user-list-block"> <div class="ui input">
<ul class="menu-down-show menu-vertical menu-radius switching-list user-list" id="repo-collaborator-list"></ul> <input class="prompt" name="collaborator" placeholder="{{.i18n.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off">
</div> </div>
<div class="ui segment results hide"></div>
</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> {{template "base/footer" .}}
</div>
</div>
{{template "ng/base/footer" .}}

View file

@ -85,4 +85,5 @@
</div> </div>
</div> </div>
</div> </div>
</div>
{{template "base/footer" .}} {{template "base/footer" .}}