diff --git a/cypress/integration/layout.spec.js b/cypress/integration/layout.spec.js --- a/cypress/integration/layout.spec.js +++ b/cypress/integration/layout.spec.js @@ -5,7 +5,7 @@ * See top-level LICENSE file for more information */ -const url = '/'; +const url = '/browse/help/'; describe('Test top-bar', function() { beforeEach(function() { @@ -105,6 +105,20 @@ }); }); +describe('Test navbar', function() { + it('should redirect to search page when submitting search form in navbar', function() { + const keyword = 'python'; + cy.get('#swh-origins-search-top-input') + .type(keyword); + + cy.get('.swh-search-navbar') + .submit(); + + cy.url() + .should('include', `${this.Urls.browse_search()}?q=${keyword}`); + }); +}); + describe('Test footer', function() { beforeEach(function() { cy.visit(url); diff --git a/swh/web/assets/src/bundles/browse/browse.css b/swh/web/assets/src/bundles/browse/browse.css --- a/swh/web/assets/src/bundles/browse/browse.css +++ b/swh/web/assets/src/bundles/browse/browse.css @@ -14,22 +14,6 @@ overflow-x: hidden; } -.swh-corner-ribbon { - width: 200px; - background: #fecd1b; - color: #e20026; - position: absolute; - text-align: center; - line-height: 50px; - letter-spacing: 1px; - box-shadow: 0 0 3px rgba(0, 0, 0, 0.3); - top: 55px; - right: -50px; - left: auto; - transform: rotate(45deg); - z-index: 2000; -} - .swh-loading { display: none; text-align: center; @@ -107,11 +91,3 @@ td.swh-branch-date { min-width: 250px; } - -@media screen and (max-width: 600px) { - .swh-corner-ribbon { - line-height: 30px; - top: 53px; - right: -65px; - } -} diff --git a/swh/web/assets/src/bundles/webapp/webapp-utils.js b/swh/web/assets/src/bundles/webapp/webapp-utils.js --- a/swh/web/assets/src/bundles/webapp/webapp-utils.js +++ b/swh/web/assets/src/bundles/webapp/webapp-utils.js @@ -164,6 +164,18 @@ $('#back-to-top').css('display', 'none'); } }); + + // navbar search form submission callback + $('#swh-origins-search-top').submit(event => { + event.preventDefault(); + let searchQueryText = $('#swh-origins-search-top-input').val().trim(); + let queryParameters = new URLSearchParams(); + queryParameters.append('q', searchQueryText); + queryParameters.append('with_visit', true); + queryParameters.append('with_content', true); + window.location = `${Urls.browse_search()}?${queryParameters.toString()}`; + }); + }); export function initPage(page) { @@ -180,7 +192,6 @@ sessionStorage.setItem('last-browse-page', window.location); } }); - }); } diff --git a/swh/web/assets/src/bundles/webapp/webapp.css b/swh/web/assets/src/bundles/webapp/webapp.css --- a/swh/web/assets/src/bundles/webapp/webapp.css +++ b/swh/web/assets/src/bundles/webapp/webapp.css @@ -673,3 +673,15 @@ line-height: 1rem; vertical-align: middle; } + +.swh-search-navbar { + position: absolute; + top: 0.7rem; + right: 15rem; + z-index: 50000; + width: 500px; +} + +.sidebar-collapse .swh-search-navbar { + right: 4rem; +} diff --git a/swh/web/templates/browse/layout.html b/swh/web/templates/browse/layout.html --- a/swh/web/templates/browse/layout.html +++ b/swh/web/templates/browse/layout.html @@ -19,6 +19,5 @@ {% endblock %} {% block content %} -
Beta version
{% block browse-content %}{% endblock %} {% endblock %} diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -117,6 +117,19 @@