summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rwxr-xr-xpublic/css/gogs.css34
-rw-r--r--public/js/gogs.js60
-rw-r--r--public/less/_repository.less48
-rw-r--r--public/less/_user.less4
4 files changed, 144 insertions, 2 deletions
diff --git a/public/css/gogs.css b/public/css/gogs.css
index d0db002aee..906f8d31e7 100755
--- a/public/css/gogs.css
+++ b/public/css/gogs.css
@@ -2510,6 +2510,35 @@ footer .container .links > *:first-child {
.repository.forks .list .item .link {
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 {
list-style: none;
padding-top: 15px;
@@ -2562,7 +2591,7 @@ footer .container .links > *:first-child {
.settings .content {
margin-top: 2px;
}
-.settings .content .header,
+.settings .content > .header,
.settings .content .segment {
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) {
border-bottom: 1px solid #eaeaea;
}
+.user.profile .ui.repository.list {
+ margin-top: 25px;
+}
.dashboard {
padding-top: 15px;
padding-bottom: 80px;
diff --git a/public/js/gogs.js b/public/js/gogs.js
index e0738a5061..d429516e4b 100644
--- a/public/js/gogs.js
+++ b/public/js/gogs.js
@@ -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 () {
csrf = $('meta[name=_csrf]').attr("content");
suburl = $('meta[name=_suburl]').attr("content");
@@ -717,6 +775,8 @@ $(document).ready(function () {
});
buttonsClickOnEnter();
+ searchUsers();
+
initCommentForm();
initInstall();
diff --git a/public/less/_repository.less b/public/less/_repository.less
index 24fe4888ff..86c8fe33e9 100644
--- a/public/less/_repository.less
+++ b/public/less/_repository.less
@@ -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
+#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 {
list-style: none;
padding-top: 15px;
@@ -994,7 +1040,7 @@
.settings {
.content {
margin-top: 2px;
- .header,
+ >.header,
.segment {
box-shadow: 0 1px 2px 0 rgba(34,36,38,.15);
}
diff --git a/public/less/_user.less b/public/less/_user.less
index bf0de5068a..171fccd082 100644
--- a/public/less/_user.less
+++ b/public/less/_user.less
@@ -42,5 +42,9 @@
}
}
}
+
+ .ui.repository.list {
+ margin-top: 25px;
+ }
}
} \ No newline at end of file