Commits

Anonymous committed 90f3e8c

Add Editor

Comments (0)

Files changed (7)

+glob:*.pyc

examples/example.py

 class Index(twf.FormPage):
     title = 'YUI Example'
     attrs = {'class': 'yui-skin-sam'}
-    class child(twy.TabView):
+    class child(twf.TableLayout):
         auto_complete = twy.AutoComplete()
         color_picker = twy.ColorPicker()
         calendar = twy.Calendar()
     class child(twf.Form):
         class child(twf.TableLayout):
             check = twf.CheckBox(validator=twc.Required)
-            color = twy.Calendar()
+            color = twy.Editor()
 
 if __name__ == '__main__':
     import wsgiref.simple_server as wrs

tw2/yui/__init__.py

-from widgets import Slider, TabView, AutoComplete, ColorPicker, Calendar
+from widgets import (Slider, TabView, AutoComplete, ColorPicker, Calendar,
+        Editor)
 
 
+

tw2/yui/templates/calendar.html

 <div id="$w.compound_id"></div>
 <script type="text/javascript">
     YAHOO.util.Event.onDOMReady(function() {
-        cal = new YAHOO.widget.Calendar("$w.compound_id");
+        cal = new YAHOO.widget.Calendar("$w.compound_id", $w.config);
         cal.render();
     });
 </script>

tw2/yui/templates/editor.html

+<div>
+<textarea id="$w.compound_id" name="$w.compound_id" rows="20" cols="75">
+</textarea>
+<script type="text/javascript">
+    YAHOO.util.Event.onDOMReady(function() {
+        var myEditor = new YAHOO.widget.Editor('$w.compound_id', $w.config);
+        myEditor.render();
+    });
+</script>
+</div>

tw2/yui/widgets.py

 
 class Slider(twc.Widget):
     resources = [
+        twc.DirLink(modname=__name__, filename="static/2.7.0/"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/fonts/fonts-min.css"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/slider/assets/skins/sam/slider.css"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/yahoo-dom-event/yahoo-dom-event.js"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/dragdrop/dragdrop-min.js"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/slider/slider-min.js"),
         twc.Link(id='thumb', modname=__name__, filename='static/2.7.0/slider/assets/thumb-n.gif'),
-        #twc.Link(id='thumb', modname=__name__, filename='static/2.7.0/slider/assets/thumb-bar.gif'),
-        twc.Link(modname=__name__, filename='static/2.7.0/slider/assets/skins/sam/bg-v.gif'),
-        twc.Link(modname=__name__, filename='static/2.7.0/slider/assets/skins/sam/bg-h.gif'),
     ]
     template = "genshi:tw2.yui.templates.slider"
 
 
 class TabView(twf.widgets.BaseLayout):
     resources = [
+        twc.DirLink(modname=__name__, filename="static/2.7.0/"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/fonts/fonts-min.css"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/tabview/assets/skins/sam/tabview.css"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/yahoo-dom-event/yahoo-dom-event.js"),
 
 class AutoComplete(twc.Widget):
     resources = [
+        twc.DirLink(modname=__name__, filename="static/2.7.0/"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/fonts/fonts-min.css"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/autocomplete/assets/skins/sam/autocomplete.css"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/yahoo-dom-event/yahoo-dom-event.js"),
 
 class Calendar(twc.Widget):
     resources = [
+        twc.DirLink(modname=__name__, filename="static/2.7.0/"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/fonts/fonts-min.css"),
         twc.CSSLink(modname=__name__, filename="static/2.7.0/calendar/assets/skins/sam/calendar.css"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/yahoo-dom-event/yahoo-dom-event.js"),
         twc.JSLink(modname=__name__, filename="static/2.7.0/calendar/calendar-min.js"),
     ]
     template = "genshi:tw2.yui.templates.calendar"
+
+    config = twc.Param('config - see yui docs', default={})
+
+    def prepare(self):
+        super(Calendar, self).prepare()
+        self.config = encoder.encode(self.config)
+
+
+class Editor(twc.Widget):
+    resources = [
+        twc.DirLink(modname=__name__, filename="static/2.7.0/"),
+        twc.CSSLink(modname=__name__, filename="static/2.7.0/menu/assets/skins/sam/menu.css"),
+        twc.CSSLink(modname=__name__, filename="static/2.7.0/button/assets/skins/sam/button.css"),
+        twc.CSSLink(modname=__name__, filename="static/2.7.0/fonts/fonts-min.css"),
+        twc.CSSLink(modname=__name__, filename="static/2.7.0/container/assets/skins/sam/container.css"),
+        twc.CSSLink(modname=__name__, filename="static/2.7.0/editor/assets/skins/sam/editor.css"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/yahoo-dom-event/yahoo-dom-event.js"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/animation/animation-min.js"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/element/element-min.js"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/container/container-min.js"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/menu/menu-min.js"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/button/button-min.js"),
+        twc.JSLink(modname=__name__, filename="static/2.7.0/editor/editor-min.js"),
+    ]
+    template = "genshi:tw2.yui.templates.editor"
+
+    config = twc.Param('config - see yui docs', default={})
+
+    def prepare(self):
+        super(Editor, self).prepare()
+        self.config = encoder.encode(self.config)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.