Closed ramonski closed 3 months ago
This PR adds the ability to prepend/append text to common widgets in view/edit modes.
Additional text can be added by using directives.widget:
directives.widget
class IDepartmentSchema(model.Schema): """Schema interface """ directives.widget("title", before_text=">", before_css_class="text-secondary", after_text="<i class='fas fa-building'></i>", after_css_class="text-primary", wrapper_css_class="float-left mr-4") title = schema.TextLine( title=_( u"title_department_title", default=u"Name" ), description=_( u"description_department_title", default=u"Name of the department" ), required=True, ) # Department ID directives.widget("department_id", before_text_input="ID", before_css_input="text-secondary", widget_css_display="text-primary text-monospace", widget_css_input="text-primary text-monospace", after_text_input="<i class='fas fa-id-card'></i>", after_css_input="text-primary") department_id = schema.TextLine( title=_( u"title_department_id", default=u"Department ID" ), description=_( u"description_department_id", default=u"Please provide a unique department identifier" ), required=True, )
Only plain widget rendering possible
Widgets can render with additional text before and after.
-- I confirm I have tested this PR thoroughly and coded it according to PEP8 and Plone's Python styleguide standards.
Description of the issue/feature this PR addresses
This PR adds the ability to prepend/append text to common widgets in view/edit modes.
Additional text can be added by using
directives.widget
:Current behavior before PR
Only plain widget rendering possible
Desired behavior after PR is merged
Widgets can render with additional text before and after.
-- I confirm I have tested this PR thoroughly and coded it according to PEP8 and Plone's Python styleguide standards.