/* Sir Trevor BrowseGroupCategories */ import Core from 'spotlight/core' SirTrevor.Blocks.BrowseGroupCategories = (function(){ return Core.Block.Resources.extend({ type: "browse_group_categories", icon_name: "browse", bloodhoundOptions: function() { var that = this; return { prefetch: { url: this.autocomplete_url(), ttl: 0, filter: function(response) { // Let the dom know that the response has been returned $(that.inner).attr('data-browse-groups-fetched', true); return response; } } }; }, autocomplete_control: function() { return `` }, autocomplete_template: function(obj) { return `
${obj.title}
` }, autocomplete_url: function() { return $(this.inner).closest('form[data-autocomplete-exhibit-browse-groups-path]').data('autocomplete-exhibit-browse-groups-path').replace("%25QUERY", "%QUERY"); }, _itemPanel: function(data) { var index = "item_" + this.globalIndex++; var checked; if (data.display == "true") { checked = "checked='checked'" } else { checked = ""; } var resource_id = data.slug || data.id; var markup = `
  • ${i18n.t("blocks:resources:panel:drag")}
    ${data.title}
  • ` const panel = $(markup); var context = this; $('a[data-item-grid-panel-remove]', panel).on('click', function(e) { e.preventDefault(); $(this).closest('.field').remove(); context.afterPanelDelete(); }); this.afterPanelRender(data, panel); return panel; }, item_options: function() { return ` ` }, }); })();