@presentation.render_for(BoardWeights)
@presentation.render_for(BoardWeights, model='edit')
def render_boardweights_edit(self, h, comp, *args):
    """Render the weights configuration panel"""
    with h.div(class_='panel-section'):
        h << h.div(_(u'Weighting cards'), class_='panel-section-title')
        h << h.p(_(u'Activate cards weights'))
        with h.form:
            with h.div(class_='btn-group'):
                if self._changed():
                    h << h.script('reload_columns()')
                    self._changed(False)

                h << h.a(
                    _('Disabled'),
                    class_='btn %s' % (
                        'active btn-primary'
                        if self.board.weighting_cards == WEIGHTING_OFF
                        else ''
                    ),
                    onclick=(
                        "if (confirm(%(message)s)){%(action)s;}return false" %
                        {
                            'action': h.a.action(
                                self.deactivate_weighting
                            ).get('onclick'),
                            'message': ajax.py2js(
                                _(u'All affected weights will be reseted. Are you sure?')
                            ).decode('UTF-8')
                        }
                    )
                )

                h << h.button(
                    _('Free integer'),
                    class_='btn %s' % (
                        'active btn-primary'
                        if self.board.weighting_cards == WEIGHTING_FREE
                        else ''
                    ),
                    onclick=(
                        "if (confirm(%(message)s)){%(action)s;}return false" %
                        {
                            'action': h.a.action(
                                lambda: self.activate_weighting(WEIGHTING_FREE)
                            ).get('onclick'),
                            'message': ajax.py2js(
                                _(u'All affected weights will be reseted. Are you sure?')
                            ).decode('UTF-8')
                        }
                    ),
                    title=_('Card weights can be any integer')
                )

                h << h.button(
                    _('Integer sequence'),
                    class_='btn %s' % (
                        'active btn-primary'
                        if self.board.weighting_cards == WEIGHTING_LIST
                        else ''
                    ),
                    onclick=(
                        "if (confirm(%(message)s)){%(action)s;}return false" %
                        {
                            'action': h.a.action(
                                lambda: self.activate_weighting(WEIGHTING_LIST)
                            ).get('onclick'),
                            'message': ajax.py2js(
                                _(u'All affected weights will be reseted. Are you sure?')
                            ).decode('UTF-8')
                        }
                    ),
                    title=_('Choosen within a sequence of integers')
                )

        if self.board.weighting_cards == WEIGHTING_LIST:
            h << h.p(_('Enter a sequence of integers'))
            h << self._weights_editor

    return h.root
dataset/ETHPy150Open Net-ng/kansha/kansha/board/view.py/render_boardweights_edit/original