[views] Discard Study primary view. Provide uicfg Brainomics primary view customization instead (related to #3340591)
authorVladimir Popescu <vladimir.popescu@logilab.fr>
Mon, 20 Jan 2014 11:43:33 +0000
changeset 628 71919d38338f
parent 627 f8f9f52a327b
child 629 7ec6d3ca59b8
[views] Discard Study primary view. Provide uicfg Brainomics primary view customization instead (related to #3340591)
views/primary.py
views/uicfg.py
--- a/views/primary.py	Mon Jan 20 11:43:00 2014 +0000
+++ b/views/primary.py	Mon Jan 20 11:43:33 2014 +0000
@@ -101,33 +101,6 @@
                 tab.render(self.w)
         w(u'</div>')
 
-
-############################################################################
-### STUDY ##################################################################
-############################################################################
-class StudyPrimaryView(BrainomicsPrimaryView):
-    __select__ = BrainomicsPrimaryView.__select__ & is_instance('Study')
-
-    def render_entity_attributes(self, entity):
-        return [(self._cw._('Name'), entity.name),
-                (self._cw._('Description'), entity.description),
-                (self._cw._('Keywords'), entity.keywords),
-                (self._cw._('Themes'), ', '.join([t.dc_title() for t in entity.themes]))]
-
-    def iterate_data(self, entity):
-        data = []
-        # Subjects
-        rql = 'Any X WHERE X related_studies S, S eid %s' % entity.eid
-        data = self._build_data(data, rql, self._cw._('Subjects'))
-        # Measures
-        rset = self._cw.execute('Any M, COUNT(X) GROUPBY S, M WHERE X related_study S, '
-                                'S eid %s, X is E, E name M' % entity.eid)
-        for label, count in rset:
-            rql='Any X WHERE X is %s, X related_study S, S eid %s' % (label, entity.eid)
-            data = self._build_data(data, rql, self._cw._(label))
-        return data
-
-
 ###############################################################################
 ### INVESTIGATOR ##############################################################
 ###############################################################################
--- a/views/uicfg.py	Mon Jan 20 11:43:00 2014 +0000
+++ b/views/uicfg.py	Mon Jan 20 11:43:33 2014 +0000
@@ -43,3 +43,20 @@
 _pvdc.tag_object_of(('GenomicMeasure', 'concerns', 'Subject'),
                       {'vid': 'outofcontext',
                        'label': _('Measures')})
+
+
+###############################################################################
+### STUDY #####################################################################
+###############################################################################
+# Data filepath
+_pvs.tag_attribute(('Study', 'data_filepath'), 'hidden')
+# Themes
+_pvs.tag_subject_of(('Study', 'themes', 'Theme'), 'attributes')
+# Related studies / Subject
+_pvs.tag_object_of(('Subject', 'related_studies', 'Study'), 'relations')
+_pvdc.tag_object_of(('Subject', 'related_studies', 'Study'),
+                    {'label': _('Subjects'), 'vid': 'outofcontext'})
+# Related study / Subject
+_pvs.tag_object_of(('Subject', 'related_study', 'Study'), 'relations')
+_pvdc.tag_object_of(('Subject', 'related_study', 'Study'),
+                    {'label': _('Measures'), 'vid': 'outofcontext'})