[Kimchi-devel] [PATCH] Add Minimal UI Page for the Sample Plugin

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Thu Mar 13 06:20:04 UTC 2014


From: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>

Add minimal UI just enough to re-produce issue 342 and 343.

https://github.com/kimchi-project/kimchi/issues/342
https://github.com/kimchi-project/kimchi/issues/343

Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
---
 plugins/sample/__init__.py             |  3 ++-
 plugins/sample/sample.conf             |  5 +++++
 plugins/sample/ui/config/tab-ext.xml   |  9 +++++----
 plugins/sample/ui/pages/i18n.html.tmpl | 13 +++++++++++++
 plugins/sample/ui/pages/tab.html.tmpl  |  6 ++++++
 5 files changed, 31 insertions(+), 5 deletions(-)
 create mode 100644 plugins/sample/ui/pages/i18n.html.tmpl
 create mode 100644 plugins/sample/ui/pages/tab.html.tmpl

diff --git a/plugins/sample/__init__.py b/plugins/sample/__init__.py
index 3183898..2101aed 100644
--- a/plugins/sample/__init__.py
+++ b/plugins/sample/__init__.py
@@ -26,6 +26,7 @@ from cherrypy import expose
 
 from kimchi.config import PluginPaths
 from kimchi.control.base import Collection, Resource
+from kimchi.root import Root
 from plugins.sample.i18n import messages
 from plugins.sample.model import Model
 
@@ -33,7 +34,7 @@ from plugins.sample.model import Model
 model = Model()
 
 
-class Drawings(Resource):
+class Drawings(Root):
     def __init__(self):
         Resource.__init__(self, model)
         self.description = Description(model)
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf
index c4e80f7..78a9f4e 100644
--- a/plugins/sample/sample.conf
+++ b/plugins/sample/sample.conf
@@ -5,3 +5,8 @@ uri = "/plugins/sample"
 
 [/]
 tools.trailing_slash.on = False
+tools.sessions.on = True
+tools.sessions.name = 'kimchi'
+tools.sessions.httponly = True
+tools.sessions.locking = 'explicit'
+tools.sessions.storage_type = 'ram'
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml
index 948fa07..b98c126 100644
--- a/plugins/sample/ui/config/tab-ext.xml
+++ b/plugins/sample/ui/config/tab-ext.xml
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!--<tabs-ext>
+<tabs-ext>
     <tab>
-        <title>Test</title>
-        <filePath>plugins/sample/ui/tab.html</filePath>
+        <title>SampleTab</title>
+        <path>plugins/sample/tab.html</path>
+        <nls>plugins/sample/i18n.html</nls>
     </tab>
-</tabs-ext>-->
\ No newline at end of file
+</tabs-ext>
diff --git a/plugins/sample/ui/pages/i18n.html.tmpl b/plugins/sample/ui/pages/i18n.html.tmpl
new file mode 100644
index 0000000..04f32dd
--- /dev/null
+++ b/plugins/sample/ui/pages/i18n.html.tmpl
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="no-js" lang=$lang.lang[0]>
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <title>language</title>
+</head>
+<body>
+<script>
+i18n["SampleTab"] = "SampleTab";
+</script>
+</body>
+</html>
diff --git a/plugins/sample/ui/pages/tab.html.tmpl b/plugins/sample/ui/pages/tab.html.tmpl
new file mode 100644
index 0000000..49fc4ec
--- /dev/null
+++ b/plugins/sample/ui/pages/tab.html.tmpl
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+Hello, world
+</body>
+</html>
-- 
1.8.5.3




More information about the Kimchi-devel mailing list