Commit 87b587ab authored by vincent.michel@logilab.fr's avatar vincent.michel@logilab.fr
Browse files

[views] Backport out of context views to brainomics cube, closes #3515026

parent 6aaff74de93f
......@@ -26,6 +26,9 @@ class GenomicMeasure(AnyEntity):
__regid__ = 'GenomicMeasure'
fetch_attrs, fetch_order = fetch_config(('type', 'format'))
def dc_title(self):
return u'%s (%s)' % (self._cw._('GenomicMeasure'), self.type)
@property
def image_url(self):
return self._cw.data_url('48x48/genetics.png')
......
# -*- coding: utf-8 -*-
# copyright 2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2013 CEA (Saclay, 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/>.
from cubicweb.view import AnyRsetView, EntityView
from cubicweb.selectors import is_instance
###############################################################################
### VIEWS #####################################################################
###############################################################################
class GenomicMeasureOutOfContextView(EntityView):
__regid__ = 'outofcontext'
__select__ = EntityView.__select__ & is_instance('GenomicMeasure')
def cell_call(self, row, col):
entity = self.cw_rset.get_entity(row, col)
self.w(u'<div class="thumbnail row">')
self.w(u'<div class="col-md-2">')
self.w(u'<img alt="" src="%s">' % entity.image_url)
self.w(u'</div>')
self.w(u'<div class="col-md-8">')
self.w(u'<h4><a href="%s">%s</a></h4>' % (entity.absolute_url(), entity.dc_title()))
self.w(u'<div class="row">')
self.w(u'Type <em>%s</em>' % entity.type)
self.w(u'</div>')
self.w(u'</div>')
self.w(u'</div>')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment