From 7984c566eb83cfe1c0cdf43261e8dccb73778c62 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Tue, 3 Dec 2024 14:10:10 +0100 Subject: [PATCH 1/2] enable and disable twitter news in home page --- .env.sample | 2 ++ app/assets/stylesheets/home.scss | 7 ++++++- app/views/home/index.html.haml | 20 +++++++++++--------- config/bioportal_config_env.rb.sample | 3 +++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.env.sample b/.env.sample index 6a8e41d24..d63ef287a 100644 --- a/.env.sample +++ b/.env.sample @@ -10,6 +10,8 @@ API_KEY= UI_THEME=ontoportal +TWITTER_NEWS= + BIOMIXER_URL= BIOMIXER_APIKEY= diff --git a/app/assets/stylesheets/home.scss b/app/assets/stylesheets/home.scss index 875138bdd..d3f04a396 100644 --- a/app/assets/stylesheets/home.scss +++ b/app/assets/stylesheets/home.scss @@ -412,6 +412,11 @@ i.fa.fa-caret-square-o-down { } .home-sub-section-left{ width: 550px; + flex-grow: 0; +} +.home-sub-section-left.full-width { + width: 100%; /* Takes the full width when the right section is absent */ + flex-grow: 1; /* Allows the left section to stretch and fill available space */ } .home-sub-section-right{ @@ -423,7 +428,7 @@ i.fa.fa-caret-square-o-down { font-weight: 700; } .home-fair-scores{ - height: 360px; + /* height: 550px; */ padding-top: 35px; } .home-twitter-news{ diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 43fc5ff02..32c007341 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -136,7 +136,8 @@ %img{:src => asset_path("play-white.svg")}/ .home-section .home-section-sub-sections-container - .home-sub-section-left + - is_twitter_enabled = !$TWITTER_NEWS.blank? + .home-sub-section-left{class: (is_twitter_enabled ? '' : 'full-width')} %div.align-items %h4.margin-items= t('home.fairness') = render Display::InfoTooltipComponent.new(text: t('home.info_tooltip_text') ) @@ -166,14 +167,15 @@ %div.home-fair-details %p= t('home.fair_details') - .home-sub-section-right - %h4= t('home.twitter_news') - %hr.home-section-line - .home-card.home-twitter-news - %a.twitter-timeline{"data-height" => "360", :href => "https://twitter.com/lagroportal?ref_src=twsrc%5Etfw"} - .home-twitter-loader - = render LoaderComponent.new(type: 'pulsing') - %script{:async => "", :charset => "utf-8", :src => "https://platform.twitter.com/widgets.js"} + - if is_twitter_enabled + .home-sub-section-right + %h4= t('home.twitter_news') + %hr.home-section-line + .home-card.home-twitter-news + %a.twitter-timeline{"data-height" => "360", :href => $TWITTER_NEWS} + .home-twitter-loader + = render LoaderComponent.new(type: 'pulsing') + %script{:async => "", :charset => "utf-8", :src => "https://platform.twitter.com/widgets.js"} - if slices_enabled? .home-section diff --git a/config/bioportal_config_env.rb.sample b/config/bioportal_config_env.rb.sample index 8d6c4b52e..80091a5a5 100644 --- a/config/bioportal_config_env.rb.sample +++ b/config/bioportal_config_env.rb.sample @@ -8,6 +8,9 @@ $ORG_URL = ENV['ORG_URL'] # Site name (required) $SITE = ENV['SITE'] +# Twitter section +$TWITTER_NEWS = ENV["TWITTER_NEWS"] + # Full string for site, EX: "NCBO BioPortal", do not modify $ORG_SITE = $ORG.nil? || $ORG.empty? ? $SITE : "#{$ORG} #{$SITE}" From 76cdad3814d7c254a5bdc2a71bcdb3a98077ecf7 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Tue, 10 Dec 2024 11:04:31 +0100 Subject: [PATCH 2/2] make the block as an empty white space --- app/assets/stylesheets/home.scss | 7 +------ app/views/home/index.html.haml | 6 ++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/home.scss b/app/assets/stylesheets/home.scss index d3f04a396..875138bdd 100644 --- a/app/assets/stylesheets/home.scss +++ b/app/assets/stylesheets/home.scss @@ -412,11 +412,6 @@ i.fa.fa-caret-square-o-down { } .home-sub-section-left{ width: 550px; - flex-grow: 0; -} -.home-sub-section-left.full-width { - width: 100%; /* Takes the full width when the right section is absent */ - flex-grow: 1; /* Allows the left section to stretch and fill available space */ } .home-sub-section-right{ @@ -428,7 +423,7 @@ i.fa.fa-caret-square-o-down { font-weight: 700; } .home-fair-scores{ - /* height: 550px; */ + height: 360px; padding-top: 35px; } .home-twitter-news{ diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 32c007341..b99138af6 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -136,8 +136,7 @@ %img{:src => asset_path("play-white.svg")}/ .home-section .home-section-sub-sections-container - - is_twitter_enabled = !$TWITTER_NEWS.blank? - .home-sub-section-left{class: (is_twitter_enabled ? '' : 'full-width')} + .home-sub-section-left %div.align-items %h4.margin-items= t('home.fairness') = render Display::InfoTooltipComponent.new(text: t('home.info_tooltip_text') ) @@ -166,8 +165,7 @@ %a{:href => "/landscape#fairness_assessment"} %div.home-fair-details %p= t('home.fair_details') - - - if is_twitter_enabled + - if !$TWITTER_NEWS.blank? .home-sub-section-right %h4= t('home.twitter_news') %hr.home-section-line