From 08403addc72fd9e86312fc833e5934da31001728 Mon Sep 17 00:00:00 2001 From: Chris Van Date: Mon, 8 Oct 2012 15:00:31 -0700 Subject: [PATCH] waffle search suggestions on gaia --- media/js/mkt/init.js | 1 + media/js/mkt/mkt_suggestions.js | 2 +- migrations/484-enable-search-suggestions-switch.sql | 3 +++ mkt/templates/mkt/base.html | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 migrations/484-enable-search-suggestions-switch.sql diff --git a/media/js/mkt/init.js b/media/js/mkt/init.js index c648af9ea4..27f0397aec 100644 --- a/media/js/mkt/init.js +++ b/media/js/mkt/init.js @@ -16,6 +16,7 @@ var z = { }, canInstallApps: true, allowAnonInstalls: !!$('body').data('allow-anon-installs'), + enableSearchSuggestions: !!$('body').data('enable-search-suggestions'), // if ($('#myDialog li').length > z.confirmBreakNum) add class 'two-col'. confirmBreakNum: 6 }; diff --git a/media/js/mkt/mkt_suggestions.js b/media/js/mkt/mkt_suggestions.js index e961f94ab3..c6211a8697 100644 --- a/media/js/mkt/mkt_suggestions.js +++ b/media/js/mkt/mkt_suggestions.js @@ -1,7 +1,7 @@ // Init site search suggestions and populate the suggestions container. (function() { // MKT search init. - if (!z.capabilities.gaia) { // Disable suggestions on Gaia for now. + if (!z.capabilities.gaia || z.enableSearchSuggestions) { // Disable suggestions on Gaia for now. $('#search #search-q').searchSuggestions($('#site-search-suggestions'), processResults, 'MKT'); } diff --git a/migrations/484-enable-search-suggestions-switch.sql b/migrations/484-enable-search-suggestions-switch.sql new file mode 100644 index 0000000000..2b1633ac75 --- /dev/null +++ b/migrations/484-enable-search-suggestions-switch.sql @@ -0,0 +1,3 @@ +INSERT INTO waffle_switch_mkt (name, active, note) + VALUES ('enable-search-suggestions-gaia', 0, + 'Enable search suggestions on Firefox OS.'); diff --git a/mkt/templates/mkt/base.html b/mkt/templates/mkt/base.html index 1e9968ac34..6ee6932643 100644 --- a/mkt/templates/mkt/base.html +++ b/mkt/templates/mkt/base.html @@ -59,6 +59,7 @@ data-collect-timings="{{ url('mkt.timing.record') }}:{{ collect_timings_percent }}" data-simulate-nav-pay="{{ settings.SIMULATE_NAV_PAY|json }}" data-page-type="{{ pagetype or 'leaf' }}" + data-enable-search-suggestions="{{ waffle.switch('enable-search-suggestions-gaia')|json }}" {% if not logged %}data-recaptcha="{{ settings.RECAPTCHA_PUBLIC_KEY }}"{% endif %} {% block bodyattrs %}{% endblock %}>