Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow inline styles on options #203

Merged
merged 1 commit into from
Jul 9, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow inline styles on options
  • Loading branch information
caseyjhol committed Jul 9, 2013
commit aef8caa28476f5e7240ef937dcc8502263e1679a
13 changes: 7 additions & 6 deletions bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@

//Get the class and text for the option
var optionClass = $this.attr("class") || '';
var inline = $this.attr("style") || '';
var text = $this.html();
var subtext = $this.data('subtext') !== undefined ? '<small class="muted">' + $this.data('subtext') + '</small>' : '';
var icon = $this.data('icon') !== undefined ? '<i class="'+$this.data('icon')+'"></i> ' : '';
Expand All @@ -137,22 +138,22 @@
_liA.push(
'<div class="div-contain"><div class="divider"></div></div>'+
'<dt>'+label+'</dt>'+
_this.createA(text, "opt " + optionClass )
_this.createA(text, "opt " + optionClass, inline )
);
} else {
_liA.push(
'<dt>'+label+'</dt>'+
_this.createA(text, "opt " + optionClass ));
_this.createA(text, "opt " + optionClass, inline ));
}
} else {
_liA.push( _this.createA(text, "opt " + optionClass ) );
_liA.push( _this.createA(text, "opt " + optionClass, inline ) );
}
} else if ($this.data('divider') == true) {
_liA.push('<div class="div-contain"><div class="divider"></div></div>');
} else if ($(this).data('hidden') == true) {
_liA.push('');
} else {
_liA.push( _this.createA(text, optionClass ) );
_liA.push( _this.createA(text, optionClass, inline ) );
}
});

Expand All @@ -168,8 +169,8 @@
return $(_liHtml);
},

createA: function(text, classes) {
return '<a tabindex="0" class="'+classes+'">' +
createA: function(text, classes, inline) {
return '<a tabindex="0" class="'+classes+'" style="'+inline+'">' +
text +
'<i class="icon-ok check-mark"></i>' +
'</a>';
Expand Down
Loading