Commits

Ralph Bean committed cbb6549

basic accordian working in demo

Comments (0)

Files changed (3)

tw2/jquery/ui/base.py

 class jQueryUIMixin(jQueryPluginLinkMixin):
     dirname = defaults._ui_dirname_
     basename='jquery-ui'
+    modname = 'tw2.jquery.ui'
 
 class jQueryUIJSLink(JSLink, jQueryUIMixin):
     subdir = 'js'

tw2/jquery/ui/samples.py

 See http://toscawidgets.org/documentation/WidgetBrowser for more information
 """
 
-import widgets
+
+from widgets import (
+    AccordianWidget,
+)
+
+class DemoAccordianWidget(AccordianWidget):
+    items = [
+        ('Section 1',
+         """
+                <p>
+                Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
+                ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
+                amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
+                odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
+                </p>
+         """),
+        ('Section 2',
+         """
+                <p>
+                Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
+                purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
+                velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
+                suscipit faucibus urna.
+                </p>
+        """),
+        ('Section 3',
+         """
+                <p>
+                Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
+                Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
+                ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
+                lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
+                </p>
+                <ul>
+                    <li>List item one</li>
+                    <li>List item two</li>
+                    <li>List item three</li>
+                </ul>
+         """),
+        ('Section 4',
+         """
+                <p>
+                Cras dictum. Pellentesque habitant morbi tristique senectus et netus
+                et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
+                faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
+                mauris vel est.
+                </p>
+                <p>
+                Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
+                Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
+                inceptos himenaeos.
+                </p>
+         """),
+    ]

tw2/jquery/ui/widgets.py

 from tw2.jquery.core.base import jQueryJSLink
 from tw2.jquery.ui.base import jQueryUIThemeCSSLink, jQueryUIJSLink
-import defaults
+import tw2.core as twc
+from tw2.jquery.ui import defaults
 
 jquery_js = jQueryJSLink()
 
 
 jquery_ui = jQueryJSLink(resources = [jquery_ui_css, jquery_ui_js])
 
+# TODO http://jqueryui.com/demos/
+class AccordianWidget(twc.Widget):
+    resources = [
+        jquery_js,
+        jquery_ui_js,
+        jquery_ui_css,
+    ]
+    template = "tw2.jquery.ui.templates.accordian"
+    items = twc.Param(
+        'A list of (header (type:str), content (type:str) tuples', default=[])
+