[KSS-checkins] r46857 - in kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+: . demo demo/selenium_tests
reebalazs at codespeak.net
reebalazs at codespeak.net
Tue Sep 25 10:10:31 CEST 2007
Author: reebalazs
Date: Tue Sep 25 10:10:30 2007
New Revision: 46857
Added:
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/config.py_tmpl
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/configure.zcml_tmpl
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/demoview.py_templ
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/my_demo.kss_templ
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/my_demo.pt_templ
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/selenium_tests/
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/selenium_tests/README.txt_templ
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/zopeconfig.py_tmpl
Modified:
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/commands.py_tmpl
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/configure.zcml_tmpl
kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/interfaces.py_tmpl
Log:
Adding demo structure to template (untested)
Modified: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/commands.py_tmpl
==============================================================================
--- kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/commands.py_tmpl (original)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/commands.py_tmpl Tue Sep 25 10:10:30 2007
@@ -2,9 +2,9 @@
class ${package.capitalize()}Commands(CommandSet):
- # Add your own actions here, you can use the following code as
+ # Add your own commands here, you can use the following code as
# a starting point
- def yourAction(self, selector, data):
+ def yourCommand(self, selector, data):
command = self.commands.addCommand('yourAction', selector)
# Repeat for each parameter you need
command.addParam('parameter', data)
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/config.py_tmpl
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/config.py_tmpl Tue Sep 25 10:10:30 2007
@@ -0,0 +1,6 @@
+
+# This file will contain the plugin configuration
+# from kss version 1.4. In the current version
+# you need to register your plugin from zcml,
+# and leave this file empty.
+
Modified: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/configure.zcml_tmpl
==============================================================================
--- kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/configure.zcml_tmpl (original)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/configure.zcml_tmpl Tue Sep 25 10:10:30 2007
@@ -4,25 +4,26 @@
xmlns:zcml="http://namespaces.zope.org/zcml"
>
+ <!-- Including this configuration
+ will activate this plugin inside zope.
+ -->
+
+ <!-- Include demo setup conditionally -->
+ <include zcml:condition="installed kss.demo" package=".demo" />
+
<!-- Third party library dependencies -->
<!--
<browser:resource
- file="3rd_party/prototype.js"
- name="prototype.js"
- />
-
- <browser:resource
- file="3rd_party/effects.js"
- name="effects.js"
+ file="browser/any_other.js"
+ name="any_other.js"
/>
-->
-
<!-- Event types -->
<!--
<kss:eventtype
name="myCustomEventType"
- jsfile="browser/my_plugins.js"
+ jsfile="javascript/plugin.js"
/>
-->
@@ -30,8 +31,8 @@
<!--
<kss:action
name="myCustomAction"
- jsfile="browser/my_plugins.js"
- command_factory="selector/global"
+ jsfile="javascript/plugins.js"
+ command_factory="selector _OR_ global"
params_mandatory="param1 param2 ... paramN"
params_optional=""
/>
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/configure.zcml_tmpl
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/configure.zcml_tmpl Tue Sep 25 10:10:30 2007
@@ -0,0 +1,41 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:kss="http://namespaces.zope.org/kss"
+ i18n_domain="kss"
+ >
+
+ <!--
+ Set up the demos
+ -->
+
+ <!-- Set up the demo utility, needed for registration -->
+ <utility
+ factory=".zopeconfig.KSSDemos"
+ provides="kss.demo.interfaces.IKSSDemoResource"
+ permission="zope.Public"
+ />
+
+ <!-- Set up resources needed for the demo -->
+ <browser:page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="my_demo.pt"
+ name="my_demo.html"
+ permission="zope.View"
+ />
+
+ <browser:resource
+ file="my_demo.kss"
+ name="my_demo.kss"
+ />
+
+ <!-- Set up server actions needed for the demo -->
+ <browser:page
+ for="kss.demo.interfaces.ISimpleContent"
+ class=".demoview.KSSDemoView"
+ attribute="myAction"
+ name="myAction"
+ permission="zope.View"
+ />
+
+</configure>
+
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/demoview.py_templ
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/demoview.py_templ Tue Sep 25 10:10:30 2007
@@ -0,0 +1,11 @@
+from kss.core import KSSView, kssaction
+
+class KSSDemoView(KSSView):
+
+ # Create the server actions needed for your demo.
+ # Use the following method as example.
+ @kssaction
+ def myDemoAction(self):
+ """my demo action"""
+ # XXX replace this with what you need to do
+ self.getCommandSet('core').clearChildNodes('div#demo')
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/my_demo.kss_templ
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/my_demo.kss_templ Tue Sep 25 10:10:30 2007
@@ -0,0 +1,10 @@
+
+/* Set up kss rules needed for your demo.
+ * Use the following rule as an example only.
+ */
+
+div#exampleId:click {
+ action-server: myAction;
+ myAction-value: kssAttr(myattr);
+}
+
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/my_demo.pt_templ
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/my_demo.pt_templ Tue Sep 25 10:10:30 2007
@@ -0,0 +1,16 @@
+<html>
+ <head>
+ <link rel="kinetic-stylesheet" type="text/css"
+ tal:attributes="href string:${context/@@absolute_url}/++resource++my_demo.kss"/>
+ <metal:header use-macro="context/@@header_macros/header_resources" />
+ </head>
+ <body>
+ <p><a href=".">All demos</a></p>
+ <p><a href="./++resource++my_demo.kss">View KSS resource</a></p>
+
+ <h3>My demo</h3>
+ <div id="exampleId">
+ click me!
+ </div>
+ </body>
+</html>
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/selenium_tests/README.txt_templ
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/selenium_tests/README.txt_templ Tue Sep 25 10:10:30 2007
@@ -0,0 +1,4 @@
+
+Save sour selenium tests into this directory, in html format.
+All the tests ending with .html will be processed automatically.
+
Added: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/zopeconfig.py_tmpl
==============================================================================
--- (empty file)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/demo/zopeconfig.py_tmpl Tue Sep 25 10:10:30 2007
@@ -0,0 +1,35 @@
+
+from kss.demo.interfaces import (
+ IKSSDemoResource,
+ IKSSSeleniumTestResource,
+ )
+from kss.demo.resource import (
+ KSSDemo,
+ KSSSeleniumTestDirectory,
+ )
+from zope.interface import implements
+
+# Create a mesh of provided interfaces
+# This is needed, because an utility must have a single interface.
+class IResource(IKSSDemoResource, IKSSSeleniumTestResource):
+ pass
+
+# XXX you do not need to change anything above here
+# -------------------------------------------------
+
+class KSSDemos(object):
+ implements(IResource)
+
+ demos = (
+ # List your demos here.
+ # (Second parameter can be a subcategory within the demo if needed.)
+ KSSDemo('##NAMESPACE##', '', "my_demo.html", "My demo (change this title)"),
+
+ )
+
+ # directories are relative from the location of this .py file
+ selenium_tests = (
+ # if you only have one test directory, you
+ # need not change anything here.
+ KSSSeleniumTestDirectory('selenium_tests'),
+ )
Modified: kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/interfaces.py_tmpl
==============================================================================
--- kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/interfaces.py_tmpl (original)
+++ kukit/kss.templates/trunk/kss/templates/zope_plugin/+package+/interfaces.py_tmpl Tue Sep 25 10:10:30 2007
@@ -3,5 +3,5 @@
class I${package.capitalize()}Commands(Interface):
'''Documentation for your command set'''
- def yourAction(selector, data):
- '''Documentation on yourAction'''
+ def yourCommand(selector, data):
+ '''Documentation on yourCommand'''
More information about the Kukit-checkins
mailing list