Truncate long branch names

Fix #1135
This commit is contained in:
João Costa
2017-10-29 11:25:07 +00:00
parent fa2d7db0ca
commit bc8dd4b3c2
2 changed files with 8 additions and 3 deletions

View File

@@ -4,7 +4,8 @@
@import gitbucket.core.view.helpers
@gitbucket.core.helper.html.dropdown(
value = if(branch.length == 40) branch.substring(0, 10) else branch,
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",
maxValueWidth = "200px"
) {
<li><div id="branch-control-title">Switch branches<button id="branch-control-close" class="pull-right">&times</button></div></li>
<li><input id="branch-control-input" type="text" class="form-control input-sm dropdown-filter-input" placeholder="Find or create branch ..."/></li>

View File

@@ -1,11 +1,12 @@
@(value : String = "",
prefix: String = "",
style : String = "",
maxValueWidth : String = "",
right : Boolean = false,
filter: (String, String) = ("",""))(body: Html)
@defining(if(filter._1.isEmpty) "" else filter._1 + "-" + scala.util.Random.alphanumeric.take(4).mkString){ filterId =>
<div class="btn-group" @if(style.nonEmpty){style="@style"}>
<button
<button id = "test"
class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown">
@if(value.isEmpty){
<i class="octicon octicon-gear"></i>
@@ -13,7 +14,10 @@
@if(prefix.nonEmpty){
<span class="muted">@prefix:</span>
}
<span class="strong">@value</span>
<span class="strong"
@if(maxValueWidth.nonEmpty){style="display:inline-block; vertical-align:bottom; overflow-x:hidden; max-width:@maxValueWidth; text-overflow:ellipsis"}>
@value
</span>
}
<span class="caret"></span>
</button>