web/views/facets.py
changeset 3377 dd9d292b6a6d
parent 3023 7864fee8b4ec
child 3451 6b46d73823f5
equal deleted inserted replaced
3376:f5c69485381f 3377:dd9d292b6a6d
    27     return 0
    27     return 0
    28 
    28 
    29 
    29 
    30 class FilterBox(BoxTemplate):
    30 class FilterBox(BoxTemplate):
    31     """filter results of a query"""
    31     """filter results of a query"""
    32     id = 'filter_box'
    32     __regid__ = 'filter_box'
    33     __select__ = (((non_final_entity() & two_lines_rset())
    33     __select__ = (((non_final_entity() & two_lines_rset())
    34                    | contextview_selector()
    34                    | contextview_selector()
    35                    ) & match_context_prop())
    35                    ) & match_context_prop())
    36     context = 'left'
    36     context = 'left'
    37     title = _('boxes_filter_box')
    37     title = _('boxes_filter_box')
   123                                                         filtered_variable=mainvar)
   123                                                         filtered_variable=mainvar)
   124 
   124 
   125 # facets ######################################################################
   125 # facets ######################################################################
   126 
   126 
   127 class CreatedByFacet(RelationFacet):
   127 class CreatedByFacet(RelationFacet):
   128     id = 'created_by-facet'
   128     __regid__ = 'created_by-facet'
   129     rtype = 'created_by'
   129     rtype = 'created_by'
   130     target_attr = 'login'
   130     target_attr = 'login'
   131 
   131 
   132 class InGroupFacet(RelationFacet):
   132 class InGroupFacet(RelationFacet):
   133     id = 'in_group-facet'
   133     __regid__ = 'in_group-facet'
   134     rtype = 'in_group'
   134     rtype = 'in_group'
   135     target_attr = 'name'
   135     target_attr = 'name'
   136 
   136 
   137 class InStateFacet(RelationFacet):
   137 class InStateFacet(RelationFacet):
   138     id = 'in_state-facet'
   138     __regid__ = 'in_state-facet'
   139     rtype = 'in_state'
   139     rtype = 'in_state'
   140     target_attr = 'name'
   140     target_attr = 'name'
   141 
   141 
   142 # inherit from RelationFacet to benefit from its possible_values implementation
   142 # inherit from RelationFacet to benefit from its possible_values implementation
   143 class ETypeFacet(RelationFacet):
   143 class ETypeFacet(RelationFacet):
   144     id = 'etype-facet'
   144     __regid__ = 'etype-facet'
   145     __select__ = yes()
   145     __select__ = yes()
   146     order = 1
   146     order = 1
   147     rtype = 'is'
   147     rtype = 'is'
   148     target_attr = 'name'
   148     target_attr = 'name'
   149 
   149 
   180         finally:
   180         finally:
   181             rqlst.recover()
   181             rqlst.recover()
   182 
   182 
   183 class HasTextFacet(AbstractFacet):
   183 class HasTextFacet(AbstractFacet):
   184     __select__ = relation_possible('has_text', 'subject') & match_context_prop()
   184     __select__ = relation_possible('has_text', 'subject') & match_context_prop()
   185     id = 'has_text-facet'
   185     __regid__ = 'has_text-facet'
   186     rtype = 'has_text'
   186     rtype = 'has_text'
   187     role = 'subject'
   187     role = 'subject'
   188     order = 0
   188     order = 0
   189     @property
   189     @property
   190     def title(self):
   190     def title(self):