How to use the mithril.withAttr function in mithril

To help you get started, we’ve selected a few mithril examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tivac / crucible / types / number-edit.js View on Github external
})
                )
            ),
            m("li",
                m("label",
                    m("input[type=checkbox]", {
                        onclick : m.withAttr("checked", update.bind(null, options.ref, "attrs/disabled")),
                        checked : details.attrs.disabled || false
                    }),
                    " Disabled"
                )
            ),
            m("li",
                m("label",
                    m("input[type=checkbox]", {
                        onclick : m.withAttr("checked", update.bind(null, options.ref, "attrs/readonly")),
                        checked : details.attrs.readonly || false
                    }),
                    " Read-Only"
                )
            )
        );
    }
};
github catarse / catarse.js / legacy / src / c / project-announce-expiration.js View on Github external
'Em quantos dias, contados a partir de agora, você quer encerrar a sua arrecadação?',
                                                m('br'),
                                                m('span.fontsize-smaller.fontweight-semibold',
                                                    '(mínimo de 2 dias)'
                                                )
                                            ])
                                        ),
                                        m('.w-col.w-col-6',
                                            m('.w-row', [
                                                m('.w-col.w-col-8.w-col-small-6.w-col-tiny-6',

                                                    m("input.numeric.numeric.optional.w-input.text-field.positive.medium[id='flexible_project_online_days'][step='any'][type='number']",
                                                        {
                                                            name: 'flexible_project[online_days]',
                                                            value: days(),
                                                            onchange: m.withAttr('value', ctrl.days)
                                                        }
                                                    )

                                                ),
                                                m('.medium.no-hover.postfix.prefix-permalink.text-field.w-col.w-col-4.w-col-small-6.w-col-tiny-6',
                                                    m('.fontcolor-secondary.fontsize-base.lineheight-tightest.u-text-center',
                                                        'Dias'
                                                    )
                                                )
                                            ])
                                        )
                                    ]),
                                    m('.fontcolor-secondary.u-text-center', [
                                        m('.fontsize-smaller',
                                            'Você poderá receber apoios até:'
                                        ),
github catarse / catarse.js / legacy / src / root / projects-reward.js View on Github external
[
                                                            m('.w-col.w-col-8.w-col-small-8.w-col-tiny-8.w-sub-col-middle.w-clearfix',
                                                                [
                                                                    m('.w-row',
                                                                        [
                                                                            m('.w-col.w-col-3.w-col-small-3.w-col-tiny-3',
                                                                                            m('.back-reward-input-reward.placeholder',
                                                                                                'R$'
                                                                                            )
                                                                                        ),
                                                                            m('.w-col.w-col-9.w-col-small-9.w-col-tiny-9',
                                                                                            m('input.user-reward-value.back-reward-input-reward[autocomplete=\'off\'][type=\'tel\']', {
                                                                                                class: ctrl.error() ? 'error' : '',
                                                                                                min: monetaryMinimum,
                                                                                                placeholder: monetaryMinimum,
                                                                                                onkeyup: m.withAttr('value', ctrl.applyMask),
                                                                                                value: ctrl.contributionValue()
                                                                                            }
                                                                                            )
                                                                                        )
                                                                        ]
                                                                                ),
                                                                    ctrl.error().length > 0 ? m('.text-error', [
                                                                        m('br'),
                                                                        m('span.fa.fa-exclamation-triangle'),
                                                                        ` ${ctrl.error()}`
                                                                    ]) : ''
                                                                ]
                                                                        ),
                                                            m('.submit-form.w-col.w-col-4.w-col-small-4.w-col-tiny-4',
                                                                            m('button.btn.btn-large', [
                                                                                'Continuar  ',
github catarse / catarse.js / legacy / src / root / sub-project-new.js View on Github external
onchange: (e) => {
                                            m.withAttr('value', ctrl.projectCategory)(e);
                                        }
                                    }, [
github catarse / catarse / catarse.js / legacy / src / c / project-basics-edit.js View on Github external
m(inputCard, {
                                    label: window.I18n.t('admin_tags', I18nScope()),
                                    label_hint: window.I18n.t('admin_tags_hint', I18nScope()),
                                    children: [
                                        m('input.string.optional.w-input.text-field.positive.medium[type="text"]', {
                                            value: vm.fields.admin_tags(),
                                            onchange: m.withAttr('value', vm.fields.admin_tags),
                                        }),
                                    ],
                                }),
                                m(inputCard, {
                                    label: window.I18n.t('service_fee', I18nScope()),
                                    children: [
                                        m('input.string.optional.w-input.text-field.positive.medium[type="number"]', {
                                            value: vm.fields.service_fee(),
                                            onchange: m.withAttr('value', vm.fields.service_fee),
                                        }),
                                    ],
                                }),

                                m(inputCard, {
                                    label: window.I18n.t('solidarity_covid', I18nScope()),
                                    children: [
                                        m('select.required.w-input.text-field.w-select.positive.medium', {
                                            value: `${vm.fields.is_solidarity()}`,
                                            class: vm.e.hasError('integrations') ? 'error' : '',
                                            onchange: m.withAttr('value', (value) => vm.fields.is_solidarity(JSON.parse(value))),
                                        }, [
                                            m(`option[value=true]`, {
                                                selected: vm.fields.is_solidarity(),
                                            }, 'Sim'),
                                            m(`option[value=false]`, {
github tivac / crucible / pages / content-new.js View on Github external
view : function(ctrl) {
        if(!ctrl.types) {
            return m("h1", "Loading...");
        }
        
        return [
            m("h1", "Add Content"),
            m("form", { onsubmit : ctrl.onsubmit },
                m("label",
                    "Name: ",
                    m("input[name=name]", { oninput : m.withAttr("value", ctrl.name), value : ctrl.name() })
                ),
                m("fieldset",
                    m("legend", "Content type"),
                    Object.keys(ctrl.types).map(function(type, idx) {
                        return m("p",
                            m("label",
                                m("input[type=radio][name=type]", {
                                    value    : type,
                                    checked  : idx === 0,
                                    onchange : m.withAttr("checked", function(checked) {
                                        if(!checked) {
                                            return;
                                        }
                                        
                                        ctrl.type(type);
                                    })
github catarse / catarse.js / legacy / src / c / shipping-fee-input.js View on Github external
]))
                ),
                m('.w-col.w-col-1'),
                m('.w-col.w-col-4',
                    m('.w-row', [
                        m('.no-hover.positive.prefix.text-field.w-col.w-col-3',
                            m('.fontcolor-secondary.fontsize-mini.u-text-center',
                                'R$'
                            )
                        ),
                        m('.w-col.w-col-9',
                            m('input.positive.postfix.text-field.w-input', {
                                value: state.applyMask(state.feeValue()),
                                autocomplete: 'off',
                                type: 'text',
                                onkeyup: m.withAttr('value', state.applyMask),
                                oninput: m.withAttr('value', state.feeValue)
                            })
                        )
                    ])
                ),
                m('.w-col.w-col-1', [
                    m('input[type=\'hidden\']', {
                        value: state.deleted()
                    }),

                    (state.fee.destination() === 'others' || state.fee.destination() === 'international' ? '' :
                        m('a.btn.btn-no-border.btn-small.btn-terciary.fa.fa-1.fa-trash', {
                            onclick: () => state.deleted.toggle()
                        }))
                ])
github omenking / swap-n-pop / src / devtools / components / panel_form.ts View on Github external
function input_chain(){
  return m('form', {onsubmit: onsubmit},
    m("input[type='text']", {
    onchange: m.withAttr('value',function(val){ state.panel_form.chain = val}),
    value: state.panel_form.chain
  }))
}
github catarse / catarse.js / legacy / src / c / user-billing.js View on Github external
' Selecione um banco'
                                        )
                                    ])
                                ),
                                (ctrl.showOtherBanksInput() ?
                                    m('.w-col.w-col-6.w-sub-col',
                                        m('.w-row.u-marginbottom-20[id=\'bank_search\']',
                                            m('.w-col.w-col-12', [
                                                m('.input.string.optional.user_bank_account_input_bank_number', [
                                                    m('label.field-label',
                                                        'Número do banco (3 números)'
                                                    ),
                                                    m('input.string.optional.w-input.text-field.bank_account_input_bank_number[id=\'user_bank_account_attributes_input_bank_number\'][maxlength=\'3\'][size=\'3\'][type=\'text\']', {
                                                        name: 'user[bank_account_attributes][input_bank_number]',
                                                        value: ctrl.bankInput(),
                                                        onchange: m.withAttr('value', ctrl.bankInput)
                                                    }),
                                                    m('.fontsize-smaller.text-error.u-marginbottom-20.fa.fa-exclamation-triangle.w-hidden[data-error-for=\'user_bank_account_attributes_input_bank_number\']',

                                                        ' Número do banco inválido'
                                                    )
                                                ]),
                                                m('a.w-hidden-small.w-hidden-tiny.alt-link.fontsize-smaller[href=\'javascript:void(0);\'][id=\'show_bank_list\']', {
                                                    onclick: ctrl.showOtherBanks.toggle
                                                }, [
                                                    'Busca por nome  ',
                                                    m.trust(' '),
                                                    m.trust('>')
                                                ]),
                                                m('a.w-hidden-main.w-hidden-medium.alt-link.fontsize-smaller[href=\'javascript:void(0);\'][id=\'show_bank_list\']', {
                                                    onclick: ctrl.showOtherBanks.toggle
                                                }, [
github APE-EDX / APE / public / components / target-process.js View on Github external
}

        ctrl.showing = attrs.showing;

        return m('div.target-body', {className: ctrl.showing ? 'modal fade in show' : 'modal fade hidden', role: 'dialog'},
            m('div', {class: 'modal-dialog modal-lg'},
                m('div', {class: 'modal-content'},
                    m('div', {class: 'modal-header'},
                        m('button', {class: 'close', onclick: ctrl.closeOverlayFrame},'x'),

                        m('h4','Select Process:', {class: 'modal-title'})
                    ),
                    m('input.process-search[type=text]', {
                        config: this.focusSearch.bind(this),
                        inputValue: ctrl.inputValue(),
                        oninput: m.withAttr('value', ctrl.inputValue),
                        placeholder: 'Search process'
                    }),
                    m('div#procContainer', {class: 'modal-body'}, '',
                        m('ul#processList', {class: 'list-group'},
                            (ctrl.inputValue() ? this.search(processes, ctrl.inputValue()) : processes).map((e) => {
                                return m('li.list-group-item', {onclick: this.setTarget.bind(this, ctrl, e)},
                                    m('span.badge', e.pid),
                                    e.name
                                )
                            })
                        )
                    ),
                    m('div', {class: 'modal-footer'},
                        m('button', {onclick: reorderProcesses.bind(this, 'name', 'pid'), class: 'btn btn-default'}, 'By name'),
                        m('button', {onclick: reorderProcesses.bind(this, 'pid', null), class: 'btn btn-default'}, 'By PID'),
                        m('button', {onclick: this.reloadProc.bind(this), class: 'btn btn-default'}, 'Reload'),