diff --git a/app/assets/stylesheets/articles.scss b/app/assets/stylesheets/articles.scss index a4d216f95..fca6949b2 100644 --- a/app/assets/stylesheets/articles.scss +++ b/app/assets/stylesheets/articles.scss @@ -1200,6 +1200,20 @@ cursor: default; } } + .widget-listing-live-count { + @include themeable(background, theme-secondary-color, $green); + @include themeable(color, theme-opposite-color, white); + border-radius: 3px; + display: inline-block; + font-size: 0.8em; + padding: 1px 5px 0px; + line-height: 1.4em; + } + &.widget-header-listings { + @include themeable(background, theme-container-accent-background, $light-gray); + padding: 10px 12px; + margin: -10px -12px; + } } .widget-body { margin-top: 9px; @@ -1212,6 +1226,11 @@ max-height: 390px; overflow-y: scroll; } + &.widget-body-listings { + .cta-button { + margin-top: 15px; + } + } &.signup-cta-widget-body { ul { li { @@ -1285,6 +1304,37 @@ opacity: 0.86; } } + .widget-listing-link { + display: block; + padding: 6px 12px 4px; + font-size: 0.92em; + width: 100%; + margin-left: -12px; + @include themeable(color, theme-color, $black); + @include themeable(border-bottom, theme-subtle-border, 1px solid $light-medium-gray); + &:first-child { + @include themeable(border-top, theme-subtle-border, 1px solid $light-medium-gray); + } + .widget-listing-link-title { + display: block; + font-weight: 600; + } + .widget-listing-link-category { + display: inline-block; + @include themeable(border, theme-container-border, 1px solid darken($light-medium-gray, 10%)); + @include themeable(color, theme-secondary-color, lighten($medium-gray, 5%)); + + padding: 0px 5px; + font-size: 0.77em; + border-radius: 3px; + margin-bottom: 3px; + line-height: 1.3em; + } + &:hover { + background: $lightest-gray; + @include themeable(background, theme-container-background-hover, $lightest-gray); + } + } .widget-accent { background: $purple; color: $bold-blue; @@ -1305,7 +1355,7 @@ } } .widget-events-single-link { - color: #000000; + color: $black; font-weight: 500; } .widget-user-pic { diff --git a/app/controllers/classified_listings_controller.rb b/app/controllers/classified_listings_controller.rb index 7725334b4..dae71bf94 100644 --- a/app/controllers/classified_listings_controller.rb +++ b/app/controllers/classified_listings_controller.rb @@ -5,7 +5,7 @@ class ClassifiedListingsController < ApplicationController before_action :authenticate_user!, only: %i[edit update new] def index - @displayed_classified_listing = ClassifiedListing.find_by!(category: params[:category], slug: params[:slug]) if params[:slug] + @displayed_classified_listing = ClassifiedListing.find_by!(slug: params[:slug]) if params[:slug] mod_page if params[:view] == "moderate" @classified_listings = if params[:category].blank? ClassifiedListing.where(published: true).order("bumped_at DESC").limit(12) diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 5e008525c..fa604ec17 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -121,6 +121,7 @@ class StoriesController < ApplicationController end end assign_podcasts + assign_classified_listings @article_index = true set_surrogate_key_header "main_app_home_page" response.headers["Surrogate-Control"] = "max-age=600, stale-while-revalidate=30, stale-if-error=86400" @@ -251,6 +252,10 @@ class StoriesController < ApplicationController select(:slug, :title, :podcast_id) end + def assign_classified_listings + @classified_listings = ClassifiedListing.where(published: true).select(:title, :category, :slug, :bumped_at) + end + def article_finder(num_articles) tag = params[:tag] articles = Article.published.limited_column_select.page(@page).per(num_articles) diff --git a/app/models/article.rb b/app/models/article.rb index ba807b4e7..6dd2369fa 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -78,7 +78,7 @@ class Article < ApplicationRecord published. cached_tagged_with("help"). order("created_at DESC"). - where("published_at > ? AND comments_count < ?", 12.hours.ago, 6) + where("published_at > ? AND comments_count < ? AND score > ?", 12.hours.ago, 6, -4) } scope :limited_column_select, lambda { diff --git a/app/models/classified_listing.rb b/app/models/classified_listing.rb index 20323a0b9..9c3dc6872 100644 --- a/app/models/classified_listing.rb +++ b/app/models/classified_listing.rb @@ -75,6 +75,10 @@ class ClassifiedListing < ApplicationRecord } end + def path + "/listings/#{category}/#{slug}" + end + private def evaluate_markdown diff --git a/app/views/articles/_sidebar_additional.html.erb b/app/views/articles/_sidebar_additional.html.erb index c63279181..e976b07e4 100644 --- a/app/views/articles/_sidebar_additional.html.erb +++ b/app/views/articles/_sidebar_additional.html.erb @@ -27,6 +27,22 @@ <% end %> + <% if params[:timeframe].blank? && @classified_listings.any? %> +
+ <% end %> <% if Article.active_help.any? %>