def on_event(self, comp, event): if event.is_(events.CardClicked): card_comp = event.data card_comp.becomes(popin.Popin(card_comp, 'edit')) elif event.is_(events.ParentTitleNeeded): return self.get_title() elif event.is_(events.CardEditorClosed): card_bo = event.emitter slot = event.data slot.becomes(card_bo) # card has been edited, reindex card_bo.add_to_index(self.search_engine, self.board.id, update=True) self.search_engine.commit() self.emit_event(comp, events.SearchIndexUpdated)
def on_event(self, comp, event): if event.is_(events.CardClicked): card_comp = event.data card_comp.becomes(popin.Popin(card_comp, 'edit')) elif event.is_(events.ParentTitleNeeded): return self.get_title() elif event.is_(events.CardEditorClosed): card_bo = event.emitter slot = event.data slot.becomes(card_bo) # card has been edited, reindex scard = fts_schema.Card(**card_bo.to_document()) self.search_engine.update_document(scard) self.search_engine.commit() self.emit_event(comp, events.SearchIndexUpdated)
def on_event(self, comp, event): if event.is_(events.CardClicked): card_comp = event.data card_comp.becomes(popin.Popin(card_comp, 'edit')) elif event.is_(events.ParentTitleNeeded): return self.get_title() elif event.is_(events.CardEditorClosed): card_bo = event.emitter slot = event.data slot.becomes(card_bo) # if card has been edited, reindex if security.has_permissions('edit', card_bo): card_bo.add_to_index(self.search_engine, self.board.id, update=True) self.search_engine.commit(True) self.emit_event(comp, events.SearchIndexUpdated) card_bo.refresh() elif event.is_(events.CardArchived): self.remove_card_by_id(event.last_relay.id)