[card] Add cards for modifiable contents
authorVincent Michel <vincent.michel@logilab.fr>
Fri, 11 Jan 2013 09:15:07 +0100
changeset 29 cdb83802f32b
parent 28 97972227a016
child 30 1204303d90bf
[card] Add cards for modifiable contents
__pkginfo__.py
migration/postcreate.py
views/startup.py
--- a/__pkginfo__.py	Thu Jan 10 16:41:06 2013 +0100
+++ b/__pkginfo__.py	Fri Jan 11 09:15:07 2013 +0100
@@ -19,6 +19,7 @@
                 'cubicweb-genomics': None,
                 'cubicweb-medicalexp': None,
                 'cubicweb-orbui': None,
+                'cubicweb-card': None,
                 ## XXX No simplefacet for now
                 ##'cubicweb-simplefacet': None,
                 }
--- a/migration/postcreate.py	Thu Jan 10 16:41:06 2013 +0100
+++ b/migration/postcreate.py	Fri Jan 11 09:15:07 2013 +0100
@@ -22,3 +22,32 @@
 """
 
 set_property('ui.site-title', 'Brainomics Localizer')
+
+# Create cards
+create_entity('Card', content_format=u'text/html', title=u'index',
+              content=u"""<div class="page-header"><h1>What is it?<small> And who are we?</small></h1></div>
+              <p>The BRAINOMICS project is one of the projects chosen by the Agence nationale de la recherche (ANR) in the bioinformatics call of the Investissements d'avenir program. This website is a demonstration of the project based on the Localizer data (courtesy of P. Pinel, S. Dehaene, T. Bourgeron and D. Lebihan) and allows complex query and various visualization of the data.
+This demo is for now only accessible on the Neurospin network.</p>
+<p>This prototype was developed by V. Michel, Y. Schwartz, D. Papadopoulos and V. Frouin</p>
+<p><span class="badge badge-important">Important: This website is still a demo. Be kind (and comments welcome :))!</span></p>
+<p> <strong>Feel free to play with it (use the RQL input bar at the top of the page)!</strong></p>""")
+
+create_entity('Card', content_format=u'text/html', title=u'rqlexamples',
+              content=u'''<ul>
+              <li>Query all the subjects of the database
+              <pre>Any S WHERE S is Subject</pre></li>
+              <li>Query all the subjects of the database, with an age greater than 30
+              <pre>Any S WHERE S is Subject, S age > 30</pre></li>
+              <li>Query all the subjects of the database, with an age greater than 30, and that are female
+              <pre>Any S WHERE S is Subject, S age > 30, S gender "female"</pre></li>
+              <li>Query all the scans of subjects with an age greater than 30
+              <pre>Any X WHERE S is Subject, S age > 30, X is Scan, X concerns S</pre></li>
+              <li>Query all subjects with an age greater than 25, and that have a score greater than 4.O for the "algebre" question of the Localizer questionnary (Question number 2), and return both subject identifier and score
+              <pre>Any I,V WHERE S is Subject, S identifier I, S age > 25, X is QuestionnaireRun, X concerns S, A is Answer, A questionnaire_run X, A question Q, Q text "algebre", A value V, A value > 4</pre></li>
+              <li>Query all the Cmap scans of subjects with an age greater than 25, and that have a score greater than 4.O for the "algebre" question of the Localizer questionnary (Question number 2)
+              <pre>Any SA WHERE S is Subject, S age > 25, X is QuestionnaireRun, X concerns S, A is Answer,
+              A questionnaire_run X, A question Q, Q text "algebre", A value > 4, SA is Scan, SA concerns S, SA type "c map"</pre></li>
+              <li>Query all the Tmap scans for the "auditory calculation" contrast of subjects along with their Genomics data, when we have acquired data for Snps on the gene "CFB":
+              <pre>Any S,SCF,FGEN WHERE S is Subject, SC is Scan, SC type "t map", SC label "auditory calculation", SC concerns S, SC filepath SCF, GEN is GenomicMeasure, GEN filepath FGEN, GEN concerns S, GEN platform P, P related_snps SN, G is Gene, G name "CFB", G start_position GSA, G stop_position GSO, SN position SP HAVING SP > GSA, SP &lt; GSO</pre></li>
+              </ul>
+              <p> <strong>You want more !!!??? Go to the <a href="%s">schema page to see the structure of the data !</a></strong></p>'''% session.build_url('schema'))
--- a/views/startup.py	Thu Jan 10 16:41:06 2013 +0100
+++ b/views/startup.py	Fri Jan 11 09:15:07 2013 +0100
@@ -48,39 +48,10 @@
         self.w(u'</div>')
         self.w(u'<div class="span12">')
         self.w(u'<div class="row-fluid">')
-        self.w(u'<div class="page-header"><h1>%s<small>%s</small></h1></div>'
-               % (self._cw._('What is it?'), self._cw._(' And who are we?')))
-        self.w(u"""<p>The BRAINOMICS project is one of the projects chosen by the Agence nationale de la recherche (ANR) in the bioinformatics call of the Investissements d'avenir program. This website is a demonstration of the project based on the Localizer data (courtesy of P. Pinel, S. Dehaene, T. Bourgeron and D. Lebihan) and allows complex query and various visualization of the data.
-This demo is for now only accessible on the Neurospin network.</p>
-<p>This prototype was developed by V. Michel, Y. Schwartz, D. Papadopoulos and V. Frouin</p>
-<p><span class="badge badge-important">Important: This website is still a demo. Be kind (and comments welcome :))!</span></p>
-<p> <strong>Feel free to play with it (use the RQL input bar at the top of the page)!</strong></p>
-""")
-        self.w(u'''<ul>
-<li>Query all the subjects of the database
-<pre>Any S WHERE S is Subject</pre></li>
-<li>Query all the subjects of the database, with an age greater than 30
-<pre>Any S WHERE S is Subject, S age > 30</pre></li>
-<li>Query all the subjects of the database, with an age greater than 30, and that are female
-<pre>Any S WHERE S is Subject, S age > 30, S gender "female"</pre></li>
-<li>Query all the scans of subjects with an age greater than 30
-<pre>Any X WHERE S is Subject, S age > 30, X is Scan, X concerns S</pre></li>
-<li>Query all subjects with an age greater than 25, and that have a score greater than 4.O for the "algebre" question
-of the Localizer questionnary (Question number 2), and return both subject identifier and score
-<pre>Any I,V WHERE S is Subject, S identifier I, S age > 25, X is QuestionnaireRun, X concerns S, A is Answer, 
-     A questionnaire_run X, A question Q, Q text "algebre", A value V, A value > 4</pre></li>
-<li>Query all the Cmap scans of subjects with an age greater than 25, and that have a score greater than 4.O for the "algebre" question
-of the Localizer questionnary (Question number 2)
-<pre>Any SA WHERE S is Subject, S age > 25, X is QuestionnaireRun, X concerns S, A is Answer, 
-     A questionnaire_run X, A question Q, Q text "algebre", A value > 4, SA is Scan, SA concerns S, SA type "c map"</pre></li>
-
-<li>Query all the Tmap scans for the "auditory calculation" contrast of subjects along with their Genomics data, when we have acquired data for Snps on the gene "CFB":
-<pre>Any S,SCF,FGEN WHERE S is Subject, SC is Scan, SC type "t map", SC label "auditory calculation", SC concerns S, 
-SC filepath SCF, GEN is GenomicMeasure, GEN filepath FGEN, GEN concerns S, GEN platform P, P related_snps SN, G is Gene, 
-G name "CFB", G start_position GSA, G stop_position GSO, SN position SP HAVING SP > GSA, SP < GSO</pre></li>
-</ul>''')
-        self.w(u'''<p> <strong>You want more !!!??? Go to the <a href="%s">schema page to see the structure of the data !</a></strong></p>'''
-% self._cw.build_url('schema'))
+        for title in ('index', 'rqlexamples'):
+            card = self._cw.execute('Any X WHERE X is Card, X title %(t)s', {'t': title})
+            if card:
+                self.w(card.get_entity(0,0).content)
         self.w(u'</div>')
         self.w(u'</div>')