コード例 #1
0
ファイル: _model.py プロジェクト: pytsite/plugin-menu
    def odm_ui_m_form_setup_widgets(self, frm: form.Form):
        super().odm_ui_m_form_setup_widgets(frm)

        if frm.has_widget('order'):
            frm.remove_widget('order')

        if self.has_field('enabled'):
            frm.add_widget(
                widget.select.Checkbox(
                    uid='enabled',
                    weight=10,
                    label=self.t('enabled'),
                    value=self.enabled,
                ))

        if self.has_field('new_window'):
            frm.add_widget(
                widget.select.Checkbox(
                    uid='new_window',
                    weight=20,
                    label=self.t('new_window'),
                    value=self.new_window,
                ))

        if self.has_field('path'):
            frm.add_widget(
                widget.input.Text(
                    uid='path',
                    weight=210,
                    label=self.t('path'),
                    required=self.get_field('path').is_required,
                    value=self.path,
                ))

        if self.has_field('icon'):
            frm.add_widget(
                widget.input.Text(
                    uid='icon',
                    weight=220,
                    label=self.t('icon'),
                    required=self.get_field('icon').is_required,
                    h_size='col-12 col-xs-12 col-sm-3 col-md-2 col-lg-1',
                    value=self.icon,
                ))
コード例 #2
0
    def odm_ui_m_form_setup_widgets(self, frm: form.Form):
        super().odm_ui_m_form_setup_widgets(frm)

        if frm.has_widget('_parent'):
            frm.remove_widget('_parent')

        frm.add_widget(
            widget.select.Checkbox(
                uid='is_container',
                weight=25,
                label=self.t('is_container'),
                value=self.is_container,
            ))

        frm.add_widget(
            content.widget.EntitySelect(
                uid='entity',
                weight=150,
                label=self.t('content'),
                required=self.get_field('entity').is_required,
                value=self.entity,
            ))