Skip to content

Commit

Permalink
Making title optional for popovers
Browse files Browse the repository at this point in the history
  • Loading branch information
anutron committed Nov 1, 2012
1 parent 0cef301 commit 3c25c1e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Source/UI/Bootstrap.Popover.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,18 +38,23 @@ Bootstrap.Popover = new Class({
var title = this.options.getTitle.apply(this, [this.element]) || this.options.fallback; var title = this.options.getTitle.apply(this, [this.element]) || this.options.fallback;
var content = this.options.getContent.apply(this, [this.element]); var content = this.options.getContent.apply(this, [this.element]);


var titleWrapper = new Element('h3.popover-title'); var inner = new Element('div.popover-inner');


if (title) {
var titleWrapper = new Element('h3.popover-title');
if (typeOf(title) == "element") titleWrapper.adopt(title);
else titleWrapper.set('html', title);
inner.adopt(titleWrapper);
} else {
inner.addClass('no-title');
}


if (typeOf(title) == "element") titleWrapper.adopt(title);
else titleWrapper.set('html', title);
if (typeOf(content) != "element") content = new Element('p', { html: content}); if (typeOf(content) != "element") content = new Element('p', { html: content});
inner.adopt(new Element('div.popover-content').adopt(content));
this.tip = new Element('div.popover').addClass(this.options.location) this.tip = new Element('div.popover').addClass(this.options.location)
.adopt(new Element('div.arrow')) .adopt(new Element('div.arrow'))
.adopt( .adopt(inner);
new Element('div.popover-inner').adopt(titleWrapper).adopt(
new Element('div.popover-content').adopt(content)
)
);
if (this.options.animate) this.tip.addClass('fade'); if (this.options.animate) this.tip.addClass('fade');
if (Browser.Features.cssTransition && this.tip.addEventListener){ if (Browser.Features.cssTransition && this.tip.addEventListener){
this.tip.addEventListener(Browser.Features.transitionEnd, this.bound.complete); this.tip.addEventListener(Browser.Features.transitionEnd, this.bound.complete);
Expand Down

0 comments on commit 3c25c1e

Please sign in to comment.