diff --git a/app/assets/stylesheets/less/_override.less b/app/assets/stylesheets/less/_override.less
index cd0a3c3e4..6da867bdf 100644
--- a/app/assets/stylesheets/less/_override.less
+++ b/app/assets/stylesheets/less/_override.less
@@ -339,3 +339,7 @@ li.select2-result-with-children:first-of-type {
.pika-table abbr[title] {
cursor: default;
}
+
+.select2-chosen .branch-label {
+ margin-top:-2px;
+}
diff --git a/app/assets/stylesheets/less/_page.less b/app/assets/stylesheets/less/_page.less
index 4d30e8c2d..0a426d5a3 100644
--- a/app/assets/stylesheets/less/_page.less
+++ b/app/assets/stylesheets/less/_page.less
@@ -3866,18 +3866,26 @@ label.issue-item-row {
}
.branch-label {
+ display:inline-block;
color:#fff;
+ font-size:11px;
+ background:@yobi-gray;
text-shadow: none;
+ text-align:center;
+ min-width:50px;
+ height:20px;
+ line-height:20px;
+ margin: 0 3px 0 0;
+ vertical-align: middle;
.border-radius(2px);
+ &.unknown {
+ display: none;
+ }
&.branch {
- padding: 2px 4px;
- margin: 0 3px 0 0;
background-color: @yobi-yello-dark;
}
&.tag {
- padding: 2px 4px;
- margin: 0 3px 0 0;
background-color: @yobi-cyan;
}
}
diff --git a/public/javascripts/common/yobi.ui.Select2.js b/public/javascripts/common/yobi.ui.Select2.js
index 96ef0305b..5db977d07 100644
--- a/public/javascripts/common/yobi.ui.Select2.js
+++ b/public/javascripts/common/yobi.ui.Select2.js
@@ -110,7 +110,7 @@
return '' + text + '';
},
"branch": function(itemObject){
- var branchType = "";
+ var branchType = "unknown";
var branchName = itemObject.text.trim();
var branchNameRegex = /refs\/(.[a-z]+)\/(.+)/i;
@@ -131,6 +131,8 @@
var tplBranchItem = $("#tplSelect2FormatBranch").text()
|| '${branchType} ${branchName}';
+ // branchType will be "unknown"
+ // if selected branch name doesn't starts with /refs
var formattedResult = $yobi.tmpl(tplBranchItem, {
"branchType": branchType,
"branchName": branchName