diff --git a/app/Resources/views/Search/search_new.html.twig b/app/Resources/views/Search/search_new.html.twig new file mode 100644 index 00000000..115ab863 --- /dev/null +++ b/app/Resources/views/Search/search_new.html.twig @@ -0,0 +1,328 @@ +{% extends '/layout.html.twig' %} + +{% block title %}New Card Search{% endblock %} + +{% block body %} +{% include '/Scripts/api.html.twig' %} + +
+ +
+ +
+
+

New Search!

+

Use the new Search Syntax from api.netrunnerdb.com (the V3 API).

+

TODO: Add Syntax here

+
+
+ +
+
+
+ + + + + +
+
+ +
+ +
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +{% endblock %} diff --git a/src/AppBundle/Controller/SearchNewController.php b/src/AppBundle/Controller/SearchNewController.php new file mode 100755 index 00000000..767a8749 --- /dev/null +++ b/src/AppBundle/Controller/SearchNewController.php @@ -0,0 +1,21 @@ +render('/search/search_new.html.twig', [ + 'pagetitle' => "Card Search (new)", + 'pagedescription' => "New Card Search", + 'query' => $request->query->get('q') ?: '' + ]); + } +} diff --git a/src/AppBundle/Resources/config/routing.yml b/src/AppBundle/Resources/config/routing.yml index 3658eb19..354b12f5 100755 --- a/src/AppBundle/Resources/config/routing.yml +++ b/src/AppBundle/Resources/config/routing.yml @@ -834,6 +834,11 @@ cards_find: defaults: _controller: AppBundle:Search:find +cards_find_v3: + path: /search_new/ + defaults: + _controller: AppBundle:SearchNew:get + cards_processSearchForm: path: /process/ defaults: diff --git a/web/js/topnav.js b/web/js/topnav.js index e287b762..e1020db3 100644 --- a/web/js/topnav.js +++ b/web/js/topnav.js @@ -62,6 +62,10 @@ Promise.all([NRDB.data.promise, NRDB.ui.promise]).then(function() { $('#top_nav_card_search').keypress(function(event) { var keycode = (event.keyCode ? event.keyCode : event.which); if(keycode == '13'){ + if (NRDB.user?.data?.use_new_search) { + let f = document.getElementById('top_nav_card_search_form'); + f.action = Routing.generate('cards_find_v3', {}, true); + } $('#top_nav_card_search_form').submit(); } });