mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-15 09:55:49 +01:00
(refs #1340)Add dropdown filter
Because the large dropdown list makes impossible to choose items below the screen.
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
prefix = if(branch.length == 40) "tree" else if(repository.branchList.contains(branch)) "branch" else "tree"
|
prefix = if(branch.length == 40) "tree" else if(repository.branchList.contains(branch)) "branch" else "tree"
|
||||||
) {
|
) {
|
||||||
<li><div id="branch-control-title">Switch branches<button id="branch-control-close" class="pull-right">×</button></div></li>
|
<li><div id="branch-control-title">Switch branches<button id="branch-control-close" class="pull-right">×</button></div></li>
|
||||||
<li><input id="branch-control-input" type="text" class="form-control input-sm" placeholder="Find or create branch ..."/></li>
|
<li><input id="branch-control-input" type="text" class="form-control input-sm dropdown-filter-input" placeholder="Find or create branch ..."/></li>
|
||||||
@body
|
@body
|
||||||
@if(hasWritePermission) {
|
@if(hasWritePermission) {
|
||||||
<li id="create-branch" style="display: none;">
|
<li id="create-branch" style="display: none;">
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
@(value : String = "",
|
@(value : String = "",
|
||||||
prefix: String = "",
|
prefix: String = "",
|
||||||
style : String = "",
|
style : String = "",
|
||||||
right : Boolean = false)(body: Html)
|
right : Boolean = false,
|
||||||
|
filter: String = "")(body: Html)
|
||||||
<div class="btn-group" @if(style.nonEmpty){style="@style"}>
|
<div class="btn-group" @if(style.nonEmpty){style="@style"}>
|
||||||
<button
|
<button
|
||||||
class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown">
|
class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown">
|
||||||
@@ -16,6 +17,28 @@
|
|||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu@if(right){ pull-right}">
|
<ul class="dropdown-menu@if(right){ pull-right}">
|
||||||
|
@if(filter.nonEmpty) {
|
||||||
|
<li><input id="@filter-input" type="text" class="form-control input-sm dropdown-filter-input" placeholder="Filter"/></li>
|
||||||
|
}
|
||||||
@body
|
@body
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@if(filter.nonEmpty) {
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('#@{filter}-input').parent().click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
$('#@{filter}-input').keyup(function() {
|
||||||
|
var inputVal = $('#@{filter}-input').val();
|
||||||
|
$.each($('#@{filter}-input').parent().parent().find('a'), function(index, elem) {
|
||||||
|
if (!inputVal || !elem.text.trim() || elem.text.trim().lastIndexOf(inputVal, 0) >= 0) {
|
||||||
|
$(elem).parent().show();
|
||||||
|
} else {
|
||||||
|
$(elem).parent().hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<script><script>
|
<script>
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#edit').click(function(){
|
$('#edit').click(function(){
|
||||||
$('.edit-title').show();
|
$('.edit-title').show();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<span class="muted small strong">Labels</span>
|
<span class="muted small strong">Labels</span>
|
||||||
@if(isManageable){
|
@if(isManageable){
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@gitbucket.core.helper.html.dropdown("Edit", right = true) {
|
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = "labels") {
|
||||||
@labels.map { label =>
|
@labels.map { label =>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" class="toggle-label" data-label-id="@label.labelId">
|
<a href="#" class="toggle-label" data-label-id="@label.labelId">
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<span class="muted small strong">Milestone</span>
|
<span class="muted small strong">Milestone</span>
|
||||||
@if(isManageable){
|
@if(isManageable){
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@gitbucket.core.helper.html.dropdown("Edit", right = true) {
|
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = "milestone") {
|
||||||
<li><a href="javascript:void(0);" class="milestone" data-id=""><i class="octicon octicon-x"></i> Clear this milestone</a></li>
|
<li><a href="javascript:void(0);" class="milestone" data-id=""><i class="octicon octicon-x"></i> Clear this milestone</a></li>
|
||||||
@milestones.filter(_._1.closedDate.isEmpty).map { case (milestone, _, _) =>
|
@milestones.filter(_._1.closedDate.isEmpty).map { case (milestone, _, _) =>
|
||||||
<li>
|
<li>
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
<span class="muted small strong">Assignee</span>
|
<span class="muted small strong">Assignee</span>
|
||||||
@if(isManageable){
|
@if(isManageable){
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@gitbucket.core.helper.html.dropdown("Edit", right = true) {
|
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = "assignee") {
|
||||||
<li><a href="javascript:void(0);" class="assign" data-name=""><i class="octicon octicon-x"></i> Clear assignee</a></li>
|
<li><a href="javascript:void(0);" class="assign" data-name=""><i class="octicon octicon-x"></i> Clear assignee</a></li>
|
||||||
@collaborators.map { collaborator =>
|
@collaborators.map { collaborator =>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -326,6 +326,12 @@ div.account-image {
|
|||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-filter-input {
|
||||||
|
border: solid 1px #ccc;
|
||||||
|
margin: 4px;
|
||||||
|
width: 96%;
|
||||||
|
}
|
||||||
|
|
||||||
ul.dropdown-menu {
|
ul.dropdown-menu {
|
||||||
padding: 2px 0;
|
padding: 2px 0;
|
||||||
}
|
}
|
||||||
@@ -338,7 +344,7 @@ ul.dropdown-menu li a {
|
|||||||
padding: 2px 10px;
|
padding: 2px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.dropdown-menu :last-child {
|
ul.dropdown-menu li:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,12 +638,6 @@ span.simplified-path {
|
|||||||
line-height: 15px;
|
line-height: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#branch-control-input {
|
|
||||||
border: solid 1px #ccc;
|
|
||||||
margin: 4px;
|
|
||||||
width: 96%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.new-branch-name {
|
.new-branch-name {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
|
|||||||
Reference in New Issue
Block a user