Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123008
D3366.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D3366.diff
View Options
diff --git a/cypress/integration/admin.spec.js b/cypress/integration/admin.spec.js
--- a/cypress/integration/admin.spec.js
+++ b/cypress/integration/admin.spec.js
@@ -27,7 +27,7 @@
.type('admin')
.get('input[name="password"]')
.type('admin')
- .get('form')
+ .get('.container form')
.submit();
cy.location('pathname')
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 %}
-<div class="swh-corner-ribbon">Beta version</div>
{% 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 @@
<div class="navbar" style="width: 94%;">
<div class="swh-navbar-content">
{% block navbar-content %}{% endblock %}
+ {% if request.resolver_match.url_name != 'swh-web-homepage' and request.resolver_match.url_name != 'browse-search' %}
+ <form class="form-horizontal d-none d-md-flex input-group swh-search-navbar"
+ id="swh-origins-search-top">
+ <input class="form-control"
+ placeholder="Enter a SWHID to resolve or keyword(s) to search for in origin URLs"
+ type="text" id="swh-origins-search-top-input"/>
+ <div class="input-group-append">
+ <button class="btn btn-primary" type="submit">
+ <i class="swh-search-icon mdi mdi-24px mdi-magnify" aria-hidden="true"></i>
+ </button>
+ </div>
+ </form>
+ {% endif %}
</div>
</div>
</nav>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 17, 3:39 PM (2 d, 20 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3218774
Attached To
D3366: templates/layout: Add origins search form in right part of top navbar
Event Timeline
Log In to Comment