This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-site.git


The following commit(s) were added to refs/heads/main by this push:
     new ec2f46b  Show Solr Operator news update on main page (#39)
ec2f46b is described below

commit ec2f46b86073ecf8590867856d8cc617a436bf37
Author: Houston Putman <[email protected]>
AuthorDate: Mon Sep 20 15:50:07 2021 -0400

    Show Solr Operator news update on main page (#39)
---
 themes/solr/static/css/base.css           | 12 ++++++++++++
 themes/solr/static/css/operator.css       | 12 ++++++++++++
 themes/solr/static/javascript/main.js     |  5 +++++
 themes/solr/templates/base.html           |  2 ++
 themes/solr/templates/index.html          | 14 ++++++++++++++
 themes/solr/templates/operator/index.html |  2 +-
 6 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/themes/solr/static/css/base.css b/themes/solr/static/css/base.css
index 3de1a63..cbd3dbe 100644
--- a/themes/solr/static/css/base.css
+++ b/themes/solr/static/css/base.css
@@ -537,6 +537,18 @@ section.orange.full-width {
   font-size: larger;
 }
 
+.topnews-operator {
+  background-color: #59BD81;
+  padding-top: 15px;
+  padding-bottom: 0px;
+  display: none;
+}
+
+.topnews-operator .row p a {
+  color: #262130;
+  font-size: larger;
+}
+
 /*
  * Footer
  */
diff --git a/themes/solr/static/css/operator.css 
b/themes/solr/static/css/operator.css
index 1e5938e..32297df 100644
--- a/themes/solr/static/css/operator.css
+++ b/themes/solr/static/css/operator.css
@@ -537,6 +537,18 @@ section.orange.full-width {
   font-size: larger;
 }
 
+.topnews-operator {
+  background-color: #59BD81;
+  padding-top: 15px;
+  padding-bottom: 0px;
+  display: none;
+}
+
+.topnews-operator .row p a {
+  color: #262130;
+  font-size: larger;
+}
+
 /*
  * Footer
  */
diff --git a/themes/solr/static/javascript/main.js 
b/themes/solr/static/javascript/main.js
index ac8aa24..4bd2bb8 100644
--- a/themes/solr/static/javascript/main.js
+++ b/themes/solr/static/javascript/main.js
@@ -41,6 +41,11 @@
     if (latest_news_days < 60) {
       $('.topnews').show();
     }
+    // Conditionally show last operator news entry
+    const latest_operator_news_days = (new Date() - new 
Date($('.topnews-operator').attr('latest-date'))) / (1000 * 60 * 60 * 24);
+    if (latest_operator_news_days < 60) {
+      $('.topnews-operator').show();
+    }
   });
 
   /*
diff --git a/themes/solr/templates/base.html b/themes/solr/templates/base.html
index 305fcb3..a29686a 100644
--- a/themes/solr/templates/base.html
+++ b/themes/solr/templates/base.html
@@ -34,6 +34,8 @@
     {% endblock %}
     {% block solr_news %}
     {% endblock %}
+    {% block solr_operator_news %}
+    {% endblock %}
     {% block hero_header %}
     {% endblock %}
     {% block content %}
diff --git a/themes/solr/templates/index.html b/themes/solr/templates/index.html
index 487193f..572c821 100644
--- a/themes/solr/templates/index.html
+++ b/themes/solr/templates/index.html
@@ -28,6 +28,20 @@
 </section>
 {% endblock %}
 
+{% block solr_operator_news %}
+{% set latest_operator_articles = (articles | selectattr("category.name", 
"eq", "solr/operator/news") | list)[:1] %}
+{% set latest_operator_date = latest_operator_articles[0].date | 
strftime("%Y-%m-%d") %}
+<section class="topnews-operator" latest-date="{{ latest_operator_date }}">
+  <div class="row">
+    {% for article in latest_operator_articles %}
+    <p id="{{article.slug}}-operator">
+      <a href="/operator/news.html#{{article.slug}}"><b>NEWS:</b> 
{{article.title}}</a> <span class="news-date">({{ article.date | 
strftime("%d.%b") }})</span>
+    </p>
+    {% endfor %}
+  </div>
+</section>
+{% endblock %}
+
 {% block content_inner %}
 <section class="gray offset-medium" id="learn-more"></section>
 
diff --git a/themes/solr/templates/operator/index.html 
b/themes/solr/templates/operator/index.html
index 73d3cb6..7b11394 100644
--- a/themes/solr/templates/operator/index.html
+++ b/themes/solr/templates/operator/index.html
@@ -19,7 +19,7 @@
 {% block solr_operator_news %}
 {% set latest_articles = (articles | selectattr("category.name", "eq", 
"solr/operator/news") | list)[:1] %}
 {% set latest_date = latest_articles[0].date | strftime("%Y-%m-%d") %}
-<section class="topnews" latest-date="{{ latest_date }}">
+<section class="topnews-operator" latest-date="{{ latest_date }}">
   <div class="row">
     {% for article in latest_articles %}
     <p id="{{article.slug}}">

Reply via email to