devtools/test/data/cubes/i18ntestcube/views/primary.py
branchstable
changeset 9153 bc1b8e77d6ce
equal deleted inserted replaced
9152:b0155bfd4e17 9153:bc1b8e77d6ce
       
     1 # -*- coding: utf-8 -*-
       
     2 # copyright 2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
       
     3 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
       
     4 #
       
     5 # This program is free software: you can redistribute it and/or modify it under
       
     6 # the terms of the GNU Lesser General Public License as published by the Free
       
     7 # Software Foundation, either version 2.1 of the License, or (at your option)
       
     8 # any later version.
       
     9 #
       
    10 # This program is distributed in the hope that it will be useful, but WITHOUT
       
    11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
       
    12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
       
    13 # details.
       
    14 #
       
    15 # You should have received a copy of the GNU Lesser General Public License along
       
    16 # with this program. If not, see <http://www.gnu.org/licenses/>.
       
    17 
       
    18 """cubicweb-forum views/forms/actions/components for web ui"""
       
    19 
       
    20 from cubicweb.predicates import is_instance
       
    21 
       
    22 from cubicweb import view
       
    23 from cubicweb.web.views import primary, baseviews
       
    24 
       
    25 
       
    26 class ForumSameETypeListView(baseviews.SameETypeListView):
       
    27     __select__ = baseviews.SameETypeListView.__select__ & is_instance('Forum')
       
    28 
       
    29     def call(self, **kwargs):
       
    30         _ = self._cw._
       
    31         _('Topic'), _('Description')
       
    32         _('Number of threads'), _('Last activity')
       
    33         _('''a long
       
    34 tranlated line
       
    35 hop.''')
       
    36 
       
    37 
       
    38 class ForumLastActivity(view.EntityView):
       
    39     __regid__ = 'forum_last_activity'
       
    40     __select__ = view.EntityView.__select__ & is_instance('Forum')
       
    41 
       
    42 
       
    43 class ForumPrimaryView(primary.PrimaryView):
       
    44     __select__ = primary.PrimaryView.__select__ & is_instance('Forum')
       
    45 
       
    46     def render_entity_attributes(self, entity):
       
    47         _ = self._cw._
       
    48         _('Subject'), _('Created'), _('Answers'),
       
    49         _('Last answered')
       
    50         _('This forum does not have any thread yet.')
       
    51 
       
    52 class ForumThreadPrimaryView(primary.PrimaryView):
       
    53     __select__ = primary.PrimaryView.__select__ & is_instance('ForumThread')