Skip to content

Commit

Permalink
Merge pull request #400 from arXiv/develop
Browse files Browse the repository at this point in the history
dev -> master, ARXIVCE-742: browse in cloud message
  • Loading branch information
bmaltzan authored Oct 6, 2023
2 parents 0b7d0c9 + fe11f11 commit ff16ae2
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 14 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/develop_pull_request_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
pull_request:
branches:
- develop

jobs:
ci:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
- name: Setup a local virtual environment
run: |
pip install poetry
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Run the automated tests (for example)
run: poetry run pytest -v browse
9 changes: 9 additions & 0 deletions browse/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ class Settings(BaseSettings):
BROWSE_ANALYTICS_ENABLED: bool = bool(int(os.environ.get("BROWSE_ANALYTICS_ENABLED", "0")))
"""Enable/disable web analytics, ie: Pendo, Piwik, geoip."""

BROWSE_USER_BANNER_ENABLED: bool = bool(int(os.environ.get("BROWSE_USER_BANNER_ENABLED", "0")))
"""Enable/disable the user banner, the full width one, above the Cornell logo."""

BROWSE_MINIMAL_BANNER_ENABLED: bool = bool(int(os.environ.get("BROWSE_MINIMAL_BANNER_ENABLED", "0")))
"""Enable/disable the banner to the right of the Cornell logo, before the donate button."""

BROWSE_SPECIAL_MESSAGE_ENABLED: bool = bool(int(os.environ.get("BROWSE_SPECIAL_MESSAGE_ENABLED", "0")))
"""Enable/disable the cloud list item, in the arXiv News section, in home/special-message.html"""

############################## Services ##############################
DOCUMENT_LISTING_SERVICE: PyObject = 'browse.services.listing.fs_listing' # type: ignore
"""What implementation to use for the listing service.
Expand Down
11 changes: 7 additions & 4 deletions browse/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@
<div class="column" id="cu-logo">
<a href="https://www.cornell.edu/"><img src="{{ url_for('static', filename='images/icons/cu/cornell-reduced-white-SMALL.svg') }}" alt="Cornell University" /></a>
</div>
{%- set rd_int = request_datetime.strftime("%Y%m%d%H%M")|int -%}
{%- if rd_int >= 202305010100 and rd_int <= 202307170100 -%}
<div class="column banner-minimal">
<a href="https://info.arxiv.org/hiring/">We are hiring</a></p>
{%- if config["BROWSE_MINIMAL_BANNER_ENABLED"] and rd_int >= 202310010100 and rd_int <= 202312300100 -%}
<div class="column">
<a href="https://info.arxiv.org/help/cloud.html"><span style="color:white;text-decoration-line:underline;">
Served from the cloud
</span></a>
<!--<p><a href="https://info.arxiv.org/hiring/">We are hiring</a></p> --!>
</div>
{%- endif -%}

<div class="column" id="support-ack">
<span id="support-ack-url">We gratefully acknowledge support from the Simons Foundation, <a href="https://info.arxiv.org/about/ourmembers.html">member institutions</a>, and all contributors. <a href="https://info.arxiv.org/about/donate.html">Donate</a></span>
</div>
Expand Down
19 changes: 19 additions & 0 deletions browse/templates/home/special-message.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@

{%- set rd_int = request_datetime.strftime("%Y%m%d%H%M")|int -%}

<div class="message-special dark column">
<span class="label">arXiv News</span>
<p><a href="https://blog.arxiv.org/">Visit our blog for the latest news</a></p>
</div>

{%- if rd_int >= 202305010100 and rd_int <= 202307170100 -%}
<div class="message-special dark column">
<span class="label">arXiv News</span>
<h2>TeX Live 2023 Upgrade</h2>
<p>Beginning on Monday May 22, 2023 all new submissions and replacements will process under TeX Live 2023. <a href="https://blog.arxiv.org/2023/05/12/tex-live-2023-upgrade-to-occur-may-22nd-2023/">Learn More</a></p>
<p><a href="https://blog.arxiv.org/">Visit blog for all news</a></p>
</div>
{%- endif -%}

{%- if rd_int >= 202305010100 and rd_int <= 202307170100 -%}
<div class="message-special column">
Expand All @@ -19,3 +26,15 @@ <h2>TeX Live 2023 Upgrade</h2>
<p><a href="https://info.arxiv.org/hiring/">View open roles</a></p>
</div>
{%- endif -%}

{%- if config['BROWSE_SPECIAL_MESSAGE_ENABLED'] and rd_int >= 202210010100 and rd_int <= 202212300100 -%}
<div class="message-special dark column">
<span class="label">arXiv is moving!</span>
<p>Experience the future with our cloud-powered app today!</p>
<p>
Stay tuned for
<a href="https://info.arxiv.org/about/index.html">updates</a>
on our migration timeline.
</p>
</div>
{%- endif -%}
23 changes: 13 additions & 10 deletions browse/templates/user_banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The content() and script() macro get added to the base.html.

The content() elements will be added at the starty of the <body> above the
The content() elements will be added at the start of the <body> above the
header in base.html.

The script() elements will be added to the <head> in the base.html. This has
Expand All @@ -13,28 +13,31 @@
the user_banner.script() macro.

This no longer uses env vars set in browse.config or httpd/conf/ng_flask.conf on
production. -#}
production.

{# Set these variables to a string of YYYYMMMDD of the start and end date #}
{% set BANNER_START = '202000101' %}
{% set BANNER_END = '20200101' %}
Adding an environment var, so we can enable only on gcp.
-#}

{# Set these variables to a string of YYYYMMDD of the start and end date #}
{% set BANNER_START = '20221001' %}
{% set BANNER_END = '20221030' %}


{%- macro content(request_datetime) -%}
{%- if BANNER_START <= request_datetime.strftime('%Y%m%d') and BANNER_END > request_datetime.strftime('%Y%m%d') %}
{%- if config['BROWSE_USER_BANNER_ENABLED'] and (BANNER_START <= request_datetime.strftime('%Y%m%d')) and (BANNER_END > request_datetime.strftime('%Y%m%d')) %}
<aside class="slider-wrapper bps-banner dark" >
<div class="copy-donation bps-banner">
<h1>Example banner</h1>
<p>Banner text would go here.</p>
<p><a href="https://arxiv.org/support/bug_report">Report bugs here</a></p>
<h1>Cloud Transition</h1>
<p>We're making arXiv even more stable by transitioning to the cloud.</p>
<p><a href="https://arxiv-org.atlassian.net/servicedesk/customer/portal/1l">Report an issue</a></p>
</div>
</aside>
{%- endif -%}
{%- endmacro -%}


{%- macro script(request_datetime) -%}
{%- if BANNER_START <= request_datetime.strftime('%Y%m%d') and BANNER_END > request_datetime.strftime('%Y%m%d') %}
{%- if config['BROWSE_USER_BANNER_ENABLED'] and (BANNER_START <= request_datetime.strftime('%Y%m%d')) and (BANNER_END > request_datetime.strftime('%Y%m%d')) %}
<link rel="stylesheet" type="text/css" media="screen" href="{{ url_for('static', filename='css/slider.css') }}?v=1.1" />
{%- endif -%}
{%- endmacro -%}
Expand Down

0 comments on commit ff16ae2

Please sign in to comment.