| 1 | from nagare import ajax, component, presentation |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | class MultiUpdate(object): |
|---|
| 5 | pass |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | @presentation.render_for(MultiUpdate) |
|---|
| 9 | def render(self, h, *arg): |
|---|
| 10 | (id1, id2) = (h.generate_id('id'), h.generate_id('id')) |
|---|
| 11 | update1 = ajax.Update(component.Component(self, 'empty').render, |
|---|
| 12 | component_to_update=id1) |
|---|
| 13 | update2 = ajax.Update(component.Component(self, 'alert').render, |
|---|
| 14 | component_to_update=id2) |
|---|
| 15 | h << h.a('click').action(ajax.Updates(update1, update2)) |
|---|
| 16 | h << h.div(id=id1) |
|---|
| 17 | h << h.div(id=id2) |
|---|
| 18 | return h.root |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | @presentation.render_for(MultiUpdate, 'empty') |
|---|
| 22 | def render(self, h, *arg): |
|---|
| 23 | h << '' |
|---|
| 24 | return h.root |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | @presentation.render_for(MultiUpdate, 'alert') |
|---|
| 28 | def render(self, h, *arg): |
|---|
| 29 | h << '' |
|---|
| 30 | h << h.script('alert("hey!")') |
|---|
| 31 | return h.root |
|---|