Merge pull request #1761 from JD557/truncate-branch-name
Truncate long branch names
commit 887baf2f087debb6b56357c37d9c6544bac0e01e
2 parents fa2d7db + bc8dd4b
@Naoki Takezoe Naoki Takezoe authored on 2 Nov 2017
GitHub committed on 2 Nov 2017
Showing 2 changed files
View
4
src/main/twirl/gitbucket/core/helper/branchcontrol.scala.html
hasWritePermission: Boolean)(body: Html)(implicit context: gitbucket.core.controller.Context)
@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>
@body
View
11
src/main/twirl/gitbucket/core/helper/dropdown.scala.html
@(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>
} else {
@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>
<ul class="dropdown-menu@if(right){ pull-right}">