Commit 6aa98c0c authored by vincent.michel@logilab.fr's avatar vincent.michel@logilab.fr
Browse files

[views] Add facets

parent 9dd44a239d48
......@@ -16,3 +16,102 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-accidents views/forms/actions/components for web ui"""
from cubicweb.web import facet
from cubicweb.selectors import is_instance
# Facets - Vehicules
class VehiculeMiseCirculationFacet(facet.DateRangeFacet):
__regid__ = 'vehicules.misecirculation'
__select__ = is_instance('Vehicule')
rtype = 'mise_circulation'
class VehiculeAssuranceFacet(facet.AttributeFacet):
__regid__ = 'vehicules.assurance'
__select__ = is_instance('Vehicule')
rtype = 'assurance'
class VehiculePresentationAssuranceFacet(facet.AttributeFacet):
__regid__ = 'vehicules.presentationassurance'
__select__ = is_instance('Vehicule')
rtype = 'presentation_assurance'
class VehiculeTuesFacet(facet.RangeFacet):
__regid__ = 'vehicules.tues'
__select__ = is_instance('Vehicule')
rtype = 'nb_tues'
class VehiculeHospitalisesFacet(facet.RangeFacet):
__regid__ = 'vehicules.hospitalises'
__select__ = is_instance('Vehicule')
rtype = 'nb_hospitalises'
class VehiculeBlessesFacet(facet.RangeFacet):
__regid__ = 'vehicules.blesses'
__select__ = is_instance('Vehicule')
rtype = 'nb_blesses'
class VehiculeIndemnesFacet(facet.RangeFacet):
__regid__ = 'vehicules.indemnes'
__select__ = is_instance('Vehicule')
rtype = 'nb_indemnes'
# Facets - Accident
class AccidentTuesFacet(facet.RangeFacet):
__regid__ = 'accidents.tues'
__select__ = is_instance('Accident')
rtype = 'nb_tues'
class AccidentHospitalisesFacet(facet.RangeFacet):
__regid__ = 'accidents.hospitalises'
__select__ = is_instance('Accident')
rtype = 'nb_hospitalises'
class AccidentBlessesFacet(facet.RangeFacet):
__regid__ = 'accidents.blesses'
__select__ = is_instance('Accident')
rtype = 'nb_blesses'
class AccidentIndemnesFacet(facet.RangeFacet):
__regid__ = 'accidents.indemnes'
__select__ = is_instance('Accident')
rtype = 'nb_indemnes'
class AccidentDistanceFacet(facet.RangeFacet):
__regid__ = 'accidents.distance'
__select__ = is_instance('Accident')
rtype = 'distance'
class AccidentGraviteFacet(facet.RangeFacet):
__regid__ = 'accidents.gravite'
__select__ = is_instance('Accident')
rtype = 'gravite'
class AccidentOrganismeFacet(facet.RelationFacet):
__regid__ = 'accidents.organisme'
__select__ = is_instance('Accident')
rtype = 'organisme'
target_attr = 'nom'
class AccidentMeteoFacet(facet.RelationFacet):
__regid__ = 'accidents.meteo'
__select__ = is_instance('Accident')
rtype = 'meteo'
target_attr = 'nom'
class AccidentAppartenanceFacet(facet.RQLPathFacet):
__regid__ = 'accidents.appartenance'
__select__ = is_instance('Accident')
path = ['X implique A', 'A appartenance AP', 'AP nom N']
filter_variable = 'AP'
label_variable = 'N'
title = 'Appartenance'
class AccidentAffectationFacet(facet.RQLPathFacet):
__regid__ = 'accidents.affectation'
__select__ = is_instance('Accident')
path = ['X implique A', 'A affectation AP', 'AP nom N']
filter_variable = 'AP'
label_variable = 'N'
title = 'Affectation'
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