Ejemplo n.º 1
0
def render_NewMember(self, h, comp, *args):
    """Render the title of the associated card"""
    with h.form:
        members_to_add = var.Var()

        def get_emails():
            emails = []
            for email in members_to_add().split(','):
                try:
                    email = email.strip()
                    email = validator.validate_email(email)
                    emails.append(email)
                except ValueError:
                    continue
            return emails

        h << h.input(
            type='text',
            id=self.text_id,
        ).action(members_to_add)
        h << h.input(value=_("Add"), type="submit",
                     class_="btn btn-primary").action(
                         remote.Action(lambda: comp.answer(get_emails())))
        h << self.autocomplete
    h << h.script(
        "document.getElementById(%s).focus()" % ajax.py2js(self.text_id))
    return h.root
Ejemplo n.º 2
0
def render_AddMembers(self, h, comp, *args):
    value = var.Var('')
    submit_id = h.generate_id('form')
    hidden_id = h.generate_id('hidden')

    with h.form:
        h << h.input(type='text', id=self.text_id)
        h << h.input(type='hidden', id=hidden_id).action(value)
        h << self.autocomplete
        h << h.script(
            u"%(ac_id)s.itemSelectEvent.subscribe(function(sType, aArgs) {"
            u"var value = aArgs[2][0];"
            u"YAHOO.util.Dom.setAttribute(%(hidden_id)s, 'value', value);"
            u"YAHOO.util.Dom.get(%(submit_id)s).click();"
            u"});" % {
                'ac_id': self.autocomplete().var,
                'hidden_id': ajax.py2js(hidden_id),
                'submit_id': ajax.py2js(submit_id)
            })
        h << h.script(
            "document.getElementById(%s).focus()" % ajax.py2js(self.text_id))
        h << h.button(id=submit_id, style='display:none').action(
            remote.Action(lambda: comp.answer([]
                                              if not value() else [value()])))
    return h.root
Ejemplo n.º 3
0
def render_Board_save_template(self, h, comp, *args):
    shared = var.Var('me')
    with h.form(class_='description-form'):
        h << h.label(_(u'Save this board as a template'))
        with h.select.action(shared):
            h << h.option(_(u'For me only'), value='me').selected(shared)
            h << h.option(_(u'For all users'), value='shared').selected(shared)
        with h.div(class_='buttons'):
            action = remote.Action(lambda: self.save_as_template(shared() == 'shared'))
            h << h.button(_(u'Save'), class_='btn btn-primary', type='submit').action(action)
            h << ' '
            h << h.button(_('Cancel'), class_='btn', onclick='YAHOO.kansha.app.hideOverlay();')
    return h.root
Ejemplo n.º 4
0
def render_User_friend(self, h, comp, *args):
    h << h.a(comp.render(h, "avatar")).action(
        remote.Action(lambda: comp.answer([self.data.email])))
    return h.root