cubicweb/web/views/uicfg.py
changeset 11932 7b2247098f58
parent 11854 056de1196ef8
child 12210 3fa6c9ef2f51
equal deleted inserted replaced
11931:ad7796dabeaa 11932:7b2247098f58
    89                 else:
    89                 else:
    90                     section = 'sideboxes'
    90                     section = 'sideboxes'
    91             self.tag_relation((sschema, rschema, oschema, role), section)
    91             self.tag_relation((sschema, rschema, oschema, role), section)
    92 
    92 
    93 
    93 
    94 primaryview_section = PrimaryViewSectionRelationTags()
    94 primaryview_section = PrimaryViewSectionRelationTags(__module__=__name__)
    95 
    95 
    96 
    96 
    97 class DisplayCtrlRelationTags(NoTargetRelationTagsDict):
    97 class DisplayCtrlRelationTags(NoTargetRelationTagsDict):
    98     """primary view display controller configuration"""
    98     """primary view display controller configuration"""
    99     __regid__ = 'primaryview_display_ctrl'
    99     __regid__ = 'primaryview_display_ctrl'
   140                 self.tag_subject_of((etype, rtype, '*'), {'order': index})
   140                 self.tag_subject_of((etype, rtype, '*'), {'order': index})
   141             else:
   141             else:
   142                 self.tag_object_of(('*', rtype, etype), {'order': index})
   142                 self.tag_object_of(('*', rtype, etype), {'order': index})
   143 
   143 
   144 
   144 
   145 primaryview_display_ctrl = DisplayCtrlRelationTags()
   145 primaryview_display_ctrl = DisplayCtrlRelationTags(__module__=__name__)
   146 
   146 
   147 
   147 
   148 # index view configuration ####################################################
   148 # index view configuration ####################################################
   149 # entity type section in the index/manage page. May be one of
   149 # entity type section in the index/manage page. May be one of
   150 # * 'application'
   150 # * 'application'
   483         """
   483         """
   484         for attr in attrs:
   484         for attr in attrs:
   485             self.edit_as_attr(self, etype, attr, formtype='muledit')
   485             self.edit_as_attr(self, etype, attr, formtype='muledit')
   486 
   486 
   487 
   487 
   488 autoform_section = AutoformSectionRelationTags()
   488 autoform_section = AutoformSectionRelationTags(__module__=__name__)
   489 
   489 
   490 
   490 
   491 # relations'field class
   491 # relations'field class
   492 
   492 
   493 class AutoformFieldTags(RelationTags):
   493 class AutoformFieldTags(RelationTags):
   503 
   503 
   504         """
   504         """
   505         self._tag_etype_attr(etype, attr, '*', field)
   505         self._tag_etype_attr(etype, attr, '*', field)
   506 
   506 
   507 
   507 
   508 autoform_field = AutoformFieldTags()
   508 autoform_field = AutoformFieldTags(__module__=__name__)
   509 
   509 
   510 
   510 
   511 # relations'field explicit kwargs (given to field's __init__)
   511 # relations'field explicit kwargs (given to field's __init__)
   512 
   512 
   513 class AutoformFieldKwargsTags(RelationTagsDict):
   513 class AutoformFieldKwargsTags(RelationTagsDict):
   555                                 widget=fwdgs.TextInput(attrs={'size': 30}))
   555                                 widget=fwdgs.TextInput(attrs={'size': 30}))
   556         """
   556         """
   557         self._tag_etype_attr(etype, attr, '*', kwargs)
   557         self._tag_etype_attr(etype, attr, '*', kwargs)
   558 
   558 
   559 
   559 
   560 autoform_field_kwargs = AutoformFieldKwargsTags()
   560 autoform_field_kwargs = AutoformFieldKwargsTags(__module__=__name__)
   561 
   561 
   562 
   562 
   563 # set of tags of the form <action>_on_new on relations. <action> is a
   563 # set of tags of the form <action>_on_new on relations. <action> is a
   564 # schema action (add/update/delete/read), and when such a tag is found
   564 # schema action (add/update/delete/read), and when such a tag is found
   565 # permissions checking is by-passed and supposed to be ok
   565 # permissions checking is by-passed and supposed to be ok
   566 class AutoFormPermissionsOverrides(RelationTagsSet):
   566 class AutoFormPermissionsOverrides(RelationTagsSet):
   567     __regid__ = 'autoform_permissions_overrides'
   567     __regid__ = 'autoform_permissions_overrides'
   568 
   568 
   569 
   569 
   570 autoform_permissions_overrides = AutoFormPermissionsOverrides()
   570 autoform_permissions_overrides = AutoFormPermissionsOverrides(__module__=__name__)
   571 
   571 
   572 
   572 
   573 class ReleditTags(NoTargetRelationTagsDict):
   573 class ReleditTags(NoTargetRelationTagsDict):
   574     """Associate to relation a dictionary to control `reledit` (e.g. edition of
   574     """Associate to relation a dictionary to control `reledit` (e.g. edition of
   575     attributes / relations from within views).
   575     attributes / relations from within views).
   627                 sschema, rschema, oschema, role).get('showlabel', True)
   627                 sschema, rschema, oschema, role).get('showlabel', True)
   628             self.tag_relation((sschema, rschema, oschema, role),
   628             self.tag_relation((sschema, rschema, oschema, role),
   629                               {'novalue_include_rtype': not showlabel})
   629                               {'novalue_include_rtype': not showlabel})
   630 
   630 
   631 
   631 
   632 reledit_ctrl = ReleditTags()
   632 reledit_ctrl = ReleditTags(__module__=__name__)
   633 
   633 
   634 
   634 
   635 # boxes.EditBox configuration #################################################
   635 # boxes.EditBox configuration #################################################
   636 
   636 
   637 # 'link' / 'create' relation tags, used to control the "add entity" submenu
   637 # 'link' / 'create' relation tags, used to control the "add entity" submenu
   682         `attr` can be a string or 2-tuple (relname, role_of_etype_in_the_relation)
   682         `attr` can be a string or 2-tuple (relname, role_of_etype_in_the_relation)
   683         """
   683         """
   684         self._tag_etype_attr(etype, attr, createdtype, False)
   684         self._tag_etype_attr(etype, attr, createdtype, False)
   685 
   685 
   686 
   686 
   687 actionbox_appearsin_addmenu = ActionBoxUicfg()
   687 actionbox_appearsin_addmenu = ActionBoxUicfg(__module__=__name__)
   688 
   688 
   689 
   689 
   690 def registration_callback(vreg):
   690 def registration_callback(vreg):
   691     vreg.register_all(globals().values(), __name__)
   691     vreg.register_all(globals().values(), __name__)
   692     indexview_etype_section.init(vreg.schema)
   692     indexview_etype_section.init(vreg.schema)