Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
ui.Select2: fix .branche-label styles for other branch types
Browse files Browse the repository at this point in the history
  • Loading branch information
laziel committed Aug 18, 2014
1 parent d9449d0 commit 60e5822
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/less/_override.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
16 changes: 12 additions & 4 deletions app/assets/stylesheets/less/_page.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 3 additions & 1 deletion public/javascripts/common/yobi.ui.Select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 60e5822

Please sign in to comment.