def render_pyroes(self, pyroes):
     for pyro in pyroes:
         with html.li() as li:  # per-pyro list item
             # per-pyro anchor routing path with parameter pyd
             with html.a(routerlink=('/detail', {'pyd': pyro.pyd})):
                 html.span(pyro.pyd, Class='badge')  # show pyd as badge
                 html.txt(' {name}')._fmt(name=pyro.name_)  # obs name_
 def li_pyroes(self, pyroes):
     for pyro in pyroes:
         with html.li() as li:
             # li._class.selected(self.selected_.pyd_ == pyro.pyd)
             li._class.selected(self.pyd == pyro.pyd)
             li._bindx.click(self.pyd_, pyro)
             with html.a(routerlink=('/pyro', {'pyd': pyro.pyd})):
                 html.span(pyro.pyd, Class='badge')
                 html.txt(' {name}')._fmt(name=pyro.name_)
    def render_top_pyroes(self, pyroes):
        for p in pyroes[:4]:
            with html.a(Class='col-1-4',
                        routerlink=('/detail', {
                            'pyd': p.pyd
                        })):

                with html.div(Class='module pyro'):
                    html.h4('{name}')._fmt(name=p.name_)
    def li_disasters(self, disasters):
        for disaster in disasters:
            with html.li() as li:
                li._class.selected(self.selected_.did_ == disaster.did)

                with html.a(routerlink=('', {'did': disaster.did})):
                    html.span(disaster.did, Class='badge')
                    html.txt()._fmt(disaster.name_)

            li._bindx.click(lambda d=disaster: self.selected_(d))
示例#5
0
    def render_pyroes(self, pyroes):
        for pyro in pyroes:
            with html.li() as li:  # per-pyro list item
                # per-pyro anchor routing path with parameter pyd
                with html.a(routerlink=('/detail', {'pyd': pyro.pyd})):
                    html.span(pyro.pyd, Class='badge')  # show pyd as badge
                    html.txt(' {name}')._fmt(name=pyro.name_)  # obs name_

                with html.button('x', Class='delete') as b:
                    # def param avoids closure using last pyro.pyd
                    def pyro_delete(evt, pyd=pyro.pyd):
                        evt.stopPropagation()  # avoid evt clicking on "a"
                        self.pyro_delete(pyd)

                    b._bind.click(pyro_delete)  # use "bind" to get event
示例#6
0
    def li_pyroes(self, pyroes):
        print('li_pyroes called with:', pyroes)
        for pyro in pyroes:
            with html.li() as li:
                # li._class.selected(self.selected_.pyd_ == pyro.pyd)
                li._class.selected(self.pyd == pyro.pyd)

                # self.pyd_
                # .map(lambda x: x == pyro.pyd)
                # .do_action(lambda x: print('HERE IS THE PROBLEM:', x))
                # )
                li._bindx.click(self.pyd_, pyro.pyd)
                with html.a(routerlink=('/pyro', {'pyd': pyro.pyd})):
                    html.span(pyro.pyd, Class='badge')
                    html.txt(' {name}')._fmt(
                        name=pyro.name_.do_action(lambda x: print('NAME:', x)))
示例#7
0
 def sought_pyroes(pyroes):
     for p in pyroes:
         with html.li() as li:  # per-pyro list item
             # per-pyro anchor routing path with parameter pyd
             html.a(p.name, routerlink=('/detail', {'pyd': p.pyd}))