Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
b37a3364
Commit
b37a3364
authored
Nov 07, 2011
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #554 from rvagg/poveropt
optionable selectors for title & content elements
parents
b15e24e3
1b43c87e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
10 deletions
+47
-10
docs/javascript.html
docs/javascript.html
+18
-6
js/bootstrap-popover.js
js/bootstrap-popover.js
+5
-3
js/tests/unit/bootstrap-popover.js
js/tests/unit/bootstrap-popover.js
+24
-1
No files found.
docs/javascript.html
View file @
b37a3364
...
...
@@ -487,8 +487,8 @@ $('#.tabs').bind('change', function (e) {
<thead>
<tr>
<th
style=
"width: 100px;"
>
Name
</th>
<th
style=
"width:
100
px;"
>
type
</th>
<th
style=
"width:
50
px;"
>
default
</th>
<th
style=
"width:
95
px;"
>
type
</th>
<th
style=
"width:
95
px;"
>
default
</th>
<th>
description
</th>
</tr>
</thead>
...
...
@@ -557,7 +557,7 @@ $('#.tabs').bind('change', function (e) {
<td>
template
</td>
<td>
string
</td>
<td>
[default markup]
</td>
<td>
The html template used for rendering a twipsy.
</td>
<td>
the html template used for rendering a twipsy
</td>
</tr>
</tbody>
</table>
...
...
@@ -613,8 +613,8 @@ $('#.tabs').bind('change', function (e) {
<thead>
<tr>
<th
style=
"width: 100px;"
>
Name
</th>
<th
style=
"width:
100
px;"
>
type
</th>
<th
style=
"width:
50
px;"
>
default
</th>
<th
style=
"width:
95
px;"
>
type
</th>
<th
style=
"width:
95
px;"
>
default
</th>
<th>
description
</th>
</tr>
</thead>
...
...
@@ -689,7 +689,19 @@ $('#.tabs').bind('change', function (e) {
<td>
template
</td>
<td>
string
</td>
<td>
[default markup]
</td>
<td>
The html template used for rendering a popover.
</td>
<td>
the html template used for rendering a popover
</td>
</tr>
<tr>
<td>
titleSelector
</td>
<td>
string
</td>
<td>
.title
</td>
<td>
selector used to find the title element within the popover
</td>
</tr>
<tr>
<td>
contentSelector
</td>
<td>
string
</td>
<td>
.content p
</td>
<td>
selector used to find the content element within the popover
</td>
</tr>
</tbody>
</table>
...
...
js/bootstrap-popover.js
View file @
b37a3364
...
...
@@ -36,8 +36,8 @@
setContent
:
function
()
{
var
$tip
=
this
.
tip
()
$tip
.
find
(
'
.title
'
)[
this
.
options
.
html
?
'
html
'
:
'
text
'
](
this
.
getTitle
())
$tip
.
find
(
'
.content p
'
)[
this
.
options
.
html
?
'
html
'
:
'
text
'
](
this
.
getContent
())
$tip
.
find
(
this
.
options
.
titleSelector
)[
this
.
options
.
html
?
'
html
'
:
'
text
'
](
this
.
getTitle
())
$tip
.
find
(
this
.
options
.
contentSelector
)[
this
.
options
.
html
?
'
html
'
:
'
text
'
](
this
.
getContent
())
$tip
[
0
].
className
=
'
popover
'
}
...
...
@@ -83,6 +83,8 @@
placement
:
'
right
'
,
content
:
'
data-content
'
,
template
:
'
<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>
'
,
titleSelector
:
'
.title
'
,
contentSelector
:
'
.content p
'
})
$
.
fn
.
twipsy
.
rejectAttrOptions
.
push
(
'
content
'
)
...
...
js/tests/unit/bootstrap-popover.js
View file @
b37a3364
...
...
@@ -73,4 +73,27 @@ $(function () {
$
(
'
#qunit-runoff
'
).
empty
()
})
test
(
"
should allow arbitrary template html with title and content selector options
"
,
function
()
{
$
.
support
.
transition
=
false
var
expectedTitle
=
'
Gotta make you understand
'
,
popover
=
$
(
'
<a href="#">@rvagg</a>
'
)
.
attr
(
'
title
'
,
expectedTitle
)
.
attr
(
'
data-content
'
,
'
<p><b>Never gonna give you up</b>,</p><p>Never gonna let you down</p>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
({
html
:
true
,
titleSelector
:
'
h1
'
,
contentSelector
:
'
.rick > .roll
'
,
template
:
'
<div class="rick"><h1></h1><div class="roll"></div></div>
'
})
.
popover
(
'
show
'
)
ok
(
$
(
'
.popover > div > h1
'
).
length
,
'
h1 tag was inserted
'
)
ok
(
$
(
'
.popover > div > h1
'
).
text
()
===
expectedTitle
)
ok
(
$
(
'
.popover > .rick > .roll > p
'
).
length
===
2
,
'
p > b tags were inserted
'
)
popover
.
popover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment