diff --git a/app/assets/stylesheets/ltags/PollTag.scss b/app/assets/stylesheets/ltags/PollTag.scss index e37fabd88..0bc4efb31 100644 --- a/app/assets/stylesheets/ltags/PollTag.scss +++ b/app/assets/stylesheets/ltags/PollTag.scss @@ -1,4 +1,5 @@ @import 'variables'; +@import 'mixins'; .ltag-poll { width: 600px; @@ -74,7 +75,11 @@ font-weight: bold; } &.ltag-optionnotvotedfor { - background: $light-medium-gray; + @include themeable( + background, + theme-container-accent-background, + $light-medium-gray + ); } } .ltag-votepercenttext { diff --git a/app/controllers/html_variants_controller.rb b/app/controllers/html_variants_controller.rb index 72b50219c..f5e13cf53 100644 --- a/app/controllers/html_variants_controller.rb +++ b/app/controllers/html_variants_controller.rb @@ -4,11 +4,13 @@ class HtmlVariantsController < ApplicationController def index authorize HtmlVariant @html_variants = if params[:state] == "mine" - current_user.html_variants.order("created_at DESC").includes(:user).page(params[:page]).per(15) + current_user.html_variants.order("created_at DESC").includes(:user).page(params[:page]).per(30) elsif params[:state] == "admin" - HtmlVariant.where(published: true, approved: false).order("created_at DESC").includes(:user).page(params[:page]).per(15) + HtmlVariant.where(published: true, approved: false).order("created_at DESC").includes(:user).page(params[:page]).per(30) + elsif params[:state].present? + HtmlVariant.where(published: true, approved: true, group: params[:state]).order("success_rate DESC").includes(:user).page(params[:page]).per(30) else - HtmlVariant.where(published: true, approved: true).order("success_rate DESC").includes(:user).page(params[:page]).per(15) + HtmlVariant.where(published: true, approved: true).order("success_rate DESC").includes(:user).page(params[:page]).per(30) end end diff --git a/app/models/user.rb b/app/models/user.rb index 2c786d5dc..cc2387ad0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -117,8 +117,8 @@ class User < ApplicationRecord message: "%{value} must be either v1 or v2" } validates :config_theme, - inclusion: { in: %w[default night_theme pink_theme], - message: "%{value} must be either default, pink theme, or night theme" } + inclusion: { in: %w[default night_theme pink_theme minimal_light_theme], + message: "%{value} is not a valid theme" } validates :config_font, inclusion: { in: %w[default sans_serif comic_sans], message: "%{value} must be either default or sans serif" } diff --git a/app/views/html_variants/index.html.erb b/app/views/html_variants/index.html.erb index 3c74c5e9d..39fc85876 100644 --- a/app/views/html_variants/index.html.erb +++ b/app/views/html_variants/index.html.erb @@ -7,6 +7,9 @@ <% if params[:state] == "mine" %>

My Entries

diff --git a/app/views/html_variants/show.html.erb b/app/views/html_variants/show.html.erb index f4a7c534a..687bd3465 100644 --- a/app/views/html_variants/show.html.erb +++ b/app/views/html_variants/show.html.erb @@ -16,7 +16,7 @@ <% else %> -
+
<%= @html_variant.html.html_safe %>
diff --git a/app/views/layouts/_user_config.html.erb b/app/views/layouts/_user_config.html.erb index 001d80771..1ef062973 100644 --- a/app/views/layouts/_user_config.html.erb +++ b/app/views/layouts/_user_config.html.erb @@ -3,8 +3,8 @@ var bodyClass = localStorage.getItem('config_body_class'); document.body.className = bodyClass; if (bodyClass.includes('night-theme')) { - document.getElementById('body-styles').innerHTML = '' + } else if(bodyClass.includes('minimal-light-theme')) { + document.getElementById('body-styles').innerHTML = '' } if (navigator.userAgent === 'DEV-Native-ios') { document.getElementsByTagName("body")[0].classList.add("dev-ios-native-body"); diff --git a/app/views/users/_misc.html.erb b/app/views/users/_misc.html.erb index d2bfa4c9b..bcb5e2efb 100644 --- a/app/views/users/_misc.html.erb +++ b/app/views/users/_misc.html.erb @@ -40,7 +40,7 @@ <%= form_for(@user, html: { id: nil }) do |f| %>
<%= f.label :config_theme, "Site Theme" %> - <%= f.select(:config_theme, options_for_select(["default", "night theme", "pink theme"], @user.config_theme.tr("_", " "))) %> + <%= f.select(:config_theme, options_for_select(["default", "night theme", "minimal light theme", "pink theme"], @user.config_theme.tr("_", " "))) %> Default is light style. Night theme is in public alpha.
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b35b86d88..d539ff1ab 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -556,6 +556,11 @@ RSpec.describe User, type: :model do expect(user.decorate.config_body_class).to eq("pink-theme default-article-body") end + it "creates proper body class with pink theme" do + user.config_theme = "minimal_light_theme" + expect(user.decorate.config_body_class).to eq("minimal-light-theme default-article-body") + end + it "inserts into mailchimp" do expect(user.subscribe_to_mailchimp_newsletter_without_delay).to eq true end