From 0f2883b75a6abfbc64747aa3d126aeeca7b1d379 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 5 Mar 2012 15:14:24 +0000 Subject: [PATCH] Adjust the slider macro to the new Bootstrap styles And fixed some indentation issues --- js/macros/slider.js | 80 ++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/js/macros/slider.js b/js/macros/slider.js index 9a4240868..f75183d16 100644 --- a/js/macros/slider.js +++ b/js/macros/slider.js @@ -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: {{{ - {slider label} + {slider label}
{slider content}
}}} @@ -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