-
Notifications
You must be signed in to change notification settings - Fork 2
feat: CMD-187 autocreate search page #1129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
wesleyboar
wants to merge
123
commits into
main
Choose a base branch
from
feat/template-and-setting-for-google-search
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 122 commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
4515b85
feat: template & setting for Google search
wesleyboar 2883e49
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 8607c90
fix: styles and fallback warning for Google Search
wesleyboar f3dc4dc
enhance: move sarch CSS to its own file
wesleyboar 3947bc2
enhance: rename search stylesheet and ID
wesleyboar d0d5e00
refactor: move css to top of template
wesleyboar b74e2a0
fix: missing default GOOGLE_SEARCH_ENGINE_ID
wesleyboar 7c93b7e
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar f80ebc8
feat: search template is standard
wesleyboar 5208bde
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 9457519
feat: convert search template into a search app
wesleyboar 16d34c3
feat(search_page): slimmer views.py
wesleyboar da3a73a
feat(search): create page if it does not exist
wesleyboar 5fb5a32
fix(search): restore breadcrumbs
wesleyboar 1fef4f8
chore(search_page): remove now-unnecessary file
wesleyboar e8072e6
enhance(search_page): flag page as auto-generated
wesleyboar 3291015
enhance(search): attach apphook to manage urls
wesleyboar ca11f07
style(search): polish
wesleyboar 445010c
fix(search): searchbar not using curr. search path
wesleyboar 8d812c8
chore(search): remove cruft
wesleyboar 3793bb9
chore(search): reduce silly complexity of tag
wesleyboar 92e9ecf
chore(search): remove cruft 2
wesleyboar adf6ad2
feat(search): auto isntall and setup
wesleyboar d9db279
feat(search): simplify an isolate markup
wesleyboar fda65e5
core(search): remove cruft markup
wesleyboar 9d88be6
chore(search): simlify utils.py
wesleyboar 148f661
style(search): new line
wesleyboar 7cbb96e
refactor(search): polish
wesleyboar f57d4e1
refactor(search): rename a function
wesleyboar 55b84da
style(search): ending slash for example path
wesleyboar 3ee4fe1
style(search): ending slash for example path
wesleyboar b4d6ac3
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 0f16d38
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar ba2b091
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 959ba8e
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 7dd0402
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar a12a70f
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 74230c0
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 34be454
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar a1a79b5
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 448b6b3
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 1db6303
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 3a1e28e
fix: inaccurate text picture template name (#967)
wesleyboar 893a434
refactor: no_link_to_image
wesleyboar 91cc70c
docs: simplify no_link_to_image/picture.html notes
wesleyboar 8cbb4a9
docs: clarify no_link_to_image/picture.html notes
wesleyboar 6d7b730
docs: djangocms_picture template indentation
wesleyboar 7f3ec21
feat: support core-styles u-image-zoom (#968)
wesleyboar 5ec5e02
refactor!: djangocms_picture extension (#969)
wesleyboar 478ffb5
chore(README): new line (to get new main commit)
wesleyboar de1eacf
Merge branch 'main' of github.com:TACC/Core-CMS
wesleyboar df14ad6
refactor: u-image-zoom via core-styles (#970)
wesleyboar 461ca3e
chore: v4.36.0
wesleyboar 5c1886c
Merge branch 'main' of github.com:TACC/Core-CMS
wesleyboar 34acc58
fix: u-image-zoom validation (#971)
wesleyboar b2993c0
fix: space under span.u-image-zoom img (#972)
wesleyboar 86f76fb
fix: v4.36.1
wesleyboar 9d80485
feat: snippet template to redirect external article (#973)
wesleyboar 6913b38
chore: v4.36.2
wesleyboar 04a54de
deps: djangocms-bootstrap4 v3 (#974)
wesleyboar ab22440
chore: move imports to function that uses them
wesleyboar 4b72436
feat: let custom sites overwrite app templates (#975)
wesleyboar 69dcb55
chore: v4.36.3
wesleyboar 6de0143
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar 4a457ca
feat: new custom django command for devs (#728)
wesleyboar 6661622
docs: we do not use Core-CMS-Resources
wesleyboar bfcca6a
feat: let client have fullwidth breadcrumbs (#985)
wesleyboar 8904111
docs: revise note about code from 3rd-party
wesleyboar 723c182
fix: client cannot change breadcrumb inclusion on guides (#986)
wesleyboar 9d1cff2
fix: do not allow accidental blog install (#987)
wesleyboar 2c6896a
feat: progressive web app & full favicon (#988) (#989)
wesleyboar 5136026
feat: PORTAL_LOGIN_PATH (#990) (#991)
wesleyboar 14611bf
chore: v4.36.4
wesleyboar 8494266
fix: big error if core portal expected but absent (#993) (#994)
wesleyboar f8a59ca
docs: move docs/contributing to CONTRIBUTING
wesleyboar 7b24129
chore: v4.36.5
wesleyboar b7a8e67
chore: poetry lock
wesleyboar 7badb77
fix: djangocms-icon picker not showing Cortal icons (#995)
wesleyboar 8f286c3
docs: icon picker bug
wesleyboar 8524bb4
chore: v4.36.6
wesleyboar 80208ac
fix: svg could display content (#997)
wesleyboar f1d8b3a
refactor: from portal.png to logo.svg
wesleyboar 3797eed
Merge branch 'refactor/portal-png-to-logo-svg'
wesleyboar 94f2356
refactor: from portal.png to logo.svg (#1001)
wesleyboar 0a9bada
Merge branch 'stable'
wesleyboar 0b24eb3
refactor: no need to annotate tags (#1006)
wesleyboar c90889a
chore: v4.35.7
wesleyboar 36573bd
Merge branch 'stable'
wesleyboar c8eb94f
fix: image caption breaks alignment (old styles) (#1009)
wesleyboar 4e9b795
feat: serve page with no header nor footer (#1012) (#1013)
wesleyboar 594f31f
fix: serve page with no header nor footer (#1014) (#1015)
wesleyboar d620fee
feat: always allow CMS_TEMPLATE content.html (#1017)
wesleyboar 445e457
refactor: DJANGOCMS plugins settings (off main) (#1019)
wesleyboar 0dd7485
Merge branch 'stable'
wesleyboar 339a440
chore: v4.36.10
wesleyboar 3b52267
feat: support DjangoCMS Bootstrap4 Link/Button (#1020)
wesleyboar 9e7b305
fix: core-styles v2.50.2 (#1021)
wesleyboar 7eace56
chore: v4.36.11
wesleyboar 70141ac
fix: link-wrapped img ignores box-model (#1023)
wesleyboar 4ef206b
feat/new-email-svg (#1024)
wesleyboar 82cbb84
fix: social media icons were giant by default (#1026)
wesleyboar 97ccb58
refactor: simpler svg data for core logo
wesleyboar e6685c0
feat: logo icons inherit color & size (#1027)
wesleyboar f0dae34
chore v4.36.12
wesleyboar 273bb04
feat: remove redundant social media icons - off main (#1031)
wesleyboar dd98597
chore v4.36.13
wesleyboar ef76b43
Merge branch 'stable'
wesleyboar a849392
chore: v4.36.14
wesleyboar 298a6ad
deps: djangocms-tacc-remote-content 0.4.0
wesleyboar 228e268
Revert "deps: djangocms-tacc-remote-content 0.4.0"
wesleyboar 18e1440
merge v4.35.23 (#1078)
wesleyboar 7fdabc4
Merge branch 'stable'
wesleyboar cd9e981
chore: merge v4.37.0 (#1079)
wesleyboar 94389fd
fix: setup-cms.sh points to unprotected branch
wesleyboar 3b51669
Merge branch 'main' of github.com:TACC/Core-CMS
wesleyboar 9283f9e
Merge branch 'stable'
wesleyboar 645b8b7
fix: search results style bugs
wesleyboar 18695ab
fix: MORE search results style bugs
wesleyboar 846e35e
fix(a11y): lighter accent color
wesleyboar 4b07a7a
Merge branch 'main' into release/v4.36.X
wesleyboar ae9a6ba
fix: poetry.lock hash
wesleyboar 67fed8b
Merge branch 'release/v4.36.X' into feat/template-and-setting-for-goo…
wesleyboar 4f14e0e
Merge branch 'main' into feat/template-and-setting-for-google-search
wesleyboar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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'] |
152 changes: 152 additions & 0 deletions
152
apps/search_page/static/search_page/css/google-search.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| {% extends "base.html" %} | ||
| {% load static cms_tags %} | ||
|
|
||
| {% block css %} | ||
| {{ block.super }} | ||
| <link id="css-search" rel="stylesheet" href="{% static 'search_page/css/google-search.css' %}"> | ||
| {% endblock css %} | ||
|
|
||
| {% block app_content %} | ||
| <div class="row"> | ||
| <div class="col col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6"> | ||
| <h1>{% page_attribute "page_title" %}</h1> | ||
| </div> | ||
| </div> | ||
|
|
||
| {% if settings.GOOGLE_SEARCH_ENGINE_ID %} | ||
| <div id="google-search"> | ||
| <script async src="https://cse.google.com/cse.js?cx={{ settings.GOOGLE_SEARCH_ENGINE_ID }}"> | ||
| </script> | ||
| <div class="gcse-searchresults-only"></div> | ||
| </div> | ||
| {% else %} | ||
| <p class="c-message c-message--scope-section c-message--type-warning">Please inform your website administrator to verify a <code>GOOGLE_SEARCH_ENGINE_ID</code> is set for this website.</p> | ||
| {% endif %} | ||
| {% endblock app_content %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from django.urls import path | ||
| from . import views | ||
|
|
||
| app_name = 'apps.search_page' | ||
|
|
||
| urlpatterns = [ | ||
| path('', views.SearchPageView, name='search'), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import logging | ||
|
|
||
| from django.conf import settings | ||
| from django.urls import reverse, NoReverseMatch | ||
|
|
||
| from cms.api import create_page as create_cms_page | ||
| from cms.models.pagemodel import Page | ||
|
|
||
| from .cms_apps import SearchPageApphook | ||
|
|
||
|
|
||
| logger = logging.getLogger(f'portal.{__name__}') | ||
|
|
||
| TITLE = 'Search' | ||
| REVERSE_ID = 'search_page' | ||
| DEFAULT_SLUG = settings.PORTAL_SEARCH_PATH.strip('/') | ||
|
|
||
| def get_page(): | ||
| try: | ||
| return Page.objects.filter(reverse_id=REVERSE_ID).first() | ||
| except Page.DoesNotExist: | ||
| return None | ||
|
|
||
| def get_slug(page=None): | ||
| if page: | ||
| return page.get_slug() | ||
| else: | ||
| page = get_page() | ||
| return get_slug(page) if page else DEFAULT_SLUG | ||
|
|
||
| def get_page_url(): | ||
| page = get_page() | ||
| if page: | ||
| return page.get_absolute_url() | ||
| else: | ||
| try: | ||
| return reverse('apps.search_page:search') | ||
| except NoReverseMatch: | ||
| return None | ||
|
|
||
| def create_page(): | ||
| page = get_page() | ||
| slug = get_slug(page) | ||
|
|
||
| if not page: | ||
| page = create_cms_page( | ||
| title=f'{TITLE} (Auto-Generated)', | ||
| menu_title=TITLE, | ||
| page_title=TITLE, | ||
| reverse_id=REVERSE_ID, | ||
| # Use a template from CMS_TEMPLATES setting | ||
| template='standard.html', | ||
| language='en', | ||
| published=True, | ||
| slug=slug, | ||
| in_navigation=False, | ||
| apphook=SearchPageApphook, | ||
| apphook_namespace=SearchPageApphook.name, | ||
| ) | ||
| logger.info(f'Created search page "{TITLE}" at "{slug}"') | ||
| else: | ||
| logger.info(f'Found existing search page at "{slug}"') | ||
|
|
||
| return page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from django.shortcuts import render | ||
|
|
||
| def SearchPageView(request): | ||
| return render(request, 'search_page.html') |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Db write in appconfig.ready
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools