Jihan Kim 2014-08-18
ui.Select2: fix .branche-label styles for other branch types
@60e5822f6a9f76c792f3181df4f3a999c7c71ad6
app/assets/stylesheets/less/_override.less
--- app/assets/stylesheets/less/_override.less
+++ app/assets/stylesheets/less/_override.less
@@ -339,3 +339,7 @@
 .pika-table abbr[title] {
     cursor: default;
 }
+
+.select2-chosen .branch-label {
+    margin-top:-2px;
+}
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -3866,18 +3866,26 @@
 }
 
 .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;
     }
 }
public/javascripts/common/yobi.ui.Select2.js
--- public/javascripts/common/yobi.ui.Select2.js
+++ public/javascripts/common/yobi.ui.Select2.js
@@ -110,7 +110,7 @@
                 return '<a class="label issue-label active static" data-label-id="' + labelId + '">' + text + '</a>';
             },
             "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()
                                   || '<strong class="branch-label ${branchType}">${branchType}</strong> ${branchName}';
 
+                // branchType will be "unknown"
+                // if selected branch name doesn't starts with /refs
                 var formattedResult = $yobi.tmpl(tplBranchItem, {
                     "branchType": branchType,
                     "branchName": branchName
Add a comment
List