import BasicWidget from "./basic_widget.js"; import toastService from "../services/toast.js"; import server from "../services/server.js"; const TPL = `
Search results:
`; export default class SearchResultsWidget extends BasicWidget { doRender() { this.$widget = $(TPL); this.$searchResults = this.$widget; this.$searchResultsInner = this.$widget.find(".search-results-list"); this.toggleInt(false); return this.$widget; } searchResultsEvent({results}) { this.toggleInt(true); this.$searchResultsInner.empty(); this.$searchResults.show(); for (const result of results) { const link = $('', { href: 'javascript:', text: result.title }).attr('data-action', 'note').attr('data-note-path', result.path); const $result = $('
  • ').append(link); this.$searchResultsInner.append($result); } } searchFlowEndedEvent() { this.$searchResults.hide(); } }