mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Adjust the slider macro to the new Bootstrap styles
And fixed some indentation issues
This commit is contained in:
parent
bfc1f1aaa5
commit
0f2883b75a
@ -19,7 +19,7 @@ The current state of the slider can be stored as the string "open" or "closed" i
|
||||
The markup generated by the slider macro is:
|
||||
{{{
|
||||
<span class="tw-slider {user defined class}">
|
||||
<a class="tw-slider-label">{slider label}</a>
|
||||
<a class="btn-info">{slider label}</a>
|
||||
<div class="tw-slider-body" style="display:{state}">{slider content}</div>
|
||||
</span>
|
||||
}}}
|
||||
@ -104,45 +104,45 @@ exports.macro = {
|
||||
}
|
||||
},
|
||||
execute: function() {
|
||||
this.isOpen = getOpenState(this);
|
||||
var sliderContent = [];
|
||||
if(this.isOpen) {
|
||||
sliderContent = getSliderContent(this);
|
||||
}
|
||||
var attributes = {
|
||||
"class": ["tw-slider"]
|
||||
};
|
||||
if(this.hasParameter("class")) {
|
||||
attributes["class"].push(this.params["class"]);
|
||||
}
|
||||
if(this.hasParameter("state")) {
|
||||
attributes["data-tw-slider-type"] = this.params.state;
|
||||
}
|
||||
if(this.hasParameter("tooltip")) {
|
||||
attributes.alt = this.params.tooltip;
|
||||
attributes.title = this.params.tooltip;
|
||||
}
|
||||
var content = Renderer.ElementNode("span",
|
||||
attributes,
|
||||
[
|
||||
Renderer.ElementNode("a",
|
||||
{
|
||||
"class": ["tw-slider-label"]
|
||||
},[
|
||||
Renderer.TextNode(this.params.label ? this.params.label : this.params.target)
|
||||
]
|
||||
),
|
||||
Renderer.ElementNode("div",
|
||||
{
|
||||
"class": ["tw-slider-body"],
|
||||
"style": {"display": this.isOpen ? "block" : "none"}
|
||||
},
|
||||
sliderContent
|
||||
)
|
||||
]
|
||||
);
|
||||
content.execute(this.parents,this.store.getTiddler(this.tiddlerTitle));
|
||||
return [content];
|
||||
this.isOpen = getOpenState(this);
|
||||
var sliderContent = [];
|
||||
if(this.isOpen) {
|
||||
sliderContent = getSliderContent(this);
|
||||
}
|
||||
var attributes = {
|
||||
"class": ["tw-slider"]
|
||||
};
|
||||
if(this.hasParameter("class")) {
|
||||
attributes["class"].push(this.params["class"]);
|
||||
}
|
||||
if(this.hasParameter("state")) {
|
||||
attributes["data-tw-slider-type"] = this.params.state;
|
||||
}
|
||||
if(this.hasParameter("tooltip")) {
|
||||
attributes.alt = this.params.tooltip;
|
||||
attributes.title = this.params.tooltip;
|
||||
}
|
||||
var content = Renderer.ElementNode("span",
|
||||
attributes,
|
||||
[
|
||||
Renderer.ElementNode("a",
|
||||
{
|
||||
"class": ["btn","btn-info"]
|
||||
},[
|
||||
Renderer.TextNode(this.params.label ? this.params.label : this.params.target)
|
||||
]
|
||||
),
|
||||
Renderer.ElementNode("div",
|
||||
{
|
||||
"class": ["tw-slider-body"],
|
||||
"style": {"display": this.isOpen ? "block" : "none"}
|
||||
},
|
||||
sliderContent
|
||||
)
|
||||
]
|
||||
);
|
||||
content.execute(this.parents,this.store.getTiddler(this.tiddlerTitle));
|
||||
return [content];
|
||||
},
|
||||
refreshInDom: function(changes) {
|
||||
var needContentRefresh = true; // Avoid refreshing the content nodes if we don't need to
|
||||
|
Loading…
Reference in New Issue
Block a user