diff --git a/apps/search_page/__init__.py b/apps/search_page/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/apps/search_page/apps.py b/apps/search_page/apps.py new file mode 100644 index 000000000..548c4f279 --- /dev/null +++ b/apps/search_page/apps.py @@ -0,0 +1,10 @@ +from django.apps import AppConfig +from django.conf import settings + +class SearchPageConfig(AppConfig): + name = 'apps.search_page' + + def ready(self): + if settings.SEARCH_PAGE_AUTO_SETUP: + from .utils import create_page + create_page() diff --git a/apps/search_page/cms_apps.py b/apps/search_page/cms_apps.py new file mode 100644 index 000000000..236d4daa6 --- /dev/null +++ b/apps/search_page/cms_apps.py @@ -0,0 +1,11 @@ +from cms.app_base import CMSApp +from cms.apphook_pool import apphook_pool + + +@apphook_pool.register +class SearchPageApphook(CMSApp): + app_name = 'apps.search_page' + name = 'SearchPage' + + def get_urls(self, page=None, language=None, **kwargs): + return ['apps.search_page.urls'] diff --git a/apps/search_page/static/search_page/css/google-search.css b/apps/search_page/static/search_page/css/google-search.css new file mode 100644 index 000000000..6d9bec42d --- /dev/null +++ b/apps/search_page/static/search_page/css/google-search.css @@ -0,0 +1,152 @@ +#google-search { + + &:is(#cms-content-container > *:last-child) { + margin-bottom: var(--global-space--section-gap, 60px); + } + + /* SEARCH CONTAINER */ + + /* To remove padding from search container */ + & .gsc-control-cse { + padding: unset; + } + + + + /* TABLE OF SEARCH STATS & SORTING OPTIONS */ + + /* To remove border from search analytics, add gray background */ + & .gsc-above-wrapper-area { + --bkgd-color: var(--global-color-primary--x-light); + + background-color: var(--bkgd-color); + box-shadow: 40vw 0 var(--bkgd-color), -40vw 0 var(--bkgd-color); + border-bottom: unset; + } + + & .gsc-above-wrapper-area-container { + border-bottom: unset; + } + + /* To override Core-Styles tables */ + & tbody > tr:first-child > :is(td, th) { + border: unset; + padding-inline: unset; + background: unset; + vertical-align: middle; + } + + & .gsc-selected-option-container { + background: var(--global-color-primary--xx-light); + border: var(--global-border--normal); + } + + & .gsc-result-info { + padding: unset; + font-size: var(--global-font-size--medium); + } + + + + /* SUGGESTION PHRASE (after "Did you mean:") */ + + & .gs-spelling { + padding: unset; + } + & .gs-spelling a { + color: var(--global-color-accent--light); + + /* to undo core-styles.base */ + /* https://github.com/TACC/Core-Styles/blob/8ab89d3/src/lib/_imports/elements/links.css */ + &:not([href]) { + opacity: 1; + pointer-events: auto; + } + } + + + + /* SEARCH RESULTS */ + + /* (search result body text) */ + & .gs-snippet { + color: var(--global-color-primary--dark); + } + + /* (url under search result title) */ + & .gs-webResult div.gs-visibleUrl { + color: var(--global-color-secondary--normal); + } + + /* (search result titles) */ + & a.gs-title:link { + color: var(--global-color-accent--light); + text-decoration: none; + text-decoration-thickness: var(--global-border-width--normal); + text-underline-offset: 0.2em; + } + & a.gs-title:link:hover { + text-decoration-line: underline; + text-decoration-style: solid; + } + & a.gs-title b { + color: currentColor; + } + & .gs-result .gs-title:not(a):hover { + /* to remove duplicate underline */ + /* (fix Google's default_v6+en.css bug `.gs-result .gs-title:hover`) */ + text-decoration: auto; + } + + /* (push search-result description to right) */ + & .gs-image-box { + margin-right: 10px; + } + + + + /* GOOGLE PAGE NAVIGATION (at bottom) */ + + & .gsc-cursor-box { + display: flex; + justify-content: center; + margin-block: var(--global-space--large); + } + + & .gsc-cursor-current-page { + color: var(--global-color-accent--light); + text-decoration: none; + text-decoration-thickness: var(--global-border-width--normal); + text-underline-offset: 0.2em; + } + + & .gsc-cursor-current-page:hover { + text-decoration-line: underline; + text-decoration-style: solid; + } + + + + /* GOOGLE BRANDING */ + + & .gcsc-find-more-on-google { + color: var(--global-color-accent--light); + text-decoration: none; + text-decoration-thickness: var(--global-border-width--normal); + text-underline-offset: 0.2em; + } + svg.gcsc-find-more-on-google-magnifier { + fill: currentColor; + } + + & .gcsc-find-more-on-google:hover { + text-decoration-line: underline; + text-decoration-style: solid; + } + + & .gcsc-branding-img-noclear { + vertical-align: unset; + top: 1px; + } + +} diff --git a/apps/search_page/templates/search_page.html b/apps/search_page/templates/search_page.html new file mode 100644 index 000000000..db55e320d --- /dev/null +++ b/apps/search_page/templates/search_page.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} +{% load static cms_tags %} + +{% block css %} + {{ block.super }} + +{% endblock css %} + +{% block app_content %} +