mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Initial ui components for pull request review
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -727,6 +727,70 @@ function initRepository() {
|
||||
}
|
||||
}
|
||||
|
||||
function initPullRequestReview() {
|
||||
if ($('.repository.pull.diff').length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.diff-detail-box.ui.sticky').sticky();
|
||||
|
||||
$('.btn-review').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).closest('.dropdown').find('.menu').toggle('visible');
|
||||
});
|
||||
|
||||
$('.code-view .lines-code,.code-view .lines-num')
|
||||
.on('mouseenter', function() {
|
||||
var parent = $(this).closest('td');
|
||||
$(this).closest('tr').addClass(
|
||||
parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old')
|
||||
? 'focus-lines-old' : 'focus-lines-new'
|
||||
);
|
||||
})
|
||||
.on('mouseleave', function() {
|
||||
$(this).closest('tr').removeClass('focus-lines-new focus-lines-old');
|
||||
});
|
||||
$('.add-code-comment').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var isSplit = $(this).closest('.code-diff').hasClass('code-diff-split');
|
||||
var side = $(this).data('side');
|
||||
var idx = $(this).data('idx');
|
||||
var form = $('#pull_review_add_comment').html();
|
||||
var tr = $(this).closest('tr');
|
||||
var ntr = tr.next();
|
||||
if (!ntr.hasClass('add-comment')) {
|
||||
ntr = $('<tr class="add-comment">'
|
||||
+ (isSplit ? '<td class="lines-num"></td><td class="add-comment-left"></td><td class="lines-num"></td><td class="add-comment-right"></td>'
|
||||
: '<td class="lines-num"></td><td class="lines-num"></td><td class="add-comment-left add-comment-right"></td>')
|
||||
+ '</tr>');
|
||||
tr.after(ntr);
|
||||
}
|
||||
var td = ntr.find('.add-comment-' + side);
|
||||
var commentCloud = td.find('.comment-code-cloud');
|
||||
if (commentCloud.length === 0) {
|
||||
td.html(form);
|
||||
commentCloud = td.find('.comment-code-cloud');
|
||||
|
||||
var id = Math.floor(Math.random() * Math.floor(1000000));
|
||||
var menu = commentCloud.find('.menu');
|
||||
menu.attr('data-write', menu.attr('data-write') + id);
|
||||
menu.attr('data-preview', menu.attr('data-preview') + id);
|
||||
menu.find('.item').each(function(i, item) {
|
||||
$(item).attr('data-tab', $(item).attr('data-tab') + id);
|
||||
});
|
||||
commentCloud.find('.tab.segment').each(function(i, item) {
|
||||
$(item).attr('data-tab', $(item).attr('data-tab') + id);
|
||||
});
|
||||
|
||||
initCommentPreviewTab(commentCloud.find('.form'));
|
||||
}
|
||||
commentCloud.find('textarea').focus();
|
||||
|
||||
|
||||
//alert($(this).data('side') + $(this).data('idx'));
|
||||
});
|
||||
}
|
||||
|
||||
function initRepositoryCollaboration() {
|
||||
console.log('initRepositoryCollaboration');
|
||||
|
||||
@@ -1609,6 +1673,7 @@ $(document).ready(function () {
|
||||
initCtrlEnterSubmit();
|
||||
initNavbarContentToggle();
|
||||
initTopicbar();
|
||||
initPullRequestReview();
|
||||
|
||||
// Repo clone url.
|
||||
if ($('#repo-clone-url').length > 0) {
|
||||
|
||||
@@ -862,38 +862,44 @@
|
||||
width: 140px;
|
||||
}
|
||||
}
|
||||
td.sha .sha.label {
|
||||
margin: 0;
|
||||
}
|
||||
td.sha .sha.label {
|
||||
margin: 0;
|
||||
}
|
||||
&.ui.basic.striped.table tbody tr:nth-child(2n) {
|
||||
background-color: rgba(0, 0, 0, .02)!important;
|
||||
}
|
||||
}
|
||||
|
||||
#commits-table td.sha .sha.label, #repo-files-table .sha.label{
|
||||
&.isSigned{
|
||||
border: 1px solid #BBB;
|
||||
.detail.icon{
|
||||
background: #FAFAFA;
|
||||
margin: -6px -10px -4px 0px;
|
||||
padding: 5px 3px 5px 6px;
|
||||
border-left: 1px solid #BBB;
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
||||
&.isSigned.isVerified{
|
||||
border: 1px solid #21BA45;
|
||||
background: #21BA4518;
|
||||
.detail.icon{
|
||||
border-left: 1px solid #21BA4580;
|
||||
}
|
||||
}
|
||||
#commits-table td.sha .sha.label, #repo-files-table .sha.label{
|
||||
&.isSigned{
|
||||
border: 1px solid #BBB;
|
||||
.detail.icon{
|
||||
background: #FAFAFA;
|
||||
margin: -6px -10px -4px 0px;
|
||||
padding: 5px 3px 5px 6px;
|
||||
border-left: 1px solid #BBB;
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
||||
&.isSigned.isVerified{
|
||||
border: 1px solid #21BA45;
|
||||
background: #21BA4518;
|
||||
.detail.icon{
|
||||
border-left: 1px solid #21BA4580;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.diff-detail-box {
|
||||
margin: 15px 0;
|
||||
padding: 7px 0;
|
||||
background: #fff;
|
||||
line-height: 30px;
|
||||
>div:after{
|
||||
clear: both;
|
||||
content: "";
|
||||
display: block;
|
||||
}
|
||||
ol {
|
||||
clear: both;
|
||||
padding-left: 0;
|
||||
@@ -926,8 +932,9 @@
|
||||
background-color: #dad8ff;
|
||||
}
|
||||
}
|
||||
.ui.right {
|
||||
margin-bottom: 15px;
|
||||
.detail-files {
|
||||
background: #fff;
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
.diff-box .header {
|
||||
|
||||
94
public/less/_review.less
Normal file
94
public/less/_review.less
Normal file
@@ -0,0 +1,94 @@
|
||||
.ui.button.add-code-comment {
|
||||
font-size: 14px;
|
||||
height: 16px;
|
||||
padding: 0;
|
||||
padding-top: 2px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
display: none;
|
||||
|
||||
&:hover {
|
||||
font-size:16px;
|
||||
margin-top: -2px;
|
||||
margin-left: -2px;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.focus-lines-new .ui.button.add-code-comment.add-code-comment-right,
|
||||
.focus-lines-old .ui.button.add-code-comment.add-code-comment-left {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.comment-code-cloud {
|
||||
padding: 4px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
border: 1px solid #f1f1f1;
|
||||
margin-top: 13px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
&:before {
|
||||
content: " ";
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 13px solid transparent;
|
||||
border-right: 13px solid transparent;
|
||||
border-bottom: 13px solid #f1f1f1;
|
||||
left: 20px;
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
}
|
||||
|
||||
.attached.tab {
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
&.markdown {
|
||||
padding: 1em;
|
||||
min-height: 168px;
|
||||
}
|
||||
}
|
||||
|
||||
.right.menu.options .item {
|
||||
padding: 0.85714286em 0.442857em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ui.form textarea {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.ui.attached.tabular.menu {
|
||||
background: #f7f7f7;
|
||||
border: 1px solid #d4d4d5;
|
||||
padding-top: 5px;
|
||||
padding-left: 5px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
border-top: 1px solid #f1f1f1;
|
||||
margin-top: 10px;
|
||||
|
||||
.markdown-info {
|
||||
display: inline-block;
|
||||
margin: 5px 0;
|
||||
font-size: 12px;
|
||||
color: rgba(0,0,0,.6)
|
||||
}
|
||||
|
||||
.ui.right.floated {
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
&:after{
|
||||
clear: both;
|
||||
content: "";
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,3 +12,4 @@
|
||||
@import "_dashboard";
|
||||
@import "_admin";
|
||||
@import "_explore";
|
||||
@import "_review";
|
||||
|
||||
Reference in New Issue
Block a user