Merge pull request #1829 from kounoike/pr-dropdown-close-and-comment-button

Change Close/Reopen button to dropdown-selectable button.
This commit is contained in:
Naoki Takezoe
2018-01-11 13:22:27 +09:00
committed by GitHub

View File

@@ -22,12 +22,24 @@
elastic = true,
tabIndex = 1
)
<div class="text-right">
<input type="hidden" name="issueId" value="@issue.issueId"/>
@if((reopenable || !issue.closed) && (isManageable || issue.openedUserName == context.loginAccount.get.userName)){
<input type="submit" class="btn btn-default" tabindex="3" formaction="@helpers.url(repository)/issue_comments/state" value="@{if(issue.closed) "Reopen" else "Close"}" id="action"/>
}
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
<div class="text-right">
<input type="hidden" name="issueId" value="@issue.issueId"/>
@if((reopenable || !issue.closed) && (isManageable || issue.openedUserName == context.loginAccount.get.userName)){
<input type="hidden" id="action" name="action" value="comment"/>
<div class="btn-group dropup">
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment" id="submit-button"/>
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a id="menu-comment">Comment</a></li>
<li><a id="menu-x-and-comment">@{if(issue.closed) "Reopen" else "Close"} and comment</a></li>
</ul>
</div>
} else {
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
}
</div>
</div>
</div>
</div>
@@ -35,8 +47,13 @@
}
<script>
$(function(){
$('#action').click(function(){
$('<input type="hidden">').attr('name', 'action').val($(this).val().toLowerCase()).appendTo('form');
$('#menu-comment').click(function(){
$('#submit-button').attr('value', 'Comment').attr('formaction', '@helpers.url(repository)/issue_comments/new');
$('#action').val('comment');
});
$('#menu-x-and-comment').click(function(){
$('#submit-button').attr('value', '@{if(issue.closed) "Reopen" else "Close"} and comment').attr('formaction', '@helpers.url(repository)/issue_comments/state');
$('#action').val('@{if(issue.closed) "reopen" else "close"}');
});
});
</script>