Commits

CreaLibre committed 25a849d

First index page and hide.css to hide the left nav column at index

  • Participants
  • Parent commits c084713

Comments (0)

Files changed (5)

data/cubes.pytimaster.css

     font-size:81%;
 }
 
+
+div#page{
+    background:#fff;
+}
+
 div#pageContent div#contentmain {
     min-height:24em;
 }
 
 
 
+
+
+
+
+
+
+
+/*----INDEX -----*/
+
+#logo_typi{
+float:left;
+width:500px;
+height:500px;
+background:url('logo_1.png') no-repeat;
+}
+
+#index_top{
+float:right;
+width:40%;
+margin-top:1.5em;
+}
+
+#index_content{
+float:right;
+width:40%;
+margin-top:1.5em;
+}
+
+
+
+
+#navColumnLeft
+{
+display:none;
+}

views/__init__.py

+# copyright 2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr -- mailto:contact@logilab.fr
+# -*- coding: utf-8 -*-
+# copyright 2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr -- mailto:contact@logilab.fr
+
+"""cubicweb-logilabfr views/forms/actions/components for web ui"""
+
+from cubicweb.web.views import startup
+
+
+class PytiMasterIndexView(startup.ManageView):
+    """Pyti Master index for public home page
+    """
+    __regid__ = 'index'
+    title = _('Index')
+
+    def call(self):
+        """front page / index view
+        """
+        if self._cw.user.is_anonymous():
+            self.display_page()
+            self.display_test()
+            self.display_content()
+        else:
+            super(PytiMasterIndexView, self).call()
+
+    def display_page(self):
+        """Page
+        """
+        self._cw.add_css('hide.css')
+        self.w(u'<div id="logo_typi">')
+        self.w(u'</div>')
+        self.w(u'<div id="index_top">')
+        self.w(u'<h1>The python testing infrastructure</h1>')        
+        self.w(u'<h3>The python testing infrastructure is a Continuous Integration tool able to test python distributions availabe at PyPI against a set of tests, providing a set of metrics.</h3>')   
+        self.w(u'</div>')
+
+       
+
+    def display_test(self):
+        """calls news-mini-view to show last n publish test.
+        """
+        #rql = ('Any TE,PR,V,PY,ST WHERE TE is ExecutionTarget, '
+        #       'TE for_project_version V, V version_of PR, '
+        #       'TE for_python_version PY, TE in_state ST ')
+        #rset = self._cw.execute(rql)
+        #self.wview('displaytest', rset, 'null')
+
+    def display_content(self):
+        """call the card with the wikiid = index
+        """
+        #rql = ('Any C WHERE C is Card, C wikiid %(wikiid)s')
+        #rset = self._cw.execute(rql, {'wikiid': 'index'})
+        self.w(u'<div id="index_content">')
+        #self.wview('primary', rset, 'null')
+        self.w(u'<h1>The python testing infrastructure</h1>')        
+        self.w(u'<h3>The python testing infrastructure is a Continuous Integration tool able to test python distributions availabe at PyPI against a set of tests, providing a set of metrics.</h3>')   
+        self.w(u'</div>')
+
+
+
+
+
+# replace IndexView
+def registration_callback(vreg):
+    """replace original index view for Logilab's
+    """
+    vreg.register_all(globals().values(), __name__, (PytiMasterIndexView,))
+    vreg.register_and_replace(PytiMasterIndexView, startup.IndexView)
+# copyright 2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr -- mailto:contact@logilab.fr
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""cubicweb-pytimaster views/forms/actions/components for web ui"""
+
+import json
+
+from cubicweb.web.views.baseviews import EntityView # XXX wrong import
+from cubicweb.web.views.urlrewrite import SimpleReqRewriter
+
+
+class ETJsonViews(EntityView):
+
+    __regid__ = "json"
+    templatable = False
+    content_type = 'text/json'
+
+
+
+    def call(self):
+        root = []
+        for et in self.rset.entities(): # XXX use cell_Call logic)
+            root.append({
+                    'target-id': et.target_id,
+                    'project-name': et.project.name,
+                    'project-version': et.project_version.num,
+                    'platform': 'linux-debian',
+                    'platform-variant': 'vanillia',
+                    'python-version': et.python_version.name,
+                })
+        self.w(unicode(json.dumps(root, indent=True))) # XXX unicode should ne be required
+
+
+class SlaveAPIRewriter(SimpleReqRewriter):
+
+    rules = [
+            ('/list', dict(rql=r'Any X WHERE X is ExecutionTarget', vid='json'))
+            ]
+
+