Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/instant enabled option #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ global.MonsieurBizInstantSearch = class {
}

document.addEventListener("DOMContentLoaded", function() {
new MonsieurBizInstantSearch(
monsieurbizSearchPlugin.instantUrl,
monsieurbizSearchPlugin.searchInputSelector,
monsieurbizSearchPlugin.resultClosestSelector,
monsieurbizSearchPlugin.resultFindSelector,
monsieurbizSearchPlugin.keyUpTimeOut,
monsieurbizSearchPlugin.minQueryLength
);
if (monsieurbizSearchPlugin.instantEnabled) {
new MonsieurBizInstantSearch(
monsieurbizSearchPlugin.instantUrl,
monsieurbizSearchPlugin.searchInputSelector,
monsieurbizSearchPlugin.resultClosestSelector,
monsieurbizSearchPlugin.resultFindSelector,
monsieurbizSearchPlugin.keyUpTimeOut,
monsieurbizSearchPlugin.minQueryLength
);
}
});
2 changes: 1 addition & 1 deletion src/Resources/public/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"entrypoints": {
"monsieurbiz-search": {
"js": [
"/bundles/monsieurbizsyliussearchplugin/js/monsieurbiz-search.eb2121b2.js"
"/bundles/monsieurbizsyliussearchplugin/js/monsieurbiz-search.01788f97.js"
]
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Resources/public/js/monsieurbiz-search.01788f97.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/Resources/public/js/monsieurbiz-search.eb2121b2.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/Resources/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"bundles/monsieurbizsyliussearchplugin/monsieurbiz-search.js": "/bundles/monsieurbizsyliussearchplugin/js/monsieurbiz-search.eb2121b2.js"
"bundles/monsieurbizsyliussearchplugin/monsieurbiz-search.js": "/bundles/monsieurbizsyliussearchplugin/js/monsieurbiz-search.01788f97.js"
}
2 changes: 1 addition & 1 deletion src/Resources/views/_scripts.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script type="text/javascript">
var monsieurbizSearchPlugin = {
instantEnabled: true,
instantEnabled: {{ setting('monsieurbiz.search', 'instant_search_enabled__monsieurbiz_product') ? 'true' : 'false' }},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 suggestion: This is OK if you only index products. If I also have taxons or other entities in ES, we need to check that instant search is disabled for all entities.
Perhaps you should create a twig function to loop through all documentable entities and check the configuration. ‏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to build a form dynamically with all documentable entities with a default value to true if the value is not set yet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maximehuran a form here? But this is not a form, we don't generate any input fields. I am confused why you suggest a form here.

instantUrl: '{{ path('monsieurbiz_search_instant') | escape('js') }}', // URL for instant search
searchInputSelector: '.autocomplete-search input[type=search]', // Selector for search input text field
resultClosestSelector: '.autocomplete-search', // Selector used to display results, take the closest parent of searchInputSelector
Expand Down
Loading